Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sbin/mount_portal set only the effective user id to the user...



details:   https://anonhg.NetBSD.org/src/rev/ecd330611752
branches:  trunk
changeset: 823832:ecd330611752
user:      christos <christos%NetBSD.org@localhost>
date:      Wed May 10 13:58:25 2017 +0000

description:
set only the effective user id to the user id of the requesting user so that
we can go back to the original uid later.

diffstat:

 sbin/mount_portal/pt_file.c |  10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diffs (32 lines):

diff -r 8c8c6e1825f6 -r ecd330611752 sbin/mount_portal/pt_file.c
--- a/sbin/mount_portal/pt_file.c       Wed May 10 12:12:21 2017 +0000
+++ b/sbin/mount_portal/pt_file.c       Wed May 10 13:58:25 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pt_file.c,v 1.18 2013/10/19 01:09:59 christos Exp $    */
+/*     $NetBSD: pt_file.c,v 1.19 2017/05/10 13:58:25 christos Exp $    */
 
 /*
  * Copyright (c) 1992, 1993
@@ -37,7 +37,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: pt_file.c,v 1.18 2013/10/19 01:09:59 christos Exp $");
+__RCSID("$NetBSD: pt_file.c,v 1.19 2017/05/10 13:58:25 christos Exp $");
 #endif /* not lint */
 
 #include <stdio.h>
@@ -84,10 +84,10 @@
                                pcr->pcr_gid);
                }
                /*
-                * ... and now do the setuid() where we lose all special
-                * powers (both real and effective userid).
+                * ... and now do the seteuid() where we temporarily give
+                * away our root privileges. 
                 */
-               if (setuid(pcr->pcr_uid) < 0) {
+               if (seteuid(pcr->pcr_uid) < 0) {
                        syslog(LOG_WARNING,
                                "lose_credentials: setuid(%d) failed (%m)",
                                pcr->pcr_uid);



Home | Main Index | Thread Index | Old Index