diff options
author | Ulrich Drepper <drepper@redhat.com> | 2003-01-19 19:22:02 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2003-01-19 19:22:02 +0000 |
commit | b677d6742888747613ebb4dbe4bbb4dbe6e07087 (patch) | |
tree | 97ebb6523b2a78ebccff54651bf2fe7736943ec5 /nis | |
parent | 978bd14399d7b027513676bb1ad9c8b8def71174 (diff) | |
download | glibc-b677d6742888747613ebb4dbe4bbb4dbe6e07087.zip glibc-b677d6742888747613ebb4dbe4bbb4dbe6e07087.tar.gz glibc-b677d6742888747613ebb4dbe4bbb4dbe6e07087.tar.bz2 |
Update.
2003-01-19 Ulrich Drepper <drepper@redhat.com>
* nis/nss_nis/nis-spwd.c: Make _nss_nis_endspent an alias of
_nss_nis_setspent. Work around the different prototypes.
* nis/nss_nis/nis-rpc.c (internal_nis_setrpcent): Use
internal_nis_endrpcent.
(internal_nis_endrpcent): Change return type to void. Change callers.
* nis/nss_nis/nis-pwd.c: Make _nss_nis_endpwent an alias of
_nss_nis_setpwent. Work around the different prototypes.
* nis/nss_nis/nis-proto.c (_nss_nis_endprotoent): Split out body
of the function to...
(internal_nis_endprotoent): ... here. New function.
(internal_nis_setprotoent): Use internal_nis_endprotoent.
* nis/nss_nis/nis-network.c: Make _nss_nis_endnetent an alias of
_nss_nis_setnetent. Work around the different prototypes.
* nis/nss_nis/nis-netgrp.c (_nss_nis_endnetgrent): Split out body
of the function to...
(internal_nis_endnetgrent): ... here. New function.
(_nss_nis_setnetgrent): Use internal_nis_endnetgrent.
Diffstat (limited to 'nis')
-rw-r--r-- | nis/nss_nis/nis-grp.c | 2 | ||||
-rw-r--r-- | nis/nss_nis/nis-netgrp.c | 31 | ||||
-rw-r--r-- | nis/nss_nis/nis-network.c | 28 | ||||
-rw-r--r-- | nis/nss_nis/nis-proto.c | 35 | ||||
-rw-r--r-- | nis/nss_nis/nis-pwd.c | 28 | ||||
-rw-r--r-- | nis/nss_nis/nis-rpc.c | 47 | ||||
-rw-r--r-- | nis/nss_nis/nis-spwd.c | 37 |
7 files changed, 80 insertions, 128 deletions
diff --git a/nis/nss_nis/nis-grp.c b/nis/nss_nis/nis-grp.c index e000e6a..c090a77 100644 --- a/nis/nss_nis/nis-grp.c +++ b/nis/nss_nis/nis-grp.c @@ -64,7 +64,7 @@ _nss_nis_setgrent (int stayopen) } /* Make _nss_nis_endgrent an alias of _nss_nis_setgrent. We do this even though the prototypes don't match. The argument of setgrent - is used so this makes no difference. */ + is not used so this makes no difference. */ strong_alias (_nss_nis_setgrent, _nss_nis_endgrent) static enum nss_status diff --git a/nis/nss_nis/nis-netgrp.c b/nis/nss_nis/nis-netgrp.c index c9b5242..e9318d6 100644 --- a/nis/nss_nis/nis-netgrp.c +++ b/nis/nss_nis/nis-netgrp.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1996, 1997, 1999, 2000, 2002 Free Software Foundation, Inc. +/* Copyright (C) 1996,1997,1999,2000,2002,2003 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Thorsten Kukuk <kukuk@suse.de>, 1996. @@ -42,6 +42,19 @@ extern enum nss_status _nss_netgroup_parseline (char **cursor, struct __netgrent *result, char *buffer, size_t buflen, int *errnop); + +static void +internal_nis_endnetgrent (void) +{ + if (data != NULL) + { + free (data); + data = NULL; + data_size = 0; + cursor = NULL; + } +} + enum nss_status _nss_nis_setnetgrent (const char *group, struct __netgrent *dummy) { @@ -60,13 +73,7 @@ _nss_nis_setnetgrent (const char *group, struct __netgrent *dummy) __libc_lock_lock (lock); - if (data != NULL) - { - free (data); - data = NULL; - data_size = 0; - cursor = NULL; - } + internal_nis_endnetgrent (); group_len = strlen (group); @@ -96,13 +103,7 @@ _nss_nis_endnetgrent (struct __netgrent *dummy) { __libc_lock_lock (lock); - if (data != NULL) - { - free (data); - data = NULL; - data_size = 0; - cursor = NULL; - } + internal_nis_endnetgrent (); __libc_lock_unlock (lock); diff --git a/nis/nss_nis/nis-network.c b/nis/nss_nis/nis-network.c index 0e40b6f..2292aea 100644 --- a/nis/nss_nis/nis-network.c +++ b/nis/nss_nis/nis-network.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1996-2000, 2001, 2002 Free Software Foundation, Inc. +/* Copyright (C) 1996-2000, 2001, 2002, 2003 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1996. @@ -18,7 +18,11 @@ 02111-1307 USA. */ #include <nss.h> +/* The following is an ugly trick to avoid a prototype declaration for + _nss_nis_endgrent. */ +#define _nss_nis_endnetent _nss_nis_endnetent_XXX #include <netdb.h> +#undef _nss_nis_endnetent #include <ctype.h> #include <errno.h> #include <stdint.h> @@ -59,24 +63,10 @@ _nss_nis_setnetent (int stayopen) return NSS_STATUS_SUCCESS; } - -enum nss_status -_nss_nis_endnetent (void) -{ - __libc_lock_lock (lock); - - new_start = 1; - if (oldkey != NULL) - { - free (oldkey); - oldkey = NULL; - oldkeylen = 0; - } - - __libc_lock_unlock (lock); - - return NSS_STATUS_SUCCESS; -} +/* Make _nss_nis_endnetent an alias of _nss_nis_setnetent. We do this + even though the prototypes don't match. The argument of setnetent + is not used so this makes no difference. */ +strong_alias (_nss_nis_setnetent, _nss_nis_endnetent) static enum nss_status internal_nis_getnetent_r (struct netent *net, char *buffer, size_t buflen, diff --git a/nis/nss_nis/nis-proto.c b/nis/nss_nis/nis-proto.c index 00e86df..b8c234e 100644 --- a/nis/nss_nis/nis-proto.c +++ b/nis/nss_nis/nis-proto.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1996,1997,1998,2000,2001,2002 Free Software Foundation, Inc. +/* Copyright (C) 1996-1998, 2000-2002, 2003 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Thorsten Kukuk <kukuk@suse.de>, 1996. @@ -78,15 +78,9 @@ saveit (int instatus, char *inkey, int inkeylen, char *inval, return 0; } -static enum nss_status -internal_nis_setprotoent (void) +static void +internal_nis_endprotoent (void) { - char *domainname; - struct ypall_callback ypcb; - enum nss_status status; - - yp_get_default_domain (&domainname); - while (start != NULL) { if (start->val != NULL) @@ -95,7 +89,18 @@ internal_nis_setprotoent (void) start = start->next; free (next); } - start = NULL; +} + +static enum nss_status +internal_nis_setprotoent (void) +{ + char *domainname; + struct ypall_callback ypcb; + enum nss_status status; + + yp_get_default_domain (&domainname); + + internal_nis_endprotoent (); ypcb.foreach = saveit; ypcb.data = NULL; @@ -124,15 +129,7 @@ _nss_nis_endprotoent (void) { __libc_lock_lock (lock); - while (start != NULL) - { - if (start->val != NULL) - free (start->val); - next = start; - start = start->next; - free (next); - } - start = NULL; + internal_nis_endprotoent (); next = NULL; __libc_lock_unlock (lock); diff --git a/nis/nss_nis/nis-pwd.c b/nis/nss_nis/nis-pwd.c index da5ffab..0f56ced 100644 --- a/nis/nss_nis/nis-pwd.c +++ b/nis/nss_nis/nis-pwd.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1996, 1997, 1998, 2001, 2002 Free Software Foundation, Inc. +/* Copyright (C) 1996-1998, 2001, 2002, 2003 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1996. @@ -18,7 +18,11 @@ 02111-1307 USA. */ #include <nss.h> +/* The following is an ugly trick to avoid a prototype declaration for + _nss_nis_endpwent. */ +#define _nss_nis_endpwent _nss_nis_endpwent_XXX #include <pwd.h> +#undef _nss_nis_endpwent #include <ctype.h> #include <errno.h> #include <string.h> @@ -58,24 +62,10 @@ _nss_nis_setpwent (int stayopen) return NSS_STATUS_SUCCESS; } - -enum nss_status -_nss_nis_endpwent (void) -{ - __libc_lock_lock (lock); - - new_start = 1; - if (oldkey != NULL) - { - free (oldkey); - oldkey = NULL; - oldkeylen = 0; - } - - __libc_lock_unlock (lock); - - return NSS_STATUS_SUCCESS; -} +/* Make _nss_nis_endpwent an alias of _nss_nis_setpwent. We do this + even though the prototypes don't match. The argument of setpwent + is not used so this makes no difference. */ +strong_alias (_nss_nis_setpwent, _nss_nis_endpwent) static enum nss_status internal_nis_getpwent_r (struct passwd *pwd, char *buffer, size_t buflen, diff --git a/nis/nss_nis/nis-rpc.c b/nis/nss_nis/nis-rpc.c index 1f9e5b4..6e707b9 100644 --- a/nis/nss_nis/nis-rpc.c +++ b/nis/nss_nis/nis-rpc.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1996, 1997, 1998, 2000, 2002 Free Software Foundation, Inc. +/* Copyright (C) 1996-1998, 2000, 2002, 2003 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Thorsten Kukuk <kukuk@suse.de>, 1996. @@ -86,6 +86,19 @@ saveit (int instatus, char *inkey, int inkeylen, char *inval, return 0; } +static void +internal_nis_endrpcent (intern_t *intern) +{ + while (intern->start != NULL) + { + if (intern->start->val != NULL) + free (intern->start->val); + intern->next = intern->start; + intern->start = intern->start->next; + free (intern->next); + } +} + static enum nss_status internal_nis_setrpcent (intern_t *intern) { @@ -96,15 +109,7 @@ internal_nis_setrpcent (intern_t *intern) if (yp_get_default_domain (&domainname)) return NSS_STATUS_UNAVAIL; - while (intern->start != NULL) - { - if (intern->start->val != NULL) - free (intern->start->val); - intern->next = intern->start; - intern->start = intern->start->next; - free (intern->next); - } - intern->start = NULL; + internal_nis_endrpcent (intern); ypcb.foreach = saveit; ypcb.data = (char *)intern; @@ -128,34 +133,16 @@ _nss_nis_setrpcent (int stayopen) return status; } -static enum nss_status -internal_nis_endrpcent (intern_t *intern) -{ - while (intern->start != NULL) - { - if (intern->start->val != NULL) - free (intern->start->val); - intern->next = intern->start; - intern->start = intern->start->next; - free (intern->next); - } - intern->start = NULL; - - return NSS_STATUS_SUCCESS; -} - enum nss_status _nss_nis_endrpcent (void) { - enum nss_status status; - __libc_lock_lock (lock); - status = internal_nis_endrpcent (&intern); + internal_nis_endrpcent (&intern); __libc_lock_unlock (lock); - return status; + return NSS_STATUS_SUCCESS; } static enum nss_status diff --git a/nis/nss_nis/nis-spwd.c b/nis/nss_nis/nis-spwd.c index c06e954..99a9ed5 100644 --- a/nis/nss_nis/nis-spwd.c +++ b/nis/nss_nis/nis-spwd.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1996, 1997, 1998, 2001, 2002 Free Software Foundation, Inc. +/* Copyright (C) 1996-1998, 2001, 2002, 2003 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1996. @@ -21,7 +21,11 @@ #include <ctype.h> #include <errno.h> #include <string.h> +/* The following is an ugly trick to avoid a prototype declaration for + _nss_nis_endspent. */ +#define _nss_nis_endspent _nss_nis_endspent_XXX #include <shadow.h> +#undef _nss_nis_endspent #include <bits/libc-lock.h> #include <rpcsvc/yp.h> #include <rpcsvc/ypclnt.h> @@ -47,35 +51,18 @@ _nss_nis_setspent (int stayopen) __libc_lock_lock (lock); new_start = 1; - if (oldkey != NULL) - { - free (oldkey); - oldkey = NULL; - oldkeylen = 0; - } - - __libc_lock_unlock (lock); - - return NSS_STATUS_SUCCESS; -} - -enum nss_status -_nss_nis_endspent (void) -{ - __libc_lock_lock (lock); - - new_start = 1; - if (oldkey != NULL) - { - free (oldkey); - oldkey = NULL; - oldkeylen = 0; - } + free (oldkey); + oldkey = NULL; + oldkeylen = 0; __libc_lock_unlock (lock); return NSS_STATUS_SUCCESS; } +/* Make _nss_nis_endspent an alias of _nss_nis_setspent. We do this + even though the prototypes don't match. The argument of setspent + is not used so this makes no difference. */ +strong_alias (_nss_nis_setspent, _nss_nis_endspent) static enum nss_status internal_nis_getspent_r (struct spwd *sp, char *buffer, size_t buflen, |