Index: openacs-4/packages/auth-pam/tcl/auth-pam-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/auth-pam/tcl/auth-pam-procs.tcl,v diff -u -r1.1.4.1 -r1.1.4.2 --- openacs-4/packages/auth-pam/tcl/auth-pam-procs.tcl 9 Jul 2004 22:00:58 -0000 1.1.4.1 +++ openacs-4/packages/auth-pam/tcl/auth-pam-procs.tcl 21 Sep 2004 17:57:22 -0000 1.1.4.2 @@ -124,20 +124,41 @@ ad_proc -private auth::pam::password::ChangePassword { username - old_password new_password + {old_password ""} {parameters {}} {authority_id {}} } { Implements the ChangePassword operation of the auth_password service contract for PAM. } { - if { [ns_pam chpass $username $old_password $new_passwd] } { - set result(password_status) ok + + if ![empty_string_p $old_password] { + if { [ns_pam chpass $username $old_password $new_passwd] } { + set result(password_status) ok + } else { + set result(password_status) auth_error + } } else { - set result(password_status) auth_error - } + # TODO: + # 'ns_pam chpass' requires the old password, so we need to + # set the old_password as optional parameter in ns_pam chpass. + # + # ns_pam chpass username oldpassword newpasswd + # + # This is the change password command syntax. You supply the username old password and new password. you will be returned either: + # + # - 1 for a valid login + # - 0 Indicating a bad username/password combo + # It will return NS_ERROR and the string of the PAM error if there is an error. + if { [ns_pam chpass $username $old_password $new_passwd] } { + set result(password_status) ok + } else { + ns_log error "auth-pam-procs.tcl: old password error" + set result(password_status) auth_error + } + } return [array get result] }