Skip site navigation (1)Skip section navigation (2)
Date:      26 Apr 2002 21:30:30 +0200
From:      Dag-Erling Smorgrav <des@ofug.org>
To:        bsd <bsd@client.paymentonline.com>
Cc:        current@FreeBSD.ORG
Subject:   Re: passwd and PAM
Message-ID:  <xzpvgae2r6x.fsf@flood.ping.uio.no>
In-Reply-To: <20020426120515.P67902-100000@client.paymentonline.com>
References:  <20020426120515.P67902-100000@client.paymentonline.com>

index | next in thread | previous in thread | raw e-mail

[-- Attachment #1 --]
You're welcome.  The attached patch should fix the problem with passwd
asking root for the old password.

DES
-- 
Dag-Erling Smorgrav - des@ofug.org


[-- Attachment #2 --]
==== //depot/user/des/pam/lib/libpam/modules/pam_unix/pam_unix.c#14 - /usr/src/lib/libpam/modules/pam_unix/pam_unix.c ====
--- /tmp/tmp.2741.0	Fri Apr 26 21:28:02 2002
+++ /usr/src/lib/libpam/modules/pam_unix/pam_unix.c	Fri Apr 26 21:24:35 2002
@@ -313,6 +313,11 @@
 
 		PAM_LOG("PRELIM round");
 
+		if (getuid() == 0 &&
+		    (pwd->pw_fields & _PWF_SOURCE) == _PWF_FILES)
+			/* root doesn't need the old password */
+			return (pam_set_item(pamh, PAM_OLDAUTHTOK, ""));
+
 		if (pwd->pw_passwd[0] == '\0'
 		    && pam_test_option(&options, PAM_OPT_NULLOK, NULL)) {
 			/*
@@ -338,7 +343,7 @@
 		PAM_LOG("UPDATE round");
 
 		retval = pam_get_authtok(pamh,
-		    PAM_AUTHTOK, &old_pass, NULL);
+		    PAM_OLDAUTHTOK, &old_pass, NULL);
 		if (retval != PAM_SUCCESS)
 			return (retval);
 		PAM_LOG("Got old password");
help

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?xzpvgae2r6x.fsf>