Bug 175735

Summary: Pam configurations which produce multiple lines of ourput crash userpasswd
Product: Red Hat Enterprise Linux 4 Reporter: Todd <toddp>
Component: usermodeAssignee: Jindrich Novy <jnovy>
Status: CLOSED RAWHIDE QA Contact: David Lawrence <dkl>
Severity: medium Docs Contact:
Priority: medium    
Version: 4.0CC: pknirsch
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2006-01-03 14:43:46 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Todd 2005-12-14 13:27:02 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.12) Gecko/20050923 Fedora/1.0.7-1.EL (CK-IBM) Firefox/1.0.7

Description of problem:
When I set the pam system-auth to use the pam_passwdqc lib userpasswd crashes, due to the newlines produced from the pam lib.

password    requisite     /lib/security/$ISA/pam_passwdqc.so min=disabled,8,8,8,8 passphrase=0 enforce=users
password    sufficient    /lib/security/$ISA/pam_unix.so nullok use_authtok md5 shadow
password    required      /lib/security/$ISA/pam_deny.so

I see this issue up through the rawhide 1.84-1 usermode package.


Version-Release number of selected component (if applicable):
usermode-1.74-1 & usermode-1.84-1.i386.rpm

How reproducible:
Always

Steps to Reproduce:
1. Edit the /etc/pam.d/system-auth add these lines for password:

password    requisite     /lib/security/$ISA/pam_passwdqc.so min=disabled,8,8,8,8 passphrase=0 enforce=users
password    sufficient    /lib/security/$ISA/pam_unix.so nullok use_authtok md5 shadow
password    required      /lib/security/$ISA/pam_deny.so

2. As a normal non-root account attempt to run userpasswd
3. 
  

Actual Results:  [example@localhost ~]$ userpasswd
ERROR: unused data: `You can now choose the new password.

39 0
32
'.



Expected Results:  Gui should not produce output.

Additional info:

With the addition of this patch to the source:
--- usermode-1.74/userhelper-wrap.c.orig        2005-11-22 00:36:18.000000000 -0500
+++ usermode-1.74/userhelper-wrap.c     2005-11-22 00:36:38.000000000 -0500
@@ -431,7 +431,14 @@

                /* Snip off terminating newlines in the prompt string and save
                 * a pointer to interate the parser along. */
-               outline = strchr(prompt, '\n');
+                outline = strchr(prompt, '\n');
+                while (outline != NULL) {
+                    if ((outline[1] == NULL) || (isdigit(outline[1]))) {
+                        break;
+                    } else {
+                        outline = strchr(outline + 1, '\n');
+                    }
+                }
                if (outline != NULL) {
                        outline[0] = '\0';
                        outline++;


And these lines to the spec:
Patch: usermode-wrapper-newlines.patch
%patch -p1

Comment 1 Jindrich Novy 2005-12-15 09:50:09 UTC
Looks OK, just the outline[1] == NULL condition should be outline[1] == '\0' as
outline[1] is a char not a pointer. Needs to be tested.

Comment 2 Jindrich Novy 2006-01-03 10:45:47 UTC
Todd, thanks for the patch. Fix is confirmed and patch applied with correction
noted in comment #1. It will appear in 1.85.

Comment 3 Jindrich Novy 2006-01-03 14:43:46 UTC
usermode-1.85 is now built.