X-Git-Url: https://git.adam-barratt.org.uk/?a=blobdiff_plain;f=update.cgi;h=d7749d89d75e1876428ae77254124da8e8d84be4;hb=9b394648f35965c5b6e18a8ff12af25d73866f7a;hp=052238f4bb6e60009fd240ddefca79263a3ea827;hpb=1dbf98fc34104a2a0b56014096e051a4aee3f174;p=mirror%2Fuserdir-ldap-cgi.git diff --git a/update.cgi b/update.cgi index 052238f..d7749d8 100755 --- a/update.cgi +++ b/update.cgi @@ -13,7 +13,8 @@ use Digest::HMAC_SHA1 qw(hmac_sha1_hex); use Util; use English; use URI::Escape; -use Net::LDAP qw(:all); +use Crypt::PasswdMD5; +use Net::LDAP qw(LDAP_SUCCESS LDAP_PROTOCOL_ERROR); my %config = &Util::ReadConfigFile; @@ -206,7 +207,7 @@ if (!($query->param('doupdate'))) { # Actually update stuff... - my ($newpassword, $newstaddress); + my ($newpassword, $newstaddress, $newwebpassword); # Good god, why would we want to do that here? it breaks password setting # etc, and it doesn't prevent people from setting eveil stuff in ldap @@ -236,6 +237,23 @@ if (!($query->param('doupdate'))) { &Util::UpdateAuthToken($authtoken, $query->param('newpass')); } + if ($query->param('newwebpass') && $query->param('newwebpassvrfy')) { + if ($query->param('newwebpass') ne $query->param('newwebpassvrfy')) { + # passwords don't match... + &Util::HTMLError("The passwords you specified do not match. Please go back and try again."); + } + + my ($r, $msg) = &Util::checkPasswordQuality($query->param('newwebpass'), undef, [@ldapinfo_for_pwcheck]); + if ($r) { + &Util::HTMLError("Password check failed: $msg. Please go back and try again."); + } + + # create a md5 crypted password + $newwebpassword = apache_md5_crypt($query->param('newwebpass'), &Util::CreateMD5Salt()); + + &Util::LDAPUpdate($ldap, $editdn, 'webPassword', $newwebpassword); + } + $newstaddress = $query->param('staddress'); $newstaddress =~ s/\n/\$/m;