Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/login use getgrnam_r; from Jon Nemeth



details:   https://anonhg.NetBSD.org/src/rev/07ac2166cc1c
branches:  trunk
changeset: 584498:07ac2166cc1c
user:      christos <christos%NetBSD.org@localhost>
date:      Wed Sep 21 12:24:11 2005 +0000

description:
use getgrnam_r; from Jon Nemeth

diffstat:

 usr.bin/login/login_pam.c |  10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diffs (39 lines):

diff -r 14f0e103ec21 -r 07ac2166cc1c usr.bin/login/login_pam.c
--- a/usr.bin/login/login_pam.c Wed Sep 21 10:21:46 2005 +0000
+++ b/usr.bin/login/login_pam.c Wed Sep 21 12:24:11 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: login_pam.c,v 1.8 2005/04/25 01:34:38 matt Exp $       */
+/*     $NetBSD: login_pam.c,v 1.9 2005/09/21 12:24:11 christos Exp $       */
 
 /*-
  * Copyright (c) 1980, 1987, 1988, 1991, 1993, 1994
@@ -40,7 +40,7 @@
 #if 0
 static char sccsid[] = "@(#)login.c    8.4 (Berkeley) 4/2/94";
 #endif
-__RCSID("$NetBSD: login_pam.c,v 1.8 2005/04/25 01:34:38 matt Exp $");
+__RCSID("$NetBSD: login_pam.c,v 1.9 2005/09/21 12:24:11 christos Exp $");
 #endif /* not lint */
 
 /*
@@ -108,7 +108,8 @@
 
 struct passwd *pwd, pwres;
 char   pwbuf[1024];
-struct group *gr;
+struct group grs, *grp;
+char   grbuf[1024];
 int    failures, have_ss;
 char   term[64], *envinit[1], *hostname, *username, *tty, *nested;
 struct timeval now;
@@ -476,8 +477,9 @@
        setgroups(nsaved_gids, saved_gids);
        seteuid(saved_uid);
 
+       (void)getgrnam_r(TTYGRPNAME, &grs, grbuf, sizeof(grbuf), &grp);
        (void)chown(ttyn, pwd->pw_uid,
-           (gr = getgrnam(TTYGRPNAME)) ? gr->gr_gid : pwd->pw_gid);
+           (grp != NULL) ? grp->gr_gid : pwd->pw_gid);
 
        if (ttyaction(ttyn, "login", pwd->pw_name))
                (void)printf("Warning: ttyaction failed.\n");



Home | Main Index | Thread Index | Old Index