summaryrefslogtreecommitdiff
path: root/inet
diff options
context:
space:
mode:
authorDJ Delorie <dj@redhat.com>2020-11-09 22:09:34 -0500
committerDJ Delorie <dj@redhat.com>2020-12-04 17:16:32 -0500
commitf4f3b09111e9fa38fd485979a3e40b6cfa6a757d (patch)
treef2743a776f31b86ebebc9f145dd1305bade66eef /inet
parentnsswitch: user new internal API (tests) (diff)
downloadglibc-f4f3b09111e9fa38fd485979a3e40b6cfa6a757d.tar.gz
glibc-f4f3b09111e9fa38fd485979a3e40b6cfa6a757d.tar.bz2
glibc-f4f3b09111e9fa38fd485979a3e40b6cfa6a757d.zip
nsswitch: use new internal API (callers)
Stitch new ABI and types throughout all NSS callers. Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
Diffstat (limited to 'inet')
-rw-r--r--inet/ether_hton.c21
-rw-r--r--inet/ether_ntoh.c21
-rw-r--r--inet/getnetgrent_r.c40
-rw-r--r--inet/netgroup.h2
4 files changed, 11 insertions, 73 deletions
diff --git a/inet/ether_hton.c b/inet/ether_hton.c
index ff6943fc35..cccae17f10 100644
--- a/inet/ether_hton.c
+++ b/inet/ether_hton.c
@@ -30,9 +30,7 @@ typedef int (*lookup_function) (const char *, struct etherent *, char *, int,
int
ether_hostton (const char *hostname, struct ether_addr *addr)
{
- static service_user *startp;
- static lookup_function start_fct;
- service_user *nip;
+ nss_action_list nip;
union
{
lookup_function f;
@@ -42,22 +40,7 @@ ether_hostton (const char *hostname, struct ether_addr *addr)
enum nss_status status = NSS_STATUS_UNAVAIL;
struct etherent etherent;
- if (startp == NULL)
- {
- no_more = __nss_ethers_lookup2 (&nip, "gethostton_r", NULL, &fct.ptr);
- if (no_more)
- startp = (service_user *) -1;
- else
- {
- startp = nip;
- start_fct = fct.f;
- }
- }
- else
- {
- fct.f = start_fct;
- no_more = (nip = startp) == (service_user *) -1;
- }
+ no_more = __nss_ethers_lookup2 (&nip, "gethostton_r", NULL, &fct.ptr);
while (no_more == 0)
{
diff --git a/inet/ether_ntoh.c b/inet/ether_ntoh.c
index e409773601..5ef654292c 100644
--- a/inet/ether_ntoh.c
+++ b/inet/ether_ntoh.c
@@ -31,9 +31,7 @@ typedef int (*lookup_function) (const struct ether_addr *, struct etherent *,
int
ether_ntohost (char *hostname, const struct ether_addr *addr)
{
- static service_user *startp;
- static lookup_function start_fct;
- service_user *nip;
+ nss_action_list nip;
union
{
lookup_function f;
@@ -43,22 +41,7 @@ ether_ntohost (char *hostname, const struct ether_addr *addr)
enum nss_status status = NSS_STATUS_UNAVAIL;
struct etherent etherent;
- if (startp == NULL)
- {
- no_more = __nss_ethers_lookup2 (&nip, "getntohost_r", NULL, &fct.ptr);
- if (no_more)
- startp = (service_user *) -1;
- else
- {
- startp = nip;
- start_fct = fct.f;
- }
- }
- else
- {
- fct.f = start_fct;
- no_more = (nip = startp) == (service_user *) -1;
- }
+ no_more = __nss_ethers_lookup2 (&nip, "getntohost_r", NULL, &fct.ptr);
while (no_more == 0)
{
diff --git a/inet/getnetgrent_r.c b/inet/getnetgrent_r.c
index 78a66eee00..9c75af6f77 100644
--- a/inet/getnetgrent_r.c
+++ b/inet/getnetgrent_r.c
@@ -39,40 +39,12 @@ static struct __netgrent dataset;
/* Set up NIP to run through the services. Return nonzero if there are no
services (left). */
static int
-setup (void **fctp, service_user **nipp)
+setup (void **fctp, nss_action_list *nipp)
{
- /* Remember the first service_entry, it's always the same. */
- static bool startp_initialized;
- static service_user *startp;
int no_more;
- if (!startp_initialized)
- {
- /* Executing this more than once at the same time must yield the
- same result every time. So we need no locking. */
- no_more = __nss_netgroup_lookup2 (nipp, "setnetgrent", NULL, fctp);
- startp = no_more ? (service_user *) -1 : *nipp;
-#ifdef PTR_MANGLE
- PTR_MANGLE (startp);
-#endif
- atomic_write_barrier ();
- startp_initialized = true;
- }
- else
- {
- service_user *nip = startp;
-#ifdef PTR_DEMANGLE
- PTR_DEMANGLE (nip);
-#endif
- if (nip == (service_user *) -1)
- /* No services at all. */
- return 1;
-
- /* Reset to the beginning of the service list. */
- *nipp = nip;
- /* Look up the first function. */
- no_more = __nss_lookup (nipp, "setnetgrent", NULL, fctp);
- }
+ no_more = __nss_netgroup_lookup2 (nipp, "setnetgrent", NULL, fctp);
+
return no_more;
}
@@ -100,7 +72,7 @@ endnetgrent_hook (struct __netgrent *datap)
{
enum nss_status (*endfct) (struct __netgrent *);
- if (datap->nip == NULL || datap->nip == (service_user *) -1l)
+ if (datap->nip == NULL || datap->nip == (nss_action_list) -1l)
return;
endfct = __nss_lookup_function (datap->nip, "endnetgrent");
@@ -133,7 +105,7 @@ __internal_setnetgrent_reuse (const char *group, struct __netgrent *datap,
/* Ignore status, we force check in `__nss_next2'. */
status = DL_CALL_FCT (*fct.f, (group, datap));
- service_user *old_nip = datap->nip;
+ nss_action_list old_nip = datap->nip;
no_more = __nss_next2 (&datap->nip, "setnetgrent", NULL, &fct.ptr,
status, 0);
@@ -275,7 +247,7 @@ __internal_getnetgrent_r (char **hostp, char **userp, char **domainp,
/* This bogus function pointer is a special marker left by
__nscd_setnetgrent to tell us to use the data it left
before considering any modules. */
- if (datap->nip == (service_user *) -1l)
+ if (datap->nip == (nss_action_list) -1l)
fct = nscd_getnetgrent;
else
#endif
diff --git a/inet/netgroup.h b/inet/netgroup.h
index 53081db78f..910094b9ca 100644
--- a/inet/netgroup.h
+++ b/inet/netgroup.h
@@ -64,7 +64,7 @@ struct __netgrent
/* This handle for the NSS data base is shared between all
set/get/endXXXent functions. */
- service_user *nip;
+ struct nss_action *nip;
};