-----Original Message-----
From: Stanislav Brabec <sbrabec@suse.cz>
To: bagleyd <bagleyd@verizon.net>
Sent: Wed, Jul 26, 2017 10:57 am
Subject: xlock problems with PAM

Hi.

I fould a problem with your implementation of PAM support. It does not work for
non-English locales, as it hardcodes expectation of "Password" string.

This is more a hack than a correct fix.

Instead of hardcoded expecting of "Password" prompt as a first PAM query, just
expect that it asks for password (xlock hardcodes "Password" as a first query in
the GUI).

It will unbreak xlock with non-English locales, but it will still swallow the
first prompt from PAM. In most cases, it is just translated "Password" string,
but in some cases it can be a different question.

To fully fix the problem, GUI needs to be redone a bit. Instead of hardcoded
"Password" prompt in the initial phase of authentication, get all prompts from
PAM. I currently don't have sufficient insight into your code.

Index: xlockmore-5.53/xlock/passwd.c
===================================================================
--- xlockmore-5.53.orig/xlock/passwd.c
+++ xlockmore-5.53/xlock/passwd.c
@@ -335,29 +335,19 @@ PAM_conv(int num_msg,
#ifdef DEBUG
(void) printf( " + Message style: PAM_PROMPT_ECHO_OFF\n" );
#endif
-	if( strstr( msg[replies]->msg, "Password" ) == NULL ) {
-	PAM_putText( msg[replies], &reply[replies], False );
-	} else {
-	reply[replies].resp = COPY_STRING(PAM_password);
-	}
+	reply[replies].resp = COPY_STRING(PAM_password);
/* PAM frees resp */
break;
case PAM_TEXT_INFO:
#ifdef DEBUG
(void) printf( " + Message style: PAM_TEXT_INFO\n" );
#endif
-	if( strstr( msg[replies]->msg, "Password" ) == NULL ) {
-	PAM_putText( msg[replies], &reply[replies], False );
-	}
/* PAM frees resp */
break;
case PAM_ERROR_MSG:
#ifdef DEBUG
(void) printf( " + Message style: PAM_ERROR_MSG\n" );
#endif
-	if( strstr( msg[replies]->msg, "Password" ) == NULL ) {
-	PAM_putText( msg[replies], &reply[replies], False );
-	}
/* PAM frees resp */
break;
default:


-- 
Best Regards / S pozdravem,

Stanislav Brabec
software developer
---------------------------------------------------------------------
SUSE LINUX, s. r. o. e-mail: sbrabec@suse.com
Křižíkova 148/34 (Corso IIa) tel: +49 911 7405384547
186 00 Praha 8-Karlín fax: +420 284 084 001
Czech Republic http://www.suse.cz/
PGP: 830B 40D5 9E05 35D8 5E27 6FA3 717C 209F A04F CD76
