getpw*_r() may return 0 and set pwd==NULL
This commit is contained in:
parent
b9b92f846c
commit
a767f5ec9c
@ -32,7 +32,7 @@
|
|||||||
#if 0
|
#if 0
|
||||||
static char sccsid[] = "@(#)cuserid.c 8.1 (Berkeley) 6/4/93";
|
static char sccsid[] = "@(#)cuserid.c 8.1 (Berkeley) 6/4/93";
|
||||||
#else
|
#else
|
||||||
__RCSID("$NetBSD: cuserid.c,v 1.7 2005/04/01 12:51:07 christos Exp $");
|
__RCSID("$NetBSD: cuserid.c,v 1.8 2005/04/19 03:38:08 lukem Exp $");
|
||||||
#endif
|
#endif
|
||||||
#endif /* LIBC_SCCS and not lint */
|
#endif /* LIBC_SCCS and not lint */
|
||||||
|
|
||||||
@ -50,7 +50,8 @@ cuserid(char *s)
|
|||||||
|
|
||||||
/* s may be NULL */
|
/* s may be NULL */
|
||||||
|
|
||||||
if (getpwuid_r(geteuid(), &pwres, pwbuf, sizeof(pwbuf), &pw) != 0) {
|
if (getpwuid_r(geteuid(), &pwres, pwbuf, sizeof(pwbuf), &pw) != 0
|
||||||
|
|| pw == NULL) {
|
||||||
if (s != NULL)
|
if (s != NULL)
|
||||||
*s = '\0';
|
*s = '\0';
|
||||||
return s;
|
return s;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: pam_krb5.c,v 1.8 2005/04/19 03:15:35 christos Exp $ */
|
/* $NetBSD: pam_krb5.c,v 1.9 2005/04/19 03:38:47 lukem Exp $ */
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* This pam_krb5 module contains code that is:
|
* This pam_krb5 module contains code that is:
|
||||||
@ -53,7 +53,7 @@
|
|||||||
#ifdef __FreeBSD__
|
#ifdef __FreeBSD__
|
||||||
__FBSDID("$FreeBSD: src/lib/libpam/modules/pam_krb5/pam_krb5.c,v 1.22 2005/01/24 16:49:50 rwatson Exp $");
|
__FBSDID("$FreeBSD: src/lib/libpam/modules/pam_krb5/pam_krb5.c,v 1.22 2005/01/24 16:49:50 rwatson Exp $");
|
||||||
#else
|
#else
|
||||||
__RCSID("$NetBSD: pam_krb5.c,v 1.8 2005/04/19 03:15:35 christos Exp $");
|
__RCSID("$NetBSD: pam_krb5.c,v 1.9 2005/04/19 03:38:47 lukem Exp $");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
@ -414,7 +414,8 @@ pam_sm_setcred(pam_handle_t *pamh, int flags,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Get the uid. This should exist. */
|
/* Get the uid. This should exist. */
|
||||||
if (getpwnam_r(user, &pwres, pwbuf, sizeof(pwbuf), &pwd) != 0) {
|
if (getpwnam_r(user, &pwres, pwbuf, sizeof(pwbuf), &pwd) != 0 ||
|
||||||
|
pwd == NULL) {
|
||||||
retval = PAM_USER_UNKNOWN;
|
retval = PAM_USER_UNKNOWN;
|
||||||
goto cleanup3;
|
goto cleanup3;
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: options.c,v 1.12 2005/04/10 08:05:40 christos Exp $ */
|
/* $NetBSD: options.c,v 1.13 2005/04/19 03:38:19 lukem Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* General skeleton for adding options to the access control language. The
|
* General skeleton for adding options to the access control language. The
|
||||||
@ -35,7 +35,7 @@
|
|||||||
#if 0
|
#if 0
|
||||||
static char sccsid[] = "@(#) options.c 1.17 96/02/11 17:01:31";
|
static char sccsid[] = "@(#) options.c 1.17 96/02/11 17:01:31";
|
||||||
#else
|
#else
|
||||||
__RCSID("$NetBSD: options.c,v 1.12 2005/04/10 08:05:40 christos Exp $");
|
__RCSID("$NetBSD: options.c,v 1.13 2005/04/19 03:38:19 lukem Exp $");
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -298,7 +298,7 @@ struct request_info *request;
|
|||||||
|
|
||||||
if ((group = split_at(value, '.')) != 0)
|
if ((group = split_at(value, '.')) != 0)
|
||||||
group_option(group, request);
|
group_option(group, request);
|
||||||
if (getpwnam_r(value, &pws, pwbuf, sizeof(pwbuf), &pwd) != 0)
|
if (getpwnam_r(value, &pws, pwbuf, sizeof(pwbuf), &pwd) != 0 || pwd == NULL)
|
||||||
tcpd_jump("unknown user: \"%s\"", value);
|
tcpd_jump("unknown user: \"%s\"", value);
|
||||||
endpwent();
|
endpwent();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user