fix getpw*_r calls, they return 0 even when the entry isn't found and

instead make it with setting return pointer to NULL.
From Luke Mewburn <lukem@NetBSD.org>


git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@14838 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Love Hörnquist Åstrand
2005-04-19 04:41:07 +00:00
parent 5dc1001c37
commit 1caed238c5

View File

@@ -125,7 +125,7 @@ doauth(SIAENTITY *entity, int pkgind, char *name)
int secure;
#endif
if(getpwnam_r(name, &pw, pwbuf, sizeof(pwbuf), &pwd) != 0){
if(getpwnam_r(name, &pw, pwbuf, sizeof(pwbuf), &pwd) != 0 || pwd == NULL){
SIA_DEBUG(("DEBUG", "failed to getpwnam(%s)", name));
return SIADFAIL;
}
@@ -162,7 +162,7 @@ doauth(SIAENTITY *entity, int pkgind, char *name)
#else
ouid = getuid();
#endif
if(getpwuid_r(ouid, &fpw, fpwbuf, sizeof(fpwbuf), &fpwd) != 0){
if(getpwuid_r(ouid, &fpw, fpwbuf, sizeof(fpwbuf), &fpwd) != 0 || fpwd == NULL){
SIA_DEBUG(("DEBUG", "failed to getpwuid(%u)", ouid));
return SIADFAIL;
}