Don't conflate enum nss_status return values values with int (NS_SUCCESS,

NS_RETURN) values.

Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D6046
This commit is contained in:
Brooks Davis 2016-08-16 11:38:45 +00:00
parent 1c1cc89580
commit 3bb0c17d3e

View File

@ -97,9 +97,9 @@ __nss_compat_getgrnam_r(void *retval, void *mdata, va_list ap)
const char *name;
struct group *grp;
char *buffer;
int *errnop;
int *errnop, ns_status;
size_t bufsize;
enum nss_status status;
enum nss_status nss_status;
fn = mdata;
name = va_arg(ap, const char *);
@ -107,11 +107,11 @@ __nss_compat_getgrnam_r(void *retval, void *mdata, va_list ap)
buffer = va_arg(ap, char *);
bufsize = va_arg(ap, size_t);
errnop = va_arg(ap, int *);
status = fn(name, grp, buffer, bufsize, errnop);
status = __nss_compat_result(status, *errnop);
if (status == NS_SUCCESS)
nss_status = fn(name, grp, buffer, bufsize, errnop);
ns_status = __nss_compat_result(nss_status, *errnop);
if (ns_status == NS_SUCCESS)
*(struct group **)retval = grp;
return (status);
return (ns_status);
}
@ -122,9 +122,9 @@ __nss_compat_getgrgid_r(void *retval, void *mdata, va_list ap)
gid_t gid;
struct group *grp;
char *buffer;
int *errnop;
int *errnop, ns_status;
size_t bufsize;
enum nss_status status;
enum nss_status nss_status;
fn = mdata;
gid = va_arg(ap, gid_t);
@ -132,11 +132,11 @@ __nss_compat_getgrgid_r(void *retval, void *mdata, va_list ap)
buffer = va_arg(ap, char *);
bufsize = va_arg(ap, size_t);
errnop = va_arg(ap, int *);
status = fn(gid, grp, buffer, bufsize, errnop);
status = __nss_compat_result(status, *errnop);
if (status == NS_SUCCESS)
nss_status = fn(gid, grp, buffer, bufsize, errnop);
ns_status = __nss_compat_result(nss_status, *errnop);
if (ns_status == NS_SUCCESS)
*(struct group **)retval = grp;
return (status);
return (ns_status);
}
@ -146,9 +146,9 @@ __nss_compat_getgrent_r(void *retval, void *mdata, va_list ap)
int (*fn)(struct group *, char *, size_t, int *);
struct group *grp;
char *buffer;
int *errnop;
int *errnop, ns_status;
size_t bufsize;
enum nss_status status;
enum nss_status nss_status;
if (CHECK_TERMINATOR(group))
return (NS_NOTFOUND);
@ -157,13 +157,13 @@ __nss_compat_getgrent_r(void *retval, void *mdata, va_list ap)
buffer = va_arg(ap, char *);
bufsize = va_arg(ap, size_t);
errnop = va_arg(ap, int *);
status = fn(grp, buffer, bufsize, errnop);
status = __nss_compat_result(status, *errnop);
if (status == NS_SUCCESS)
nss_status = fn(grp, buffer, bufsize, errnop);
ns_status = __nss_compat_result(nss_status, *errnop);
if (ns_status == NS_SUCCESS)
*(struct group **)retval = grp;
else if (status != NS_RETURN)
else if (ns_status != NS_RETURN)
SET_TERMINATOR(group, &terminator);
return (status);
return (ns_status);
}
@ -198,9 +198,9 @@ __nss_compat_getpwnam_r(void *retval, void *mdata, va_list ap)
const char *name;
struct passwd *pwd;
char *buffer;
int *errnop;
int *errnop, ns_status;
size_t bufsize;
enum nss_status status;
enum nss_status nss_status;
fn = mdata;
name = va_arg(ap, const char *);
@ -208,11 +208,11 @@ __nss_compat_getpwnam_r(void *retval, void *mdata, va_list ap)
buffer = va_arg(ap, char *);
bufsize = va_arg(ap, size_t);
errnop = va_arg(ap, int *);
status = fn(name, pwd, buffer, bufsize, errnop);
status = __nss_compat_result(status, *errnop);
if (status == NS_SUCCESS)
nss_status = fn(name, pwd, buffer, bufsize, errnop);
ns_status = __nss_compat_result(nss_status, *errnop);
if (ns_status == NS_SUCCESS)
*(struct passwd **)retval = pwd;
return (status);
return (ns_status);
}
@ -223,9 +223,9 @@ __nss_compat_getpwuid_r(void *retval, void *mdata, va_list ap)
uid_t uid;
struct passwd *pwd;
char *buffer;
int *errnop;
int *errnop, ns_status;
size_t bufsize;
enum nss_status status;
enum nss_status nss_status;
fn = mdata;
uid = va_arg(ap, uid_t);
@ -233,11 +233,11 @@ __nss_compat_getpwuid_r(void *retval, void *mdata, va_list ap)
buffer = va_arg(ap, char *);
bufsize = va_arg(ap, size_t);
errnop = va_arg(ap, int *);
status = fn(uid, pwd, buffer, bufsize, errnop);
status = __nss_compat_result(status, *errnop);
if (status == NS_SUCCESS)
nss_status = fn(uid, pwd, buffer, bufsize, errnop);
ns_status = __nss_compat_result(nss_status, *errnop);
if (ns_status == NS_SUCCESS)
*(struct passwd **)retval = pwd;
return (status);
return (ns_status);
}
@ -247,9 +247,9 @@ __nss_compat_getpwent_r(void *retval, void *mdata, va_list ap)
int (*fn)(struct passwd *, char *, size_t, int *);
struct passwd *pwd;
char *buffer;
int *errnop;
int *errnop, ns_status;
size_t bufsize;
enum nss_status status;
enum nss_status nss_status;
if (CHECK_TERMINATOR(passwd))
return (NS_NOTFOUND);
@ -258,13 +258,13 @@ __nss_compat_getpwent_r(void *retval, void *mdata, va_list ap)
buffer = va_arg(ap, char *);
bufsize = va_arg(ap, size_t);
errnop = va_arg(ap, int *);
status = fn(pwd, buffer, bufsize, errnop);
status = __nss_compat_result(status, *errnop);
if (status == NS_SUCCESS)
nss_status = fn(pwd, buffer, bufsize, errnop);
ns_status = __nss_compat_result(nss_status, *errnop);
if (ns_status == NS_SUCCESS)
*(struct passwd **)retval = pwd;
else if (status != NS_RETURN)
else if (ns_status != NS_RETURN)
SET_TERMINATOR(passwd, &terminator);
return (status);
return (ns_status);
}