[Tickets #1460] NEW: kpasswd expect driver

bugs at bugs.horde.org bugs at bugs.horde.org
Mon Feb 28 17:11:12 PST 2005


DO NOT REPLY TO THIS MESSAGE. THIS EMAIL ADDRESS IS NOT MONITORED.

Ticket URL: http://bugs.horde.org/ticket/?id=1460
-----------------------------------------------------------------------
 Ticket             | 1460
 Created By         | didopalauzov at aegee.org
 Summary            | kpasswd expect driver
 Queue              | Passwd
 Version            | 2.2.1
 State              | New
 Priority           | 1. Low
 Type               | Enhancement
 Owners             | 
-----------------------------------------------------------------------


didopalauzov at aegee.org (2005-02-28 17:11) wrote:

The following expect scribt enables the password change over krberos
kpasswd. Feel free to integrate it in the cvs.
*****************
#   #!/usr/bin/expect
#  Dilyan Palauzov, 2005
gets stdin user
gets stdin oldpw
gets stdin newpw
set log [lindex $argv 1]
set err [open $log "w" "0600"]
set pid [spawn /usr/bin/kpasswd $user]
set timeout 1
expect {
    "Password for *: "
    {
        send $oldpw\r
    }
    eof {
        puts $err $expect_out(buffer)
        close $err
        exit 1
    }
}

expect {
    "Enter new password: : "
    {
        send $newpw\r
    }
    eof {
        puts $err $expect_out(buffer)
        close $err
        exit 1
    }
}
expect {
    eof {exit 1}
    "Enter it again: : "
    {
        send $newpw\r
    }
}
expect {
    eof {
        puts $err $expect_out(buffer)
        close err
        exit 1
    }
    "Password changed."
    {
        close err
        exit 0
    }
}

close err
exit 0




More information about the bugs mailing list