aboutsummaryrefslogtreecommitdiff
path: root/nss
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2020-02-12 11:30:06 +0100
committerFlorian Weimer <fweimer@redhat.com>2020-02-13 09:14:26 +0100
commit8a9221415041543aa163071fa547e88138ceec9d (patch)
treead66eb4c2fa87e6ccb2915ff340d74c9373e0892 /nss
parent9333498794cde1d5cca518badf79533a24114b6f (diff)
downloadglibc-8a9221415041543aa163071fa547e88138ceec9d.zip
glibc-8a9221415041543aa163071fa547e88138ceec9d.tar.gz
glibc-8a9221415041543aa163071fa547e88138ceec9d.tar.bz2
nss_compat: Do not use nss_* names for function pointers
A future commit will use these names for types of functions in NSS service modules. Reviewed-by: DJ Delorie <dj@redhat.com>
Diffstat (limited to 'nss')
-rw-r--r--nss/nss_compat/compat-grp.c54
-rw-r--r--nss/nss_compat/compat-initgroups.c71
-rw-r--r--nss/nss_compat/compat-pwd.c56
-rw-r--r--nss/nss_compat/compat-spwd.c44
4 files changed, 112 insertions, 113 deletions
diff --git a/nss/nss_compat/compat-grp.c b/nss/nss_compat/compat-grp.c
index a8de1e0..561511c 100644
--- a/nss/nss_compat/compat-grp.c
+++ b/nss/nss_compat/compat-grp.c
@@ -28,16 +28,16 @@
#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
@@ -80,11 +80,11 @@ init_nss_interface (void)
{
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");
}
}
@@ -117,8 +117,8 @@ internal_setgrent (ent_t *ent, int stayopen, int needent)
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;
}
@@ -170,8 +170,8 @@ _nss_compat_endgrent (void)
__libc_lock_lock (lock);
- if (nss_endgrent)
- nss_endgrent ();
+ if (endgrent_impl)
+ endgrent_impl ();
result = internal_endgrent (&ext_ent);
@@ -185,7 +185,7 @@ static enum nss_status
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. */
@@ -196,7 +196,7 @@ getgrent_next_nss (struct group *result, ent_t *ent, char *buffer,
{
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;
}
@@ -210,11 +210,11 @@ static enum nss_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;
@@ -578,11 +578,11 @@ internal_getgrgid_r (gid_t gid, struct group *result, ent_t *ent,
/* +:... */
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
diff --git a/nss/nss_compat/compat-initgroups.c b/nss/nss_compat/compat-initgroups.c
index 939b25b..d2a280d 100644
--- a/nss/nss_compat/compat-initgroups.c
+++ b/nss/nss_compat/compat-initgroups.c
@@ -31,20 +31,19 @@
#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)
@@ -91,12 +90,12 @@ init_nss_interface (void)
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);
@@ -151,8 +150,8 @@ internal_endgrent (ent_t *ent)
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;
}
@@ -244,8 +243,8 @@ getgrent_next_nss (ent_t *ent, char *buffer, size_t buflen, const char *user,
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;
@@ -264,8 +263,8 @@ getgrent_next_nss (ent_t *ent, char *buffer, size_t buflen, const char *user,
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)
{
@@ -301,9 +300,9 @@ getgrent_next_nss (ent_t *ent, char *buffer, size_t buflen, const char *user,
&& 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;
@@ -334,7 +333,7 @@ getgrent_next_nss (ent_t *ent, char *buffer, size_t buflen, const char *user,
iter:
do
{
- if ((status = nss_getgrent_r (&grpbuf, buffer, buflen, errnop))
+ if ((status = getgrent_r_impl (&grpbuf, buffer, buflen, errnop))
!= NSS_STATUS_SUCCESS)
break;
}
@@ -426,10 +425,10 @@ internal_getgrent_r (ent_t *ent, char *buffer, size_t buflen, const char *user,
/* 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,
@@ -444,16 +443,16 @@ internal_getgrent_r (ent_t *ent, char *buffer, size_t buflen, const char *user,
/* 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;
}
diff --git a/nss/nss_compat/compat-pwd.c b/nss/nss_compat/compat-pwd.c
index ec3f35c..b964e6f 100644
--- a/nss/nss_compat/compat-pwd.c
+++ b/nss/nss_compat/compat-pwd.c
@@ -32,16 +32,16 @@
#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
@@ -90,11 +90,11 @@ init_nss_interface (void)
{
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");
}
}
@@ -234,8 +234,8 @@ internal_setpwent (ent_t *ent, int stayopen, int needent)
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;
}
@@ -294,8 +294,8 @@ _nss_compat_endpwent (void)
__libc_lock_lock (lock);
- if (nss_endpwent)
- nss_endpwent ();
+ if (endpwent_impl)
+ endpwent_impl ();
result = internal_endpwent (&ext_ent);
@@ -316,7 +316,7 @@ getpwent_next_nss_netgr (const char *name, struct passwd *result, ent_t *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)
@@ -370,7 +370,7 @@ getpwent_next_nss_netgr (const char *name, struct passwd *result, ent_t *ent,
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;
@@ -397,7 +397,7 @@ getpwent_next_nss (struct passwd *result, ent_t *ent, char *buffer,
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. */
@@ -418,7 +418,7 @@ getpwent_next_nss (struct passwd *result, ent_t *ent, char *buffer,
do
{
- if ((status = nss_getpwent_r (result, buffer, buflen, errnop))
+ if ((status = getpwent_r_impl (result, buffer, buflen, errnop))
!= NSS_STATUS_SUCCESS)
return status;
}
@@ -434,7 +434,7 @@ static enum nss_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;
@@ -451,8 +451,8 @@ getpwnam_plususer (const char *name, struct passwd *result, ent_t *ent,
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;
@@ -836,7 +836,7 @@ getpwuid_plususer (uid_t uid, struct passwd *result, char *buffer,
char *p;
size_t plen;
- if (!nss_getpwuid_r)
+ if (!getpwuid_r_impl)
return NSS_STATUS_UNAVAIL;
memset (&pwd, '\0', sizeof (struct passwd));
@@ -852,7 +852,7 @@ getpwuid_plususer (uid_t uid, struct passwd *result, char *buffer,
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);
diff --git a/nss/nss_compat/compat-spwd.c b/nss/nss_compat/compat-spwd.c
index f6b7a1e..15f5b95 100644
--- a/nss/nss_compat/compat-spwd.c
+++ b/nss/nss_compat/compat-spwd.c
@@ -32,13 +32,13 @@
#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
@@ -88,10 +88,10 @@ init_nss_interface (void)
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");
}
}
@@ -190,8 +190,8 @@ internal_setspent (ent_t *ent, int stayopen, int needent)
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;
}
@@ -251,8 +251,8 @@ _nss_compat_endspent (void)
__libc_lock_lock (lock);
- if (nss_endspent)
- nss_endspent ();
+ if (endspent_impl)
+ endspent_impl ();
result = internal_endspent (&ext_ent);
@@ -270,7 +270,7 @@ getspent_next_nss_netgr (const char *name, struct spwd *result, ent_t *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. */
@@ -330,7 +330,7 @@ getspent_next_nss_netgr (const char *name, struct spwd *result, ent_t *ent,
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;
@@ -356,7 +356,7 @@ getspent_next_nss (struct spwd *result, ent_t *ent,
char *p2;
size_t p2len;
- if (!nss_getspent_r)
+ if (!getspent_r_impl)
return NSS_STATUS_UNAVAIL;
p2len = spwd_need_buflen (&ent->pwd);
@@ -369,7 +369,7 @@ getspent_next_nss (struct spwd *result, ent_t *ent,
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;
}
@@ -386,7 +386,7 @@ static enum nss_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;
@@ -407,8 +407,8 @@ getspnam_plususer (const char *name, struct spwd *result, ent_t *ent,
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;