Bug 20909

Summary: The test for the echo_pass option is backwards.
Product: Base System Reporter: mkiernan <mkiernan>
Component: binAssignee: Kris Kennaway <kris>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: 4.1-STABLE   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
file.diff none

Description mkiernan 2000-08-29 00:20:01 UTC
	

	The echo_pass PAM option, if present, is supposed to enable
	the echoing of passwords when the user types them in.  The
	test for this option in the pam_opie module is backwards.  That
	is it echos passwords when the option is not present in the PAM
	configuration file and fails to echo passwords when the option
	is present.

How-To-Repeat: 
	

	1.  Make sure your account is setup to use Opie (i.e. you've used
	    opiegen);
	2.  enable the pam_opie module in your PAM configuration file for the
	    login service;
	3.  add/subtract the "echo_pass" option from the pam_module's
		configuration line in the PAM configuration file;
	3.  type your login name at the "login:" prompt;
	4.  type <return> at the "Password:" prompt;
	5.  you will get a "Password [echo on]:" prompt if the echo_pass
	    option is not on, but you won't get it if the echo_pass option
	    is turned on;
	6.  go back to step 3 and try it the other way around.
Comment 1 Sheldon Hearn freebsd_committer freebsd_triage 2000-08-29 09:57:31 UTC
Responsible Changed
From-To: freebsd-bugs->kris

Kris, you committed Jim's pam_opie.c.  The patch seems to 
make sense.  Could you take a look or coordinate with Jim?
Comment 2 mkiernan 2000-08-29 19:06:23 UTC
My apologies for not drinking more coffee before submitting my report, but
the patch I sent is wrong.  I didn't describe the exact nature of the
problem--please let me clarify...

The pam_opie module doesn't handle the echo_pass PAM option properly.  The 
module always allows password echoing at the second prompt if the user types
<return> at the first prompt.  If you add "echo_pass" as an option for the
module in /etc/pam.conf, it will echo the password at both prompts.  Correct 
me if I'm wrong, but my understanding is that under normal conditions
password echo is supposed to be off unless the "echo_pass" option is 
specified.

The new patch (included below) implements the following behavior:  the
first prompt never echos the password, but if the user types <return> and
"echo_pass" is set in pam.conf, a second prompt will be displayed that
echos the password.

Thanks,

Mike


Index: pam_opie.c
===================================================================
RCS file: /sbox/freebsd/cvs/root/src/lib/libpam/modules/pam_opie/pam_opie.c,v
retrieving revision 1.1
diff -u -r1.1 pam_opie.c
--- pam_opie.c	2000/04/17 00:14:42	1.1
+++ pam_opie.c	2000/08/29 18:01:29
@@ -74,13 +74,12 @@
 	if (opiechallenge(&opie, (char *)user, challenge) != 0)
 		return PAM_AUTH_ERR;
 	snprintf(prompt, sizeof prompt, "%s\nPassword: ", challenge);
-	if ((retval = pam_get_pass(pamh, &response, prompt, options)) !=
-	    PAM_SUCCESS) {
+	if ((retval = pam_get_pass(pamh, &response, prompt,
+	    (options & ~PAM_OPT_ECHO_PASS))) != PAM_SUCCESS) {
 		opieunlock();
 		return retval;
 	}
-	if (response[0] == '\0' && !(options & PAM_OPT_ECHO_PASS)) {
-		options |= PAM_OPT_ECHO_PASS;
+	if (response[0] == '\0' && (options & PAM_OPT_ECHO_PASS)) {
 		snprintf(prompt, sizeof prompt,
 			 "%s\nPassword [echo on]: ", challenge);
 		if ((retval = pam_get_pass(pamh, &response, prompt,
Comment 3 Kris Kennaway freebsd_committer freebsd_triage 2000-09-02 03:00:31 UTC
On Tue, 29 Aug 2000, Michael Kiernan wrote:

>  The pam_opie module doesn't handle the echo_pass PAM option properly.  The 
>  module always allows password echoing at the second prompt if the user types
>  <return> at the first prompt.  If you add "echo_pass" as an option for the
>  module in /etc/pam.conf, it will echo the password at both prompts.  Correct 
>  me if I'm wrong, but my understanding is that under normal conditions
>  password echo is supposed to be off unless the "echo_pass" option is 
>  specified.

I think this is valid behaviour: it accords with the behaviour of other
OTP utilities. The reason it echos on the second attempt is because
(depending on how it's set up) you can either log in with a unix password,
or a one time password (that is echoed back to you so you can confirm the
passphrase) by just pressing enter the first time. echo_pass is intended
for when you want it to always echo the passphrase because the utility
doesnt use non-OTP authentication.

Kris

--
In God we Trust -- all others must submit an X.509 certificate.
    -- Charles Forsythe <forsythe@alum.mit.edu>
Comment 4 mkiernan 2000-09-05 20:01:33 UTC
Hello Kris,

You wrote:
> I think this is valid behaviour: it accords with the behaviour of other
> OTP utilities. The reason it echos on the second attempt is because
> (depending on how it's set up) you can either log in with a unix password,
> or a one time password (that is echoed back to you so you can confirm the
> passphrase) by just pressing enter the first time. echo_pass is intended
> for when you want it to always echo the passphrase because the utility
> doesnt use non-OTP authentication.

I had assumed that the echo_pass option was meant to alter the behavior from 
echoing turned completely off to echoing turned on only for the second prompt. 
Thank you for clarifying this.

Mike
Comment 5 bloom 2000-09-06 02:05:25 UTC
I agree with Kris that the behaviour is as designed.  It should agree with
pam_skey (one of the other OTP utilities) upon which this module was based.

Kris, it sounds like Michael accepts the explanation (according to his
subsequent e-mail) and this PR can be closed.

Jim Bloom
bloom@acm.org


Kris Kennaway wrote:
> 
> On Tue, 29 Aug 2000, Michael Kiernan wrote:
> 
> >  The pam_opie module doesn't handle the echo_pass PAM option properly.  The
> >  module always allows password echoing at the second prompt if the user types
> >  <return> at the first prompt.  If you add "echo_pass" as an option for the
> >  module in /etc/pam.conf, it will echo the password at both prompts.  Correct
> >  me if I'm wrong, but my understanding is that under normal conditions
> >  password echo is supposed to be off unless the "echo_pass" option is
> >  specified.
> 
> I think this is valid behaviour: it accords with the behaviour of other
> OTP utilities. The reason it echos on the second attempt is because
> (depending on how it's set up) you can either log in with a unix password,
> or a one time password (that is echoed back to you so you can confirm the
> passphrase) by just pressing enter the first time. echo_pass is intended
> for when you want it to always echo the passphrase because the utility
> doesnt use non-OTP authentication.
Comment 6 Kris Kennaway freebsd_committer freebsd_triage 2000-09-17 06:48:43 UTC
State Changed
From-To: open->closed

The submission has been analyzed and determined to be correct 
behaviour.