Server IP : 103.119.228.120 / Your IP : 52.15.37.74 Web Server : Apache System : Linux v8.techscape8.com 3.10.0-1160.119.1.el7.tuxcare.els2.x86_64 #1 SMP Mon Jul 15 12:09:18 UTC 2024 x86_64 User : nobody ( 99) PHP Version : 5.6.40 Disable Function : shell_exec,symlink,system,exec,proc_get_status,proc_nice,proc_terminate,define_syslog_variables,syslog,openlog,closelog,escapeshellcmd,passthru,ocinum cols,ini_alter,leak,listen,chgrp,apache_note,apache_setenv,debugger_on,debugger_off,ftp_exec,dl,dll,myshellexec,proc_open,socket_bind,proc_close,escapeshellarg,parse_ini_filepopen,fpassthru,exec,passthru,escapeshellarg,escapeshellcmd,proc_close,proc_open,ini_alter,popen,show_source,proc_nice,proc_terminate,proc_get_status,proc_close,pfsockopen,leak,apache_child_terminate,posix_kill,posix_mkfifo,posix_setpgid,posix_setsid,posix_setuid,dl,symlink,shell_exec,system,dl,passthru,escapeshellarg,escapeshellcmd,myshellexec,c99_buff_prepare,c99_sess_put,fpassthru,getdisfunc,fx29exec,fx29exec2,is_windows,disp_freespace,fx29sh_getupdate,fx29_buff_prepare,fx29_sess_put,fx29shexit,fx29fsearch,fx29ftpbrutecheck,fx29sh_tools,fx29sh_about,milw0rm,imagez,sh_name,myshellexec,checkproxyhost,dosyayicek,c99_buff_prepare,c99_sess_put,c99getsource,c99sh_getupdate,c99fsearch,c99shexit,view_perms,posix_getpwuid,posix_getgrgid,posix_kill,parse_perms,parsesort,view_perms_color,set_encoder_input,ls_setcheckboxall,ls_reverse_all,rsg_read,rsg_glob,selfURL,dispsecinfo,unix2DosTime,addFile,system,get_users,view_size,DirFiles,DirFilesWide,DirPrintHTMLHeaders,GetFilesTotal,GetTitles,GetTimeTotal,GetMatchesCount,GetFileMatchesCount,GetResultFiles,fs_copy_dir,fs_copy_obj,fs_move_dir,fs_move_obj,fs_rmdir,SearchText,getmicrotime MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /usr/local/ssl/local/ssl/local/ssl/local/share/perl5/Net/LDAP/Extension/ |
Upload File : |
package Net::LDAP::Extension::SetPassword; require Net::LDAP::Extension; our @ISA = qw(Net::LDAP::Extension); our $VERSION = '0.06'; use Convert::ASN1; my $passwdModReq = Convert::ASN1->new; $passwdModReq->prepare(q<SEQUENCE { user [0] OCTET STRING OPTIONAL, oldpasswd [1] OCTET STRING OPTIONAL, newpasswd [2] OCTET STRING OPTIONAL }>); my $passwdModRes = Convert::ASN1->new; $passwdModRes->prepare(q<SEQUENCE { genPasswd [0] OCTET STRING OPTIONAL }>); sub Net::LDAP::set_password { my $ldap = shift; my %opt = @_; my $res = $ldap->extension( name => '1.3.6.1.4.1.4203.1.11.1', value => $passwdModReq->encode(\%opt), ($opt{control} ? (control => $opt{control}) : ()) ); bless $res; # Naughty :-) } sub gen_password { my $self = shift; my $out = $passwdModRes->decode($self->response); $out->{genPasswd}; } 1; __END__ =head1 NAME Net::LDAP::Extension::SetPassword - LDAPv3 Modify Password extension object =head1 SYNOPSIS use Net::LDAP; use Net::LDAP::Extension::SetPassword; $ldap = Net::LDAP->new( "ldap.mydomain.eg" ); $ldap->bind('cn=Joe User,cn=People,dc=mydomain,dc=eg", password => 'oldPassword'); $mesg = $ldap->set_password( oldpasswd => 'oldPassword' ); die "error: ", $mesg->code(), ": ", $mesg->error() if ($mesg->code()); print "changed your password to", $mesg->gen_password() , "\n"; =head1 DESCRIPTION C<Net::LDAP::Extension::SetPassword> implements the C<Modify Password> extended LDAPv3 operation as described in RFC 3062. It implements no object by itself but extends the L<Net::LDAP> object by another method: =head1 METHODS =over 4 =item set_password ( OPTIONS ) Set the password for a user. OPTIONS is a list of key/value pairs. The following keys are recognized: =over 4 =item user If present, this option contains the octet string representation of the user associated with the request. Depending on how users are identified in the directory this string may or may not be a DN according to RFC 4514. If this option is not present, the request acts up upon the password of the user currently associated with the LDAP session. =item oldpasswd This option, if present, must contain the current password of the user for whom this operation is performed. It depends on the server's implementation in which circumstances this option is allowed to be missing. =item newpasswd If present, this option contains the desired password for the user for whom the operation is performed. Depending on the server's implementation this option may be required by the LDAP server. =back =item gen_password ( ) Return the password generated by the server in response to the C<set_password()> call when applicable. The server will not generate a new password if C<newpasswd> was passed to C<set_password()>. This method is a method of the L<Net::LDAP::Message> response object returned in reply to C<set_password()> in case the C<set_password()> call succeeded. By this method the caller can query for the value of the password in case he did not call C<set_password()> with the C<newpasswd> option. =back =head1 SEE ALSO L<Net::LDAP>, L<Net::LDAP::Extension> =head1 AUTHOR Graham Barr E<lt>gbarr@pobox.comE<gt>, documentation by Peter Marschall E<lt>peter@adpm.deE<gt>. Please report any bugs, or post any suggestions, to the perl-ldap mailing list E<lt>perl-ldap@perl.orgE<gt> =head1 COPYRIGHT Copyright (c) 2002-2004 Graham Barr. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. =cut