Bug 6641 - Password with Double Quote (") do not pass into passwd chat
Summary: Password with Double Quote (") do not pass into passwd chat
Status: NEW
Alias: None
Product: Samba 4.1 and newer
Classification: Unclassified
Component: Other (show other bugs)
Version: unspecified
Hardware: All All
: P3 major (vote)
Target Milestone: ---
Assignee: Jeremy Allison
QA Contact: Samba QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-08-16 23:04 UTC by Sky Lau
Modified: 2022-12-09 13:22 UTC (History)
1 user (show)

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?