-
- LDAPUpdate($ldap, $editdn, 'postalAddress', $newstaddress);
- LDAPUpdate($ldap, $editdn, 'l', $query->param('l'));
- LDAPUpdate($ldap, $editdn, 'latitude', $lat);
- LDAPUpdate($ldap, $editdn, 'longitude', $long);
- LDAPUpdate($ldap, $editdn, 'c', $query->param('country'));
- LDAPUpdate($ldap, $editdn, 'postalcode', $query->param('postalcode'));
- LDAPUpdate($ldap, $editdn, 'telephoneNumber', $query->param('telephonenumber'));
- LDAPUpdate($ldap, $editdn, 'facsimileTelephoneNumber', $query->param('facsimiletelephonenumber'));
- LDAPUpdate($ldap, $editdn, 'loginShell', $query->param('loginshell'));
- LDAPUpdate($ldap, $editdn, 'emailForward', $query->param('email'));
- LDAPUpdate($ldap, $editdn, 'privatesub', $query->param('privatesub'));
- LDAPUpdate($ldap, $editdn, 'ircNick', $query->param('ircnick'));
- LDAPUpdate($ldap, $editdn, 'labeledUrl', $query->param('labeledurl'));
- LDAPUpdate($ldap, $editdn, 'onvacation', $query->param('onvacation'));
+ my ($greylisting, $callout, $mailcontentinspection, $defaultoptions);
+
+ $greylisting = $query->param('mailgreylisting');
+ if (!$greylisting or $greylisting ne "TRUE") {
+ $greylisting = "FALSE";
+ }
+
+ $callout = $query->param('mailcallout');
+ if (!$callout or $callout ne "TRUE") {
+ $callout = "FALSE";
+ }
+
+ $mailcontentinspection = $query->param('mailcontentinspection');
+ if (!$mailcontentinspection or ($mailcontentinspection ne "blackhole" and $mailcontentinspection ne "markup")) {
+ $mailcontentinspection = "reject";
+ }
+
+ $defaultoptions = $query->param('maildefaultoptions');
+ if (!$defaultoptions or $defaultoptions ne "TRUE") {
+ $defaultoptions = "FALSE";
+ }
+
+ my $newsudo;
+ my $newsudo_hosts;
+ if ($query->param('newsudopass') && $query->param('newsudopassvrfy')) {
+ my $host = $query->param('newsudopass-host');
+ if ($host =~ /[^a-z0-9.-]/ and $host ne '*') {
+ &Util::HTMLError("The sudo host has weird characters '$host'.");
+ }
+
+ if ($query->param('newsudopass') ne $query->param('newsudopassvrfy')) {
+ &Util::HTMLError("The sudo passwords you specified do not match. Please go back and try again.");
+ }
+
+ my $ldappass = $password;
+ $ldappass = $query->param('newpass') if $query->param('newpass');
+ push @ldapinfo_for_pwcheck, $host, split(/\./, $host);
+ my ($r, $msg) = &Util::checkPasswordQuality($query->param('newsudopass'), $ldappass, [@ldapinfo_for_pwcheck]);
+ if ($r) {
+ &Util::HTMLError("Password check failed for new sudo pass: $msg. Please go back and try again.");
+ }
+
+ # create a md5 crypted password
+ my $newsudopassword = crypt($query->param('newsudopass'), &Util::CreateCryptSalt(1));
+ my $ug = new Data::UUID;
+ my $uuid = $ug->create_str();
+
+ $newsudo = "$uuid unconfirmed $host $newsudopassword";
+ $newsudo_hosts = $host;
+ }
+
+ my %delete_uuids = map { s/^sudopassword-delete-//; $_ => 1} grep { $query->param($_) eq 'delete' } grep { /^sudopassword-delete-/ } $query->param;
+ my @keepsudo;
+ for my $entry (@{$entry->{'sudopassword'}}) {
+ my ($uuid, $status, $hosts, $crypted) = ($entry =~ /^([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}) (confirmed:[0-9a-f]{40}|unconfirmed) ([a-z0-9.,*-]+) ([^ ]+)$/);
+ next unless defined ($uuid);
+ next if (defined $delete_uuids{$uuid});
+ my %hosts = map { $_ => 1 } split(/,/, $hosts);
+ next if ($hosts{$newsudo_hosts});
+ push @keepsudo, $entry;
+ };
+ if ($newsudo ne '') {
+ push @keepsudo, $newsudo;
+ }
+
+ &Util::LDAPUpdate($ldap, $editdn, 'postalAddress', $newstaddress);
+ &Util::LDAPUpdate($ldap, $editdn, 'l', $query->param('l'));
+ &Util::LDAPUpdate($ldap, $editdn, 'latitude', $lat);
+ &Util::LDAPUpdate($ldap, $editdn, 'longitude', $long);
+ &Util::LDAPUpdate($ldap, $editdn, 'c', $query->param('country'));
+ &Util::LDAPUpdate($ldap, $editdn, 'postalCode', $query->param('postalcode'));
+ &Util::LDAPUpdate($ldap, $editdn, 'telephoneNumber', $query->param('telephonenumber'));
+ &Util::LDAPUpdate($ldap, $editdn, 'facsimileTelephoneNumber', $query->param('facsimiletelephonenumber'));
+ &Util::LDAPUpdate($ldap, $editdn, 'bATVToken', $query->param('bATVToken'));
+ &Util::LDAPUpdate($ldap, $editdn, 'VoIP', $query->param('VoIP'));
+ &Util::LDAPUpdate($ldap, $editdn, 'loginShell', $query->param('loginshell'));
+ &Util::LDAPUpdate($ldap, $editdn, 'emailForward', $query->param('email'));
+ &Util::LDAPUpdate($ldap, $editdn, 'privateSub', $query->param('privatesub'));
+ &Util::LDAPUpdate($ldap, $editdn, 'ircNick', $query->param('ircnick'));
+ &Util::LDAPUpdate($ldap, $editdn, 'icqUin', $query->param('icquin'));
+ &Util::LDAPUpdate($ldap, $editdn, 'jabberJID', $query->param('jabberjid'));
+ &Util::LDAPUpdate($ldap, $editdn, 'labeledURI', $query->param('labeleduri'));
+ &Util::LDAPUpdate($ldap, $editdn, 'onVacation', $query->param('onvacation'));
+ &Util::LDAPUpdate($ldap, $editdn, 'birthDate', $query->param('birthdate')) if $bd_ok;
+ &Util::LDAPUpdate($ldap, $editdn, 'mailDisableMessage', $query->param('maildisablemessage'));
+ &Util::LDAPUpdate($ldap, $editdn, 'mailCallout', $callout);
+ &Util::LDAPUpdate($ldap, $editdn, 'mailContentInspectionAction', $mailcontentinspection);
+ &Util::LDAPUpdate($ldap, $editdn, 'mailGreylisting', $greylisting);
+ &Util::LDAPUpdate($ldap, $editdn, 'mailDefaultOptions', $defaultoptions);
+ &Util::LDAPUpdate($ldap, $editdn, 'sudoPassword', \@keepsudo);