X-Git-Url: https://git.adam-barratt.org.uk/?p=mirror%2Fuserdir-ldap-cgi.git;a=blobdiff_plain;f=update.cgi;h=e6ba638e6f32019899d6b6db9aaebab41f02cd73;hp=c4d121de6972a32bf34000584fd3e1be64ba5a00;hb=3ebf6f8a1e6353a8fa332a3d6533051de98c5afb;hpb=bb937c32bd6f82064c59c56ef4dc718deb7b581e diff --git a/update.cgi b/update.cgi index c4d121d..e6ba638 100755 --- a/update.cgi +++ b/update.cgi @@ -3,6 +3,7 @@ # $Id: update.cgi,v 1.13 2006/12/28 02:44:02 rmurray Exp $ # (c) 1999 Randolph Chung. Licensed under the GPL. # (c) 2006 Ryan Murray. Licensed under the GPL. +# Copyright (c) 2008, 2011, 2012, 2014, 2015 Peter Palfrader use lib '.'; use strict vars; @@ -25,8 +26,16 @@ my $proto = ($ENV{HTTPS} ? "https" : "http"); my $id = $query->param('id'); my $authtoken = $query->param('authtoken'); -my $password = &Util::CheckAuthToken($authtoken); -my $editdn = $query->param('editdn'); + +my $password = undef; + +if ($authtoken || $id) { + $password = Util::TouchAuthToken($authtoken, $id); +} else { + $password = ''; + $id = ''; + $authtoken = ''; +} if ($proto eq "http" || !($id && $password)) { print "Location: https://$ENV{SERVER_NAME}/$config{webloginhtml}\n\n"; @@ -45,6 +54,7 @@ sub DieHandler { } #$SIG{__DIE__} = \&DieHandler; +my $editdn = "uid=$id,$config{basedn}"; $ldap = Net::LDAP->new($config{ldaphost}); &Util::UpgradeConnection($ldap) unless $config{usessl} eq 'False'; @@ -88,8 +98,6 @@ if (!($query->param('doupdate'))) { $data{$_} = CGI::escapeHTML($data{$_}) if defined $data{$_}; } - $data{gender} = 9 if not $data{gender}; - # Now we have to fill in the rest that needs some processing... $data{id} = $id; $data{authtoken} = $authtoken; @@ -123,15 +131,6 @@ if (!($query->param('doupdate'))) { $data{email} = CGI::escapeHTML(join(", ", @{$entry->{emailforward}})); - my $genderselect = ''; my $mailcontentselect = '