Bug 6641 - Password with Double Quote (") do not pass into passwd chat
Password with Double Quote (") do not pass into passwd chat
Status: NEW
Product: Samba 4.1 and newer
Classification: Unclassified
Component: Other
unspecified
All All
: P3 major
: ---
Assigned To: Jeremy Allison
Samba QA Contact
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2009-08-16 23:04 UTC by Sky Lau
Modified: 2018-04-10 17:02 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sky Lau 2009-08-16 23:04:03 UTC
I have set the following in [global], for changing kerberos password

passwd program = /usr/local/sbin/change-kerberos-password.sh %u
passwd chat = "*Password:*" %n\n *Done*

change-kerberos-password.sh

#!/bin/bash
THEUSER=$1
echo -n "Password: "
stty -echo
read THEPASS
stty echo
echo
TEST_USER_EXISTS=`/usr/kerberos/sbin/kadmin.local -q "getprinc $THEUSER" 2> /dev/null | grep ^Principal | wc -l`
if [ $TEST_USER_EXISTS -eq 1 ] ; then
  /usr/kerberos/sbin/kadmin.local -q "cpw -pw \"$THEPASS1\" $THEUSER" > /dev/null 2>&1
fi
echo Done
exit 0

The Problem: THEPASS will never get a " when I change the password 
either I attempt change the password in Windows Ctrl+Alt+Del or using smbpasswd -r

Outcome: The Samba will have updated with password but the Kerberos will have the password with " omitted
Comment 1 Björn Jacke 2018-03-28 20:14:05 UTC
still valid for 4.8 and master
Comment 2 Björn Jacke 2018-04-10 17:02:00 UTC
simple reproducer to show the missing doublequote:

passwd program = /usr/local/bin/pwd-dump.pl %u
passwd chat = "*Password:*" %n\n *Done*

with pwd-dump.pl as simple as this:

#!/usr/bin/perl
open(OUTFILE, ">", "/tmp/pwdump");
print "Password:";
for (@ARGV) {
        print OUTFILE "$_\n";
}
my $pw = <STDIN>;
print OUTFILE "$pw\n";
print "Done";

I don't see where it gets lost though. Jeremy, do you have any idea on this?