J. Goodleaf writes: 

> I assume you mean the authsystem.passwd file?

That's the one. 

> 
> I don't know a thing about expect... Before I go into this, have any of you out 
>there solved this problem for FreeBSD 4.4. I'm not sure how this stuff works, but it 
>seems that FreeBSD's passwd program behaves differently when root invokes it than 
>when a user invokes it. When root uses it, passwd seems to expect a user as an 
>argument, and it doesn't prompt for an old password. For users, passwd does expect an 
>old password. (Makes sense...) How does sqwebmail invoke it?

passwd will be invoked by as the userid. 

Even if you don't know anything about expect, you can pretty much figure it 
out.  It's real easy.  It waits for passwd to print something it recognizes, 
then it sends a response to that.  So, you need to look at the prompts from 
your passwd, and adjust the script accordingly.  For example: 

spawn "/usr/bin/passwd" 

expect {
       -re "word:" { sleep 2; send "$oldpass\n" }
       eof { exit 1 }
       timeout { exit 1 }
} 

So the first thing expect does is wait for the string "word:" after starting 
passwd, which should pick up the "Old password:" prompt from passwd.  The 
rest of the dialogue is similar. 

-- 
Sam 

Reply via email to