#include <kernel-features.h>
static service_user *ni;
-static enum nss_status (*nss_setgrent) (int stayopen);
-static enum nss_status (*nss_getgrnam_r) (const char *name,
- struct group * grp, char *buffer,
- size_t buflen, int *errnop);
-static enum nss_status (*nss_getgrgid_r) (gid_t gid, struct group * grp,
- char *buffer, size_t buflen,
- int *errnop);
-static enum nss_status (*nss_getgrent_r) (struct group * grp, char *buffer,
- size_t buflen, int *errnop);
-static enum nss_status (*nss_endgrent) (void);
+static enum nss_status (*setgrent_impl) (int stayopen);
+static enum nss_status (*getgrnam_r_impl) (const char *name,
+ struct group * grp, char *buffer,
+ size_t buflen, int *errnop);
+static enum nss_status (*getgrgid_r_impl) (gid_t gid, struct group * grp,
+ char *buffer, size_t buflen,
+ int *errnop);
+static enum nss_status (*getgrent_r_impl) (struct group * grp, char *buffer,
+ size_t buflen, int *errnop);
+static enum nss_status (*endgrent_impl) (void);
/* Get the declaration of the parser function. */
#define ENTNAME grent
{
if (__nss_database_lookup2 ("group_compat", NULL, "nis", &ni) >= 0)
{
- nss_setgrent = __nss_lookup_function (ni, "setgrent");
- nss_getgrnam_r = __nss_lookup_function (ni, "getgrnam_r");
- nss_getgrgid_r = __nss_lookup_function (ni, "getgrgid_r");
- nss_getgrent_r = __nss_lookup_function (ni, "getgrent_r");
- nss_endgrent = __nss_lookup_function (ni, "endgrent");
+ setgrent_impl = __nss_lookup_function (ni, "setgrent");
+ getgrnam_r_impl = __nss_lookup_function (ni, "getgrnam_r");
+ getgrgid_r_impl = __nss_lookup_function (ni, "getgrgid_r");
+ getgrent_r_impl = __nss_lookup_function (ni, "getgrent_r");
+ endgrent_impl = __nss_lookup_function (ni, "endgrent");
}
}
else
rewind (ent->stream);
- if (needent && status == NSS_STATUS_SUCCESS && nss_setgrent)
- ent->setent_status = nss_setgrent (stayopen);
+ if (needent && status == NSS_STATUS_SUCCESS && setgrent_impl)
+ ent->setent_status = setgrent_impl (stayopen);
return status;
}
__libc_lock_lock (lock);
- if (nss_endgrent)
- nss_endgrent ();
+ if (endgrent_impl)
+ endgrent_impl ();
result = internal_endgrent (&ext_ent);
getgrent_next_nss (struct group *result, ent_t *ent, char *buffer,
size_t buflen, int *errnop)
{
- if (!nss_getgrent_r)
+ if (!getgrent_r_impl)
return NSS_STATUS_UNAVAIL;
/* If the setgrent call failed, say so. */
{
enum nss_status status;
- if ((status = nss_getgrent_r (result, buffer, buflen, errnop))
+ if ((status = getgrent_r_impl (result, buffer, buflen, errnop))
!= NSS_STATUS_SUCCESS)
return status;
}
getgrnam_plusgroup (const char *name, struct group *result, ent_t *ent,
char *buffer, size_t buflen, int *errnop)
{
- if (!nss_getgrnam_r)
+ if (!getgrnam_r_impl)
return NSS_STATUS_UNAVAIL;
- enum nss_status status = nss_getgrnam_r (name, result, buffer, buflen,
- errnop);
+ enum nss_status status = getgrnam_r_impl (name, result, buffer, buflen,
+ errnop);
if (status != NSS_STATUS_SUCCESS)
return status;
/* +:... */
if (result->gr_name[0] == '+' && result->gr_name[1] == '\0')
{
- if (!nss_getgrgid_r)
+ if (!getgrgid_r_impl)
return NSS_STATUS_UNAVAIL;
- enum nss_status status = nss_getgrgid_r (gid, result, buffer, buflen,
- errnop);
+ enum nss_status status = getgrgid_r_impl (gid, result,
+ buffer, buflen, errnop);
if (status == NSS_STATUS_RETURN) /* We couldn't parse the entry */
return NSS_STATUS_NOTFOUND;
else
#include <scratch_buffer.h>
static service_user *ni;
-/* Type of the lookup function. */
-static enum nss_status (*nss_initgroups_dyn) (const char *, gid_t,
- long int *, long int *,
- gid_t **, long int, int *);
-static enum nss_status (*nss_getgrnam_r) (const char *name,
- struct group * grp, char *buffer,
- size_t buflen, int *errnop);
-static enum nss_status (*nss_getgrgid_r) (gid_t gid, struct group * grp,
- char *buffer, size_t buflen,
- int *errnop);
-static enum nss_status (*nss_setgrent) (int stayopen);
-static enum nss_status (*nss_getgrent_r) (struct group * grp, char *buffer,
- size_t buflen, int *errnop);
-static enum nss_status (*nss_endgrent) (void);
+static enum nss_status (*initgroups_dyn_impl) (const char *, gid_t,
+ long int *, long int *,
+ gid_t **, long int, int *);
+static enum nss_status (*getgrnam_r_impl) (const char *name,
+ struct group * grp, char *buffer,
+ size_t buflen, int *errnop);
+static enum nss_status (*getgrgid_r_impl) (gid_t gid, struct group * grp,
+ char *buffer, size_t buflen,
+ int *errnop);
+static enum nss_status (*setgrent_impl) (int stayopen);
+static enum nss_status (*getgrent_r_impl) (struct group * grp, char *buffer,
+ size_t buflen, int *errnop);
+static enum nss_status (*endgrent_impl) (void);
/* Protect global state against multiple changers. */
__libc_lock_define_initialized (static, lock)
if (ni == NULL
&& __nss_database_lookup2 ("group_compat", NULL, "nis", &ni) >= 0)
{
- nss_initgroups_dyn = __nss_lookup_function (ni, "initgroups_dyn");
- nss_getgrnam_r = __nss_lookup_function (ni, "getgrnam_r");
- nss_getgrgid_r = __nss_lookup_function (ni, "getgrgid_r");
- nss_setgrent = __nss_lookup_function (ni, "setgrent");
- nss_getgrent_r = __nss_lookup_function (ni, "getgrent_r");
- nss_endgrent = __nss_lookup_function (ni, "endgrent");
+ initgroups_dyn_impl = __nss_lookup_function (ni, "initgroups_dyn");
+ getgrnam_r_impl = __nss_lookup_function (ni, "getgrnam_r");
+ getgrgid_r_impl = __nss_lookup_function (ni, "getgrgid_r");
+ setgrent_impl = __nss_lookup_function (ni, "setgrent");
+ getgrent_r_impl = __nss_lookup_function (ni, "getgrent_r");
+ endgrent_impl = __nss_lookup_function (ni, "endgrent");
}
__libc_lock_unlock (lock);
else
ent->blacklist.current = 0;
- if (ent->need_endgrent && nss_endgrent != NULL)
- nss_endgrent ();
+ if (ent->need_endgrent && endgrent_impl != NULL)
+ endgrent_impl ();
return NSS_STATUS_SUCCESS;
}
getgrent_r through the whole group database. But for large
group databases this is faster, since the user can only be
in a limited number of groups. */
- if (nss_initgroups_dyn (user, group, &mystart, &mysize, &mygroups,
- limit, errnop) == NSS_STATUS_SUCCESS)
+ if (initgroups_dyn_impl (user, group, &mystart, &mysize, &mygroups,
+ limit, errnop) == NSS_STATUS_SUCCESS)
{
status = NSS_STATUS_NOTFOUND;
for (int i = 0; i < mystart; i++)
{
- while ((status = nss_getgrgid_r (mygroups[i], &grpbuf,
- tmpbuf, tmplen, errnop))
+ while ((status = getgrgid_r_impl (mygroups[i], &grpbuf,
+ tmpbuf, tmplen, errnop))
== NSS_STATUS_TRYAGAIN
&& *errnop == ERANGE)
{
&& check_and_add_group (user, group, start, size,
groupsp, limit, &grpbuf))
{
- if (nss_setgrent != NULL)
+ if (setgrent_impl != NULL)
{
- nss_setgrent (1);
+ setgrent_impl (1);
ent->need_endgrent = true;
}
ent->skip_initgroups_dyn = true;
iter:
do
{
- if ((status = nss_getgrent_r (&grpbuf, buffer, buflen, errnop))
+ if ((status = getgrent_r_impl (&grpbuf, buffer, buflen, errnop))
!= NSS_STATUS_SUCCESS)
break;
}
/* Store the group in the blacklist for the "+" at the end of
/etc/group */
blacklist_store_name (&grpbuf.gr_name[1], ent);
- if (nss_getgrnam_r == NULL)
+ if (getgrnam_r_impl == NULL)
return NSS_STATUS_UNAVAIL;
- else if (nss_getgrnam_r (&grpbuf.gr_name[1], &grpbuf, buffer,
- buflen, errnop) != NSS_STATUS_SUCCESS)
+ else if (getgrnam_r_impl (&grpbuf.gr_name[1], &grpbuf, buffer,
+ buflen, errnop) != NSS_STATUS_SUCCESS)
continue;
check_and_add_group (user, group, start, size, groupsp,
/* If the selected module does not support getgrent_r or
initgroups_dyn, abort. We cannot find the needed group
entries. */
- if (nss_initgroups_dyn == NULL || nss_getgrgid_r == NULL)
+ if (initgroups_dyn_impl == NULL || getgrgid_r_impl == NULL)
{
- if (nss_setgrent != NULL)
+ if (setgrent_impl != NULL)
{
- nss_setgrent (1);
+ setgrent_impl (1);
ent->need_endgrent = true;
}
ent->skip_initgroups_dyn = true;
- if (nss_getgrent_r == NULL)
+ if (getgrent_r_impl == NULL)
return NSS_STATUS_UNAVAIL;
}
#include "nisdomain.h"
static service_user *ni;
-static enum nss_status (*nss_setpwent) (int stayopen);
-static enum nss_status (*nss_getpwnam_r) (const char *name,
- struct passwd * pwd, char *buffer,
- size_t buflen, int *errnop);
-static enum nss_status (*nss_getpwuid_r) (uid_t uid, struct passwd * pwd,
- char *buffer, size_t buflen,
- int *errnop);
-static enum nss_status (*nss_getpwent_r) (struct passwd * pwd, char *buffer,
- size_t buflen, int *errnop);
-static enum nss_status (*nss_endpwent) (void);
+static enum nss_status (*setpwent_impl) (int stayopen);
+static enum nss_status (*getpwnam_r_impl) (const char *name,
+ struct passwd * pwd, char *buffer,
+ size_t buflen, int *errnop);
+static enum nss_status (*getpwuid_r_impl) (uid_t uid, struct passwd * pwd,
+ char *buffer, size_t buflen,
+ int *errnop);
+static enum nss_status (*getpwent_r_impl) (struct passwd * pwd, char *buffer,
+ size_t buflen, int *errnop);
+static enum nss_status (*endpwent_impl) (void);
/* Get the declaration of the parser function. */
#define ENTNAME pwent
{
if (__nss_database_lookup2 ("passwd_compat", NULL, "nis", &ni) >= 0)
{
- nss_setpwent = __nss_lookup_function (ni, "setpwent");
- nss_getpwnam_r = __nss_lookup_function (ni, "getpwnam_r");
- nss_getpwuid_r = __nss_lookup_function (ni, "getpwuid_r");
- nss_getpwent_r = __nss_lookup_function (ni, "getpwent_r");
- nss_endpwent = __nss_lookup_function (ni, "endpwent");
+ setpwent_impl = __nss_lookup_function (ni, "setpwent");
+ getpwnam_r_impl = __nss_lookup_function (ni, "getpwnam_r");
+ getpwuid_r_impl = __nss_lookup_function (ni, "getpwuid_r");
+ getpwent_r_impl = __nss_lookup_function (ni, "getpwent_r");
+ endpwent_impl = __nss_lookup_function (ni, "endpwent");
}
}
give_pwd_free (&ent->pwd);
- if (needent && status == NSS_STATUS_SUCCESS && nss_setpwent)
- ent->setent_status = nss_setpwent (stayopen);
+ if (needent && status == NSS_STATUS_SUCCESS && setpwent_impl)
+ ent->setent_status = setpwent_impl (stayopen);
return status;
}
__libc_lock_lock (lock);
- if (nss_endpwent)
- nss_endpwent ();
+ if (endpwent_impl)
+ endpwent_impl ();
result = internal_endpwent (&ext_ent);
/* Leave function if NSS module does not support getpwnam_r,
we need this function here. */
- if (!nss_getpwnam_r)
+ if (!getpwnam_r_impl)
return NSS_STATUS_UNAVAIL;
if (ent->first)
p2 = buffer + (buflen - p2len);
buflen -= p2len;
- if (nss_getpwnam_r (user, result, buffer, buflen, errnop)
+ if (getpwnam_r_impl (user, result, buffer, buflen, errnop)
!= NSS_STATUS_SUCCESS)
continue;
size_t p2len;
/* Return if NSS module does not support getpwent_r. */
- if (!nss_getpwent_r)
+ if (!getpwent_r_impl)
return NSS_STATUS_UNAVAIL;
/* If the setpwent call failed, say so. */
do
{
- if ((status = nss_getpwent_r (result, buffer, buflen, errnop))
+ if ((status = getpwent_r_impl (result, buffer, buflen, errnop))
!= NSS_STATUS_SUCCESS)
return status;
}
getpwnam_plususer (const char *name, struct passwd *result, ent_t *ent,
char *buffer, size_t buflen, int *errnop)
{
- if (!nss_getpwnam_r)
+ if (!getpwnam_r_impl)
return NSS_STATUS_UNAVAIL;
struct passwd pwd;
char *p = buffer + (buflen - plen);
buflen -= plen;
- enum nss_status status = nss_getpwnam_r (name, result, buffer, buflen,
- errnop);
+ enum nss_status status = getpwnam_r_impl (name, result, buffer, buflen,
+ errnop);
if (status != NSS_STATUS_SUCCESS)
return status;
char *p;
size_t plen;
- if (!nss_getpwuid_r)
+ if (!getpwuid_r_impl)
return NSS_STATUS_UNAVAIL;
memset (&pwd, '\0', sizeof (struct passwd));
p = buffer + (buflen - plen);
buflen -= plen;
- if (nss_getpwuid_r (uid, result, buffer, buflen, errnop) ==
+ if (getpwuid_r_impl (uid, result, buffer, buflen, errnop) ==
NSS_STATUS_SUCCESS)
{
copy_pwd_changes (result, &pwd, p, plen);
#include "nisdomain.h"
static service_user *ni;
-static enum nss_status (*nss_setspent) (int stayopen);
-static enum nss_status (*nss_getspnam_r) (const char *name, struct spwd * sp,
- char *buffer, size_t buflen,
- int *errnop);
-static enum nss_status (*nss_getspent_r) (struct spwd * sp, char *buffer,
- size_t buflen, int *errnop);
-static enum nss_status (*nss_endspent) (void);
+static enum nss_status (*setspent_impl) (int stayopen);
+static enum nss_status (*getspnam_r_impl) (const char *name, struct spwd * sp,
+ char *buffer, size_t buflen,
+ int *errnop);
+static enum nss_status (*getspent_r_impl) (struct spwd * sp, char *buffer,
+ size_t buflen, int *errnop);
+static enum nss_status (*endspent_impl) (void);
/* Get the declaration of the parser function. */
#define ENTNAME spent
if (__nss_database_lookup2 ("shadow_compat", "passwd_compat",
"nis", &ni) >= 0)
{
- nss_setspent = __nss_lookup_function (ni, "setspent");
- nss_getspnam_r = __nss_lookup_function (ni, "getspnam_r");
- nss_getspent_r = __nss_lookup_function (ni, "getspent_r");
- nss_endspent = __nss_lookup_function (ni, "endspent");
+ setspent_impl = __nss_lookup_function (ni, "setspent");
+ getspnam_r_impl = __nss_lookup_function (ni, "getspnam_r");
+ getspent_r_impl = __nss_lookup_function (ni, "getspent_r");
+ endspent_impl = __nss_lookup_function (ni, "endspent");
}
}
give_spwd_free (&ent->pwd);
- if (needent && status == NSS_STATUS_SUCCESS && nss_setspent)
- ent->setent_status = nss_setspent (stayopen);
+ if (needent && status == NSS_STATUS_SUCCESS && setspent_impl)
+ ent->setent_status = setspent_impl (stayopen);
return status;
}
__libc_lock_lock (lock);
- if (nss_endspent)
- nss_endspent ();
+ if (endspent_impl)
+ endspent_impl ();
result = internal_endspent (&ext_ent);
char *curdomain = NULL, *host, *user, *domain, *p2;
size_t p2len;
- if (!nss_getspnam_r)
+ if (!getspnam_r_impl)
return NSS_STATUS_UNAVAIL;
/* If the setpwent call failed, say so. */
p2 = buffer + (buflen - p2len);
buflen -= p2len;
- if (nss_getspnam_r (user, result, buffer, buflen, errnop)
+ if (getspnam_r_impl (user, result, buffer, buflen, errnop)
!= NSS_STATUS_SUCCESS)
continue;
char *p2;
size_t p2len;
- if (!nss_getspent_r)
+ if (!getspent_r_impl)
return NSS_STATUS_UNAVAIL;
p2len = spwd_need_buflen (&ent->pwd);
buflen -= p2len;
do
{
- if ((status = nss_getspent_r (result, buffer, buflen, errnop))
+ if ((status = getspent_r_impl (result, buffer, buflen, errnop))
!= NSS_STATUS_SUCCESS)
return status;
}
getspnam_plususer (const char *name, struct spwd *result, ent_t *ent,
char *buffer, size_t buflen, int *errnop)
{
- if (!nss_getspnam_r)
+ if (!getspnam_r_impl)
return NSS_STATUS_UNAVAIL;
struct spwd pwd;
char *p = buffer + (buflen - plen);
buflen -= plen;
- enum nss_status status = nss_getspnam_r (name, result, buffer, buflen,
- errnop);
+ enum nss_status status = getspnam_r_impl (name, result, buffer, buflen,
+ errnop);
if (status != NSS_STATUS_SUCCESS)
return status;