aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorseanbright <seanbright@f38db490-d61c-443f-a65b-d21fe96a405b>2008-09-20 00:55:01 +0000
committerseanbright <seanbright@f38db490-d61c-443f-a65b-d21fe96a405b>2008-09-20 00:55:01 +0000
commit19a9b8c659c350d8054212e2ab64b0dd29a16bce (patch)
tree275928769a2268cc32cae2d55fbdcf19fb5775b5
parent5e39b0bfe18f108612d817601b2a57acf9706ae8 (diff)
Merged revisions 143737 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk ................ r143737 | seanbright | 2008-09-19 20:52:20 -0400 (Fri, 19 Sep 2008) | 17 lines Merged revisions 143736 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r143736 | seanbright | 2008-09-19 20:50:10 -0400 (Fri, 19 Sep 2008) | 9 lines Make vmail.cgi work with mailboxes defined in users.conf, too. (closes issue #13187) Reported by: netvoice Patches: 20080911__bug13187.diff.txt uploaded by Corydon76 (license 14) (Slightly modified to take alchamist's comments on mantis into account) Tested by: msales, alchamist, seanbright ........ ................ git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.6.1@143739 f38db490-d61c-443f-a65b-d21fe96a405b
-rw-r--r--contrib/scripts/vmail.cgi35
1 files changed, 34 insertions, 1 deletions
diff --git a/contrib/scripts/vmail.cgi b/contrib/scripts/vmail.cgi
index 95bb9bb77..de51a4dc7 100644
--- a/contrib/scripts/vmail.cgi
+++ b/contrib/scripts/vmail.cgi
@@ -193,7 +193,40 @@ sub check_login($$)
}
}
close(VMAIL);
- return ("", $category);
+ return check_login_users();
+}
+
+sub check_login_users {
+ my ($mbox, $context) = split(/\@/, param('mailbox'));
+ my $pass = param('password');
+ my ($found, $fullname) = (0, "");
+ open VMAIL, "</etc/asterisk/users.conf";
+ while (<VMAIL>) {
+ chomp;
+ if (m/\[(.*)\]/) {
+ if ($1 eq $mbox) {
+ $found = 1;
+ } elsif ($found == 2) {
+ close VMAIL;
+ return (($fullname ? $fullname : "Extension $mbox in $context"), $context);
+ } else {
+ $found = 0;
+ }
+ } elsif ($found) {
+ my ($var, $value) = split /\s*=\s*/, $_, 2;
+ if ($var eq 'vmsecret' and $value eq $pass) {
+ $found = 2;
+ } elsif ($var eq 'fullname') {
+ $fullname = $value;
+ if ($found == 2) {
+ close VMAIL;
+ return ($fullname, $context);
+ }
+ }
+ }
+ }
+ close VMAIL;
+ return ("", "");
}
sub validmailbox($$$$)