use get*_r()

This commit is contained in:
christos 2005-09-24 14:40:59 +00:00
parent 54a773e9d7
commit 2192079ea8
2 changed files with 21 additions and 12 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: cfparse.y,v 1.4 2005/08/20 00:57:06 manu Exp $ */
/* $NetBSD: cfparse.y,v 1.5 2005/09/24 14:40:59 christos Exp $ */
/* Id: cfparse.y,v 1.37.2.4 2005/05/10 09:45:45 manubsd Exp */
@ -280,9 +280,11 @@ privsep_stmts
privsep_stmt
: USER QUOTEDSTRING
{
struct passwd *pw;
struct passwd *pw, pwres;
char buf[1024];
if ((pw = getpwnam($2->v)) == NULL) {
(void)getpwnam_r($2->v, &pwres, buf, sizeof(buf), &pw);
if (pw == NULL) {
yyerror("unkown user \"%s\"", $2->v);
return -1;
}
@ -292,9 +294,11 @@ privsep_stmt
| USER NUMBER { lcconf->uid = $2; } EOS
| GROUP QUOTEDSTRING
{
struct group *gr;
struct group *gr, grres;
char buf[1024]
if ((gr = getgrnam($2->v)) == NULL) {
(void)getgrnam_r($2->v, &grres, buf, sizeof(buf), &gr);
if (gr == NULL) {
yyerror("unkown group \"%s\"", $2->v);
return -1;
}
@ -1983,12 +1987,13 @@ adminsock_conf(path, owner, group, mode_dec)
vchar_t *group;
int mode_dec;
{
struct passwd *pw = NULL;
struct group *gr = NULL;
struct passwd *pw = NULL, pwres;
struct group *gr = NULL, grres;
mode_t mode = 0;
uid_t uid;
gid_t gid;
int isnum;
char buf[1024];
adminsock_path = path->v;
@ -1998,7 +2003,8 @@ adminsock_conf(path, owner, group, mode_dec)
errno = 0;
uid = atoi(owner->v);
isnum = !errno;
if (((pw = getpwnam(owner->v)) == NULL) && !isnum)
(void)getpwnam_r(owner->v, &pwres, buf, sizeof(buf), &pw);
if ((pw == NULL) && !isnum)
yyerror("User \"%s\" does not exist", owner->v);
if (pw)
@ -2012,7 +2018,8 @@ adminsock_conf(path, owner, group, mode_dec)
errno = 0;
gid = atoi(group->v);
isnum = !errno;
if (((gr = getgrnam(group->v)) == NULL) && !isnum)
(void)getgrnam_r(group->v, &grres, buf, sizeof(buf), &gr);
if ((gr == NULL) && !isnum)
yyerror("Group \"%s\" does not exist", group->v);
if (gr)

View File

@ -1,4 +1,4 @@
/* $NetBSD: isakmp_xauth.c,v 1.4 2005/08/20 00:57:06 manu Exp $ */
/* $NetBSD: isakmp_xauth.c,v 1.5 2005/09/24 14:40:59 christos Exp $ */
/* Id: isakmp_xauth.c,v 1.17.2.5 2005/05/20 07:31:09 manubsd Exp */
@ -690,9 +690,10 @@ xauth_login_system(usr, pwd)
char *usr;
char *pwd;
{
struct passwd *pw;
struct passwd *pw, pwres;
char *cryptpwd;
char *syscryptpwd;
char buf;
#ifdef HAVE_SHADOW_H
struct spwd *spw;
@ -702,7 +703,8 @@ xauth_login_system(usr, pwd)
syscryptpwd = spw->sp_pwdp;
#endif
if ((pw = getpwnam(usr)) == NULL)
(void)getpwnam_r(usr, &pwres, buf, sizeof(buf), &pw);
if (pw == NULL)
return -1;
#ifndef HAVE_SHADOW_H