From: Sean Bright Date: Sat, 20 Sep 2008 00:50:10 +0000 (+0000) Subject: Make vmail.cgi work with mailboxes defined in users.conf, too. X-Git-Tag: 1.4.23-rc1~76 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=c83cefe9be003a98788f08169ce875313aa3dcfd;p=thirdparty%2Fasterisk.git 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: https://origsvn.digium.com/svn/asterisk/branches/1.4@143736 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/contrib/scripts/vmail.cgi b/contrib/scripts/vmail.cgi index 95bb9bb771..de51a4dc73 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, ") { + 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($$$$)