{
    "mode": "perldoc",
    "parameter": "Net::LDAP::Extension::SetPassword",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/perldoc/Net%3A%3ALDAP%3A%3AExtension%3A%3ASetPassword/json",
    "generated": "2026-06-13T13:21:23Z",
    "synopsis": "use Net::LDAP;\nuse Net::LDAP::Extension::SetPassword;\n$ldap = Net::LDAP->new( \"ldap.mydomain.eg\" );\n$ldap->bind('cn=Joe User,cn=People,dc=mydomain,dc=eg\",\npassword => 'oldPassword');\n$mesg = $ldap->setpassword( oldpasswd => 'oldPassword' );\ndie \"error: \", $mesg->code(), \": \", $mesg->error()  if ($mesg->code());\nprint \"changed your password to\", $mesg->genpassword() , \"\\n\";",
    "sections": {
        "NAME": {
            "content": "Net::LDAP::Extension::SetPassword - LDAPv3 Modify Password extension object\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "use Net::LDAP;\nuse Net::LDAP::Extension::SetPassword;\n\n$ldap = Net::LDAP->new( \"ldap.mydomain.eg\" );\n\n$ldap->bind('cn=Joe User,cn=People,dc=mydomain,dc=eg\",\npassword => 'oldPassword');\n\n$mesg = $ldap->setpassword( oldpasswd => 'oldPassword' );\n\ndie \"error: \", $mesg->code(), \": \", $mesg->error()  if ($mesg->code());\n\nprint \"changed your password to\", $mesg->genpassword() , \"\\n\";\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "\"Net::LDAP::Extension::SetPassword\" implements the \"Modify Password\" extended LDAPv3 operation\nas described in RFC 3062.\n\nIt implements no object by itself but extends the Net::LDAP object by another method:\n",
            "subsections": []
        },
        "METHODS": {
            "content": "setpassword ( OPTIONS )\nSet the password for a user.\n\nOPTIONS is a list of key/value pairs. The following keys are recognized:\n\nuser\nIf present, this option contains the octet string representation of the user associated\nwith the request. Depending on how users are identified in the directory this string may\nor may not be a DN according to RFC 4514.\n\nIf this option is not present, the request acts up upon the password of the user\ncurrently associated with the LDAP session.\n\noldpasswd\nThis option, if present, must contain the current password of the user for whom this\noperation is performed.\n\nIt depends on the server's implementation in which circumstances this option is allowed\nto be missing.\n\nnewpasswd\nIf present, this option contains the desired password for the user for whom the\noperation is performed.\n\nDepending on the server's implementation this option may be required by the LDAP server.\n\ngenpassword ( )\nReturn the password generated by the server in response to the \"setpassword()\" call when\napplicable. The server will not generate a new password if \"newpasswd\" was passed to\n\"setpassword()\".\n\nThis method is a method of the Net::LDAP::Message response object returned in reply to\n\"setpassword()\" in case the \"setpassword()\" call succeeded.\n\nBy this method the caller can query for the value of the password in case he did not call\n\"setpassword()\" with the \"newpasswd\" option.\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "Net::LDAP, Net::LDAP::Extension\n",
            "subsections": []
        },
        "AUTHOR": {
            "content": "Graham Barr <gbarr@pobox.com>, documentation by Peter Marschall <peter@adpm.de>.\n\nPlease report any bugs, or post any suggestions, to the perl-ldap mailing list\n<perl-ldap@perl.org>\n",
            "subsections": []
        },
        "COPYRIGHT": {
            "content": "Copyright (c) 2002-2004 Graham Barr. All rights reserved. This program is free software; you can\nredistribute it and/or modify it under the same terms as Perl itself.\n",
            "subsections": []
        }
    },
    "summary": "Net::LDAP::Extension::SetPassword - LDAPv3 Modify Password extension object",
    "flags": [],
    "examples": [],
    "see_also": []
}