[sork] Sork Passwd errors
Jan Schneider
jan at horde.org
Sun Sep 12 16:43:08 UTC 2010
Zitat von Chris <cjdl01 at brokensolstice.com>:
> Hi,
>
> I'm having a problem with sork passwd. I'm using Debian lenny,
> horde 3.2.2 and passwd 3.0.
Again, an outdated version, this time in combination with a too new
PHP version.
> Every time I try to change my password I get these errors at the top
> of the page:
>
>
>
>
> I need to use the expect backend. When I click "Change Password", I
> get the following at the top of the page:
>
> Notice: Only variable references should be returned by reference in
> /usr/share/horde3/passwd/lib/Driver.php on line 110
>
> Warning: Cannot modify header information - headers already sent by
> (output started at /usr/share/horde3/passwd/lib/Driver.php:110) in
> /etc/horde/passwd3/templates/common-header.inc on line 4
>
> Warning: Cannot modify header information - headers already sent by
> (output started at /usr/share/horde3/passwd/lib/Driver.php:110) in
> /etc/horde/passwd3/templates/common-header.inc on line 5
>
> It says the password change was successful ("Password changed on
> Example Expect Script."), but it really is not (still same password
> as it was prior).
>
> I don't see any output in the logs in /var/log, and AFAIK, there are
> no issues with the expect script (though I am no expert on this...).
>
> Any help is appreciated.
>
> Thank you.
>
>
>
> expect script (this is stock with debian):
> ==================================================================
> set host "localhost"
> set login "ssh"
> set program "passwd"
> set prompt_string "(%|\\\$|>)"
> set fingerprint_string "The authenticity of host.* can't be
> established.*\nRSA key fingerprint is.*\nAre you sure you want to
> continue connecting.*"
> set password_string "(P|p)assword.*"
> set oldpassword_string "((O|o)ld|login|\\\(current\\\) UNIX) (P|p)assword.*"
> set newpassword_string "(N|n)ew.* (P|p)assword.*"
> set badpassword_string "(passwd|Bad:).*\r"
> set verify_string "((R|r)e-*enter.*(P|p)assword|Retype new( UNIX)?
> password|(V|v)erification|(V|v)erify|(A|a)gain).*"
> set success_string "((P|p)assword.* changed|successfully)"
> set login_string "(((L|l)ogin|(U|u)sername).*)"
> set timeout 20
> set log "/tmp/passwd.out"
> set output false
> set output_file "/tmp/passwd.log"
>
>
> gets stdin user
> gets stdin password(old)
> gets stdin password(new)
>
>
>
> log_user 0
>
> for {set i 0} {$i<$argc} {incr i} {
> set arg [lindex $argv $i]
> switch -- $arg "-prompt" {
> incr i
> set prompt_string [lindex $argv $i]
> continue
> } "-password" {
> incr i
> set password_string [lindex $argv $i]
> continue
> } "-oldpassword" {
> incr i
> set oldpassword_string [lindex $argv $i]
> continue
> } "-newpassword" {
> incr i
> set newpassword_string [lindex $argv $i]
> continue
> } "-verify" {
> incr i
> set verify_string [lindex $argv $i]
> continue
> } "-success" {
> incr i
> set success_string [lindex $argv $i]
> continue
> } "-login" {
> incr i
> set login_string [lindex $argv $i]
> continue
> } "-host" {
> incr i
> set host [lindex $argv $i]
> continue
> } "-timeout" {
> incr i
> set timeout [lindex $argv $i]
> continue
> } "-log" {
> incr i
> set log [lindex $argv $i]
> continue
> } "-output" {
> incr i
> set output_file [lindex $argv $i]
> set output true
> continue
> } "-telnet" {
> set login "telnet"
> continue
> } "-ssh" {
> set login "ssh"
> continue
> } "-rlogin" {
> set login "rlogin"
> continue
> } "-slogin" {
> set login "slogin"
> continue
> } "-program" {
> incr i
> set program [lindex $argv $i]
> continue
> }
> }
>
> if {$output} {
> log_file $output_file
> }
>
> set err [open $log "w" "0600"]
>
> if {[string match $login "rlogin"]} {
> set pid [spawn rlogin $host -l $user]
> } elseif {[string match $login "slogin"]} {
> set pid [spawn slogin $host -l $user]
> } elseif {[string match $login "ssh"]} {
> set pid [spawn ssh $host -l $user]
> } elseif {[string match $login "telnet"]} {
> set pid [spawn telnet $host]
> expect -re $login_string {
> sleep .5
> send "$user\r"
> }
> } else {
> puts $err "Invalid login mode: valid modes: rlogin, slogin, ssh, telnet\n"
> close $err
> exit 1
> }
>
> expect {
> -re $fingerprint_string {sleep .5
> send yes\r}
> -re $password_string {sleep .5
> send $password(old)\r}
> timeout {puts $err "Could not login to system (no
> password prompt)\n"
> close $err
> exit 1}
> }
>
> set old_password_notentered true
> expect {
> -re $prompt_string {sleep .5
> send $program\r}
> # The following is for when passwd is the login shell
> -re $oldpassword_string {sleep .5
> send $password(old)\r
> set old_password_notentered false}
> timeout {puts $err "Could not login to system
> (bad old password?)\n"
> close $err
> exit 1}
> }
>
> if {$old_password_notentered} {
> expect {
> -re $oldpassword_string {sleep .5
> send $password(old)\r}
> timeout {puts $err "Could not start passwd
> program (no old password prompt)\n"
> close $err
> exit 1}
> }
> }
>
> expect {
> -re $newpassword_string {sleep .5
> send $password(new)\r}
> timeout {puts "Could not change password (bad old
> password?)\n"
> close $err
> exit 1}
> }
>
> expect {
> -re $badpassword_string {puts $err "$expect_out(0,string)"
> close $err
> send \003
> sleep .5
> exit 1}
> -re $verify_string {sleep .5
> send $password(new)\r}
> timeout {puts $err "New password not valid (too
> short, bad password, too similar, ...)\n"
> close $err
> send \003
> sleep .5
> exit 1}
> }
>
> expect {
> -re $success_string {sleep .5
> send exit\r}
> -re $badpassword_string {puts $err "$expect_out(0,string)"
> close $err
> exit 1}
> timeout {puts $err "Could not change password.\n"
> close $err
> exit 1}
> }
>
> expect {
> eof {close $err
> exit 0}
> }
> close $err
>
> ======================================================================
>
> --
> Sork mailing list - Join the hunt: http://horde.org/bounties/#sork
> Frequently Asked Questions: http://horde.org/faq/
> To unsubscribe, mail: sork-unsubscribe at lists.horde.org
>
Jan.
--
Do you need professional PHP or Horde consulting?
http://horde.org/consulting/
More information about the sork
mailing list