Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 7 Feb 2003 07:07:49 -0800 (PST)
From:      Dag-Erling Smorgrav <des@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 24780 for review
Message-ID:  <200302071507.h17F7n3k019484@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=24780

Change 24780 by des@des.at.des.thinksec.com on 2003/02/07 07:07:07

	If the saved effective uid is the same as the current effective uid,
	just destroy the saved credentials and return.

Affected files ...

.. //depot/projects/openpam/lib/openpam_restore_cred.c#4 edit

Differences ...

==== //depot/projects/openpam/lib/openpam_restore_cred.c#4 (text+ko) ====

@@ -31,7 +31,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $P4: //depot/projects/openpam/lib/openpam_restore_cred.c#3 $
+ * $P4: //depot/projects/openpam/lib/openpam_restore_cred.c#4 $
  */
 
 #include <sys/param.h>
@@ -62,10 +62,12 @@
 		RETURNC(r);
 	if (scred == NULL)
 		RETURNC(PAM_SYSTEM_ERR);
-	if (seteuid(scred->euid) == -1 ||
-	    setgroups(scred->ngroups, scred->groups) == -1 ||
-	    setegid(scred->egid) == -1)
-		RETURNC(PAM_SYSTEM_ERR);
+	if (scred->euid != geteuid()) {
+		if (seteuid(scred->euid) == -1 ||
+		    setgroups(scred->ngroups, scred->groups) == -1 ||
+		    setegid(scred->egid) == -1)
+			RETURNC(PAM_SYSTEM_ERR);
+	}
 	pam_set_data(pamh, PAM_SAVED_CRED, NULL, NULL);
 	RETURNC(PAM_SUCCESS);
 }

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe p4-projects" in the body of the message




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