* nis/nis_table.c (nis_list): Always strdup string used with
	ibreq->ibr_name.  Add several NULL pointer checks.

	* nis/nss_nisplus/nisplus-alias.c: Add check for NULL return value
	of nis_list.
	* nis/nss_nisplus/nisplus-ethers.c: Likewise.
	* nis/nss_nisplus/nisplus-grp.c: Likewise.
	* nis/nss_nisplus/nisplus-hosts.c: Likewise.
	* nis/nss_nisplus/nisplus-netgrp.c: Likewise.
	* nis/nss_nisplus/nisplus-network.c: Likewise.
	* nis/nss_nisplus/nisplus-proto.c: Likewise.
	* nis/nss_nisplus/nisplus-publickey.c: Likewise.
	* nis/nss_nisplus/nisplus-pwd.c: Likewise.
	* nis/nss_nisplus/nisplus-rpc.c: Likewise.
	* nis/nss_nisplus/nisplus-service.c: Likewise.
	* nis/nss_nisplus/nisplus-spwd.c: Likewise.
This commit is contained in:
Ulrich Drepper 2003-09-25 19:44:55 +00:00
parent ed91314ee8
commit 901956a52a
14 changed files with 292 additions and 93 deletions

View File

@ -1,5 +1,22 @@
2003-09-25 Ulrich Drepper <drepper@redhat.com> 2003-09-25 Ulrich Drepper <drepper@redhat.com>
* nis/nis_table.c (nis_list): Always strdup string used with
ibreq->ibr_name. Add several NULL pointer checks.
* nis/nss_nisplus/nisplus-alias.c: Add check for NULL return value
of nis_list.
* nis/nss_nisplus/nisplus-ethers.c: Likewise.
* nis/nss_nisplus/nisplus-grp.c: Likewise.
* nis/nss_nisplus/nisplus-hosts.c: Likewise.
* nis/nss_nisplus/nisplus-netgrp.c: Likewise.
* nis/nss_nisplus/nisplus-network.c: Likewise.
* nis/nss_nisplus/nisplus-proto.c: Likewise.
* nis/nss_nisplus/nisplus-publickey.c: Likewise.
* nis/nss_nisplus/nisplus-pwd.c: Likewise.
* nis/nss_nisplus/nisplus-rpc.c: Likewise.
* nis/nss_nisplus/nisplus-service.c: Likewise.
* nis/nss_nisplus/nisplus-spwd.c: Likewise.
* sysdeps/unix/sysv/linux/alpha/bits/mman.h: Define PROT_GROWSDOWN * sysdeps/unix/sysv/linux/alpha/bits/mman.h: Define PROT_GROWSDOWN
and PROT_GROWSUP. and PROT_GROWSUP.
* sysdeps/unix/sysv/linux/arm/bits/mman.h: Likewise. * sysdeps/unix/sysv/linux/arm/bits/mman.h: Likewise.

View File

@ -176,8 +176,8 @@ nis_list (const_nis_name name, unsigned int flags,
return res; return res;
} }
if ((flags & EXPAND_NAME) && if ((flags & EXPAND_NAME)
ibreq->ibr_name[strlen (ibreq->ibr_name) - 1] != '.') && ibreq->ibr_name[strlen (ibreq->ibr_name) - 1] != '.')
{ {
names = nis_getnames (ibreq->ibr_name); names = nis_getnames (ibreq->ibr_name);
free (ibreq->ibr_name); free (ibreq->ibr_name);
@ -189,6 +189,12 @@ nis_list (const_nis_name name, unsigned int flags,
return res; return res;
} }
ibreq->ibr_name = strdup (names[name_nr]); ibreq->ibr_name = strdup (names[name_nr]);
if (ibreq->ibr_name == NULL)
{
nis_free_request (ibreq);
NIS_RES_STATUS (res) = NIS_NOMEMORY;
return res;
}
} }
else else
{ {
@ -269,6 +275,12 @@ nis_list (const_nis_name name, unsigned int flags,
++count_links; ++count_links;
ibreq->ibr_name = ibreq->ibr_name =
strdup (NIS_RES_OBJECT (res)->LI_data.li_name); strdup (NIS_RES_OBJECT (res)->LI_data.li_name);
if (ibreq->ibr_name == NULL)
{
nis_free_request (ibreq);
NIS_RES_STATUS (res) = NIS_NOMEMORY;
return res;
}
if (NIS_RES_OBJECT (res)->LI_data.li_attrs.li_attrs_len) if (NIS_RES_OBJECT (res)->LI_data.li_attrs.li_attrs_len)
if (ibreq->ibr_srch.ibr_srch_len == 0) if (ibreq->ibr_srch.ibr_srch_len == 0)
{ {
@ -309,6 +321,12 @@ nis_list (const_nis_name name, unsigned int flags,
if (ibreq->ibr_name == NULL || ibreq->ibr_name[0] == '\0') if (ibreq->ibr_name == NULL || ibreq->ibr_name[0] == '\0')
{ {
ibreq->ibr_name = strdup (""); ibreq->ibr_name = strdup ("");
if (ibreq->ibr_name == NULL)
{
nis_free_request (ibreq);
NIS_RES_STATUS (res) = NIS_NOMEMORY;
return res;
}
++done; ++done;
} }
else else
@ -318,7 +336,6 @@ nis_list (const_nis_name name, unsigned int flags,
res = calloc (1, sizeof (nis_result)); res = calloc (1, sizeof (nis_result));
if (res == NULL || ibreq->ibr_name == NULL) if (res == NULL || ibreq->ibr_name == NULL)
{ {
if (res)
free (res); free (res);
nis_free_request (ibreq); nis_free_request (ibreq);
if (have_tablepath) if (have_tablepath)
@ -364,6 +381,12 @@ nis_list (const_nis_name name, unsigned int flags,
} }
else else
ibreq->ibr_name = strdup (ibreq->ibr_name); ibreq->ibr_name = strdup (ibreq->ibr_name);
if (ibreq->ibr_name == NULL)
{
nis_free_request (ibreq);
NIS_RES_STATUS (res) = NIS_NOMEMORY;
return res;
}
} }
} }
break; break;
@ -394,9 +417,10 @@ nis_list (const_nis_name name, unsigned int flags,
if (!first_try) if (!first_try)
{ {
/* Try the next domainname if we don't follow a link. */ /* Try the next domainname if we don't follow a link. */
free (ibreq->ibr_name);
ibreq->ibr_name = NULL;
if (count_links) if (count_links)
{ {
free (ibreq->ibr_name);
NIS_RES_STATUS (res) = NIS_LINKNAMEERROR; NIS_RES_STATUS (res) = NIS_LINKNAMEERROR;
++done; ++done;
break; break;
@ -407,7 +431,13 @@ nis_list (const_nis_name name, unsigned int flags,
++done; ++done;
break; break;
} }
ibreq->ibr_name = names[name_nr]; ibreq->ibr_name = strdup (names[name_nr]);
if (ibreq->ibr_name == NULL)
{
nis_free_request (ibreq);
NIS_RES_STATUS (res) = NIS_NOMEMORY;
return res;
}
first_try = 1; /* Try old binding at first */ first_try = 1; /* Try old binding at first */
goto again; goto again;
} }

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1997, 1998, 2001, 2002 Free Software Foundation, Inc. /* Copyright (C) 1997, 1998, 2001, 2002, 2003 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997. Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
@ -167,12 +167,20 @@ internal_setaliasent (void)
next_entry = 0; next_entry = 0;
result = nis_list (tablename_val, FOLLOW_PATH | FOLLOW_LINKS, NULL, NULL); result = nis_list (tablename_val, FOLLOW_PATH | FOLLOW_LINKS, NULL, NULL);
if (result == NULL)
{
status = NSS_STATUS_TRYAGAIN;
__set_errno (ENOMEM);
}
else
{
status = niserr2nss (result->status); status = niserr2nss (result->status);
if (status != NSS_STATUS_SUCCESS) if (status != NSS_STATUS_SUCCESS)
{ {
nis_freeresult (result); nis_freeresult (result);
result = NULL; result = NULL;
} }
}
return status; return status;
} }
@ -280,6 +288,11 @@ _nss_nisplus_getaliasbyname_r (const char *name, struct aliasent *alias,
result = nis_list (buf, FOLLOW_PATH | FOLLOW_LINKS, NULL, NULL); result = nis_list (buf, FOLLOW_PATH | FOLLOW_LINKS, NULL, NULL);
if (result == NULL)
{
*errnop = ENOMEM;
return NSS_STATUS_TRYAGAIN;
}
if (niserr2nss (result->status) != NSS_STATUS_SUCCESS) if (niserr2nss (result->status) != NSS_STATUS_SUCCESS)
return niserr2nss (result->status); return niserr2nss (result->status);

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1997, 1998, 2000, 2001, 2002 Free Software Foundation, Inc. /* Copyright (C) 1997,1998,2000,2001,2002,2003 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@suse.de>, 1997. Contributed by Thorsten Kukuk <kukuk@suse.de>, 1997.
@ -237,6 +237,11 @@ _nss_nisplus_gethostton_r (const char *name, struct etherent *eth,
result = nis_list (buf, FOLLOW_PATH | FOLLOW_LINKS, NULL, NULL); result = nis_list (buf, FOLLOW_PATH | FOLLOW_LINKS, NULL, NULL);
if (result == NULL)
{
*errnop = ENOMEM;
return NSS_STATUS_TRYAGAIN;
}
if (niserr2nss (result->status) != NSS_STATUS_SUCCESS) if (niserr2nss (result->status) != NSS_STATUS_SUCCESS)
{ {
enum nss_status status = niserr2nss (result->status); enum nss_status status = niserr2nss (result->status);
@ -294,6 +299,11 @@ _nss_nisplus_getntohost_r (const struct ether_addr *addr,
result = nis_list (buf, FOLLOW_PATH | FOLLOW_LINKS, NULL, NULL); result = nis_list (buf, FOLLOW_PATH | FOLLOW_LINKS, NULL, NULL);
if (result == NULL)
{
*errnop = ENOMEM;
return NSS_STATUS_TRYAGAIN;
}
if (niserr2nss (result->status) != NSS_STATUS_SUCCESS) if (niserr2nss (result->status) != NSS_STATUS_SUCCESS)
{ {
enum nss_status status = niserr2nss (result->status); enum nss_status status = niserr2nss (result->status);

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1997, 2001, 2002 Free Software Foundation, Inc. /* Copyright (C) 1997, 2001, 2002, 2003 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997. Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
@ -72,12 +72,20 @@ internal_setgrent (void)
return NSS_STATUS_UNAVAIL; return NSS_STATUS_UNAVAIL;
result = nis_list (tablename_val, FOLLOW_LINKS | FOLLOW_PATH, NULL, NULL); result = nis_list (tablename_val, FOLLOW_LINKS | FOLLOW_PATH, NULL, NULL);
if (result == NULL)
{
status = NSS_STATUS_TRYAGAIN;
__set_errno (ENOMEM);
}
else
{
status = niserr2nss (result->status); status = niserr2nss (result->status);
if (status != NSS_STATUS_SUCCESS) if (status != NSS_STATUS_SUCCESS)
{ {
nis_freeresult (result); nis_freeresult (result);
result = NULL; result = NULL;
} }
}
return status; return status;
} }
@ -186,6 +194,11 @@ _nss_nisplus_getgrnam_r (const char *name, struct group *gr,
result = nis_list (buf, FOLLOW_LINKS | FOLLOW_PATH, NULL, NULL); result = nis_list (buf, FOLLOW_LINKS | FOLLOW_PATH, NULL, NULL);
if (result == NULL)
{
*errnop = ENOMEM;
return NSS_STATUS_TRYAGAIN;
}
if (niserr2nss (result->status) != NSS_STATUS_SUCCESS) if (niserr2nss (result->status) != NSS_STATUS_SUCCESS)
{ {
enum nss_status status = niserr2nss (result->status); enum nss_status status = niserr2nss (result->status);
@ -236,6 +249,11 @@ _nss_nisplus_getgrgid_r (const gid_t gid, struct group *gr,
result = nis_list (buf, FOLLOW_PATH | FOLLOW_LINKS, NULL, NULL); result = nis_list (buf, FOLLOW_PATH | FOLLOW_LINKS, NULL, NULL);
if (result == NULL)
{
*errnop = ENOMEM;
return NSS_STATUS_TRYAGAIN;
}
if (niserr2nss (result->status) != NSS_STATUS_SUCCESS) if (niserr2nss (result->status) != NSS_STATUS_SUCCESS)
{ {
enum nss_status status = niserr2nss (result->status); enum nss_status status = niserr2nss (result->status);

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1997,1998,1999,2000,2001,2002 Free Software Foundation, Inc. /* Copyright (C) 1997-2002, 2003 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@suse.de>, 1997. Contributed by Thorsten Kukuk <kukuk@suse.de>, 1997.
@ -361,9 +361,12 @@ internal_gethostbyname2_r (const char *name, int af, struct hostent *host,
sprintf (buf, "[name=%s],%s", name, tablename_val); sprintf (buf, "[name=%s],%s", name, tablename_val);
result = nis_list (buf, FOLLOW_PATH | FOLLOW_LINKS, NULL, NULL); result = nis_list (buf, FOLLOW_PATH | FOLLOW_LINKS, NULL, NULL);
if (result != NULL)
{
/* If we do not find it, try it as original name. But if the /* If we do not find it, try it as original name. But if the
database is correct, we should find it in the first case, too */ database is correct, we should find it in the first case, too */
if ((result->status != NIS_SUCCESS && result->status != NIS_S_SUCCESS) if ((result->status != NIS_SUCCESS
&& result->status != NIS_S_SUCCESS)
|| __type_of (result->objects.objects_val) != NIS_ENTRY_OBJ || __type_of (result->objects.objects_val) != NIS_ENTRY_OBJ
|| strcmp (result->objects.objects_val->EN_data.en_type, || strcmp (result->objects.objects_val->EN_data.en_type,
"hosts_tbl") != 0 "hosts_tbl") != 0
@ -375,7 +378,13 @@ internal_gethostbyname2_r (const char *name, int af, struct hostent *host,
nis_freeresult (result); nis_freeresult (result);
result = nis_list (buf, FOLLOW_PATH | FOLLOW_LINKS, NULL, NULL); result = nis_list (buf, FOLLOW_PATH | FOLLOW_LINKS, NULL, NULL);
}
if (result == NULL)
{
*errnop = ENOMEM;
return NSS_STATUS_TRYAGAIN;
}
retval = niserr2nss (result->status); retval = niserr2nss (result->status);
if (retval != NSS_STATUS_SUCCESS) if (retval != NSS_STATUS_SUCCESS)
{ {
@ -479,6 +488,11 @@ _nss_nisplus_gethostbyaddr_r (const void *addr, socklen_t addrlen, int af,
inet_ntoa (*(const struct in_addr *) addr), tablename_val); inet_ntoa (*(const struct in_addr *) addr), tablename_val);
result = nis_list (buf, FOLLOW_PATH | FOLLOW_LINKS, NULL, NULL); result = nis_list (buf, FOLLOW_PATH | FOLLOW_LINKS, NULL, NULL);
if (result == NULL)
{
__set_errno (ENOMEM);
return NSS_STATUS_TRYAGAIN;
}
retval = niserr2nss (result->status); retval = niserr2nss (result->status);
if (retval != NSS_STATUS_SUCCESS) if (retval != NSS_STATUS_SUCCESS)
{ {

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1997 Free Software Foundation, Inc. /* Copyright (C) 1997, 2003 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997. Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
@ -153,7 +153,12 @@ _nss_nisplus_setnetgrent (const char *group, struct __netgrent *dummy)
data = nis_list (buf, EXPAND_NAME, NULL, NULL); data = nis_list (buf, EXPAND_NAME, NULL, NULL);
if (niserr2nss (data->status) != NSS_STATUS_SUCCESS) if (data == NULL)
{
__set_errno (ENOMEM);
status = NSS_STATUS_TRYAGAIN;
}
else if (niserr2nss (data->status) != NSS_STATUS_SUCCESS)
{ {
status = niserr2nss (data->status); status = niserr2nss (data->status);
nis_freeresult (data); nis_freeresult (data);

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1997, 1998, 2000, 2001, 2002 Free Software Foundation, Inc. /* Copyright (C) 1997,1998,2000,2001,2002,2003 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997. Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
@ -319,13 +319,17 @@ _nss_nisplus_getnetbyname_r (const char *name, struct netent *network,
sprintf (buf, "[name=%s],%s", name, tablename_val); sprintf (buf, "[name=%s],%s", name, tablename_val);
result = nis_list (buf, FOLLOW_LINKS | FOLLOW_PATH, NULL, NULL); result = nis_list (buf, FOLLOW_LINKS | FOLLOW_PATH, NULL, NULL);
if (result != NULL)
{
/* If we do not find it, try it as original name. But if the /* If we do not find it, try it as original name. But if the
database is correct, we should find it in the first case, too */ database is correct, we should find it in the first case, too */
if ((result->status != NIS_SUCCESS && result->status != NIS_S_SUCCESS) if ((result->status != NIS_SUCCESS
&& result->status != NIS_S_SUCCESS)
|| __type_of (result->objects.objects_val) != NIS_ENTRY_OBJ || __type_of (result->objects.objects_val) != NIS_ENTRY_OBJ
|| strcmp (result->objects.objects_val[0].EN_data.en_type, || strcmp (result->objects.objects_val[0].EN_data.en_type,
"networks_tbl") != 0 "networks_tbl") != 0
|| result->objects.objects_val[0].EN_data.en_cols.en_cols_len < 3) || (result->objects.objects_val[0].EN_data.en_cols.en_cols_len
< 3))
sprintf (buf, "[cname=%s],%s", name, tablename_val); sprintf (buf, "[cname=%s],%s", name, tablename_val);
else else
sprintf (buf, "[cname=%s],%s", NISENTRYVAL (0, 0, result), sprintf (buf, "[cname=%s],%s", NISENTRYVAL (0, 0, result),
@ -333,7 +337,13 @@ _nss_nisplus_getnetbyname_r (const char *name, struct netent *network,
nis_freeresult (result); nis_freeresult (result);
result = nis_list (buf, FOLLOW_LINKS | FOLLOW_PATH, NULL, NULL); result = nis_list (buf, FOLLOW_LINKS | FOLLOW_PATH, NULL, NULL);
}
if (result == NULL)
{
__set_errno (ENOMEM);
return NSS_STATUS_TRYAGAIN;
}
retval = niserr2nss (result->status); retval = niserr2nss (result->status);
if (retval != NSS_STATUS_SUCCESS) if (retval != NSS_STATUS_SUCCESS)
{ {
@ -402,6 +412,11 @@ _nss_nisplus_getnetbyaddr_r (uint32_t addr, const int type,
sprintf (buf, "[addr=%s],%s", buf2, tablename_val); sprintf (buf, "[addr=%s],%s", buf2, tablename_val);
result = nis_list (buf, EXPAND_NAME, NULL, NULL); result = nis_list (buf, EXPAND_NAME, NULL, NULL);
if (result == NULL)
{
__set_errno (ENOMEM);
return NSS_STATUS_TRYAGAIN;
}
retval = niserr2nss (result->status); retval = niserr2nss (result->status);
if (retval != NSS_STATUS_SUCCESS) if (retval != NSS_STATUS_SUCCESS)
{ {

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1997, 1998, 2001, 2002 Free Software Foundation, Inc. /* Copyright (C) 1997, 1998, 2001, 2002, 2003 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997. Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
@ -296,9 +296,12 @@ _nss_nisplus_getprotobyname_r (const char *name, struct protoent *proto,
sprintf (buf, "[name=%s],%s", name, tablename_val); sprintf (buf, "[name=%s],%s", name, tablename_val);
result = nis_list (buf, FOLLOW_PATH | FOLLOW_LINKS, NULL, NULL); result = nis_list (buf, FOLLOW_PATH | FOLLOW_LINKS, NULL, NULL);
if (result != NULL)
{
/* If we do not find it, try it as original name. But if the /* If we do not find it, try it as original name. But if the
database is correct, we should find it in the first case, too */ database is correct, we should find it in the first case, too */
if ((result->status != NIS_SUCCESS && result->status != NIS_S_SUCCESS) if ((result->status != NIS_SUCCESS
&& result->status != NIS_S_SUCCESS)
|| __type_of (result->objects.objects_val) != NIS_ENTRY_OBJ || __type_of (result->objects.objects_val) != NIS_ENTRY_OBJ
|| strcmp (result->objects.objects_val->EN_data.en_type, || strcmp (result->objects.objects_val->EN_data.en_type,
"protocols_tbl") != 0 "protocols_tbl") != 0
@ -310,7 +313,13 @@ _nss_nisplus_getprotobyname_r (const char *name, struct protoent *proto,
nis_freeresult (result); nis_freeresult (result);
result = nis_list (buf, FOLLOW_PATH | FOLLOW_LINKS, NULL, NULL); result = nis_list (buf, FOLLOW_PATH | FOLLOW_LINKS, NULL, NULL);
}
if (result == NULL)
{
__set_errno (ENOMEM);
return NSS_STATUS_TRYAGAIN;
}
if (niserr2nss (result->status) != NSS_STATUS_SUCCESS) if (niserr2nss (result->status) != NSS_STATUS_SUCCESS)
{ {
enum nss_status status = niserr2nss (result->status); enum nss_status status = niserr2nss (result->status);
@ -365,6 +374,11 @@ _nss_nisplus_getprotobynumber_r (const int number, struct protoent *proto,
result = nis_list (buf, FOLLOW_LINKS | FOLLOW_PATH, NULL, NULL); result = nis_list (buf, FOLLOW_LINKS | FOLLOW_PATH, NULL, NULL);
if (result == NULL)
{
__set_errno (ENOMEM);
return NSS_STATUS_TRYAGAIN;
}
if (niserr2nss (result->status) != NSS_STATUS_SUCCESS) if (niserr2nss (result->status) != NSS_STATUS_SUCCESS)
{ {
enum nss_status status = niserr2nss (result->status); enum nss_status status = niserr2nss (result->status);

View File

@ -1,4 +1,4 @@
/* Copyright (c) 1997, 1999, 2001 Free Software Foundation, Inc. /* Copyright (c) 1997, 1999, 2001, 2003 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@suse.de>, 1997. Contributed by Thorsten Kukuk <kukuk@suse.de>, 1997.
@ -74,6 +74,11 @@ _nss_nisplus_getpublickey (const char *netname, char *pkey, int *errnop)
res = nis_list (buf, USE_DGRAM+NO_AUTHINFO+FOLLOW_LINKS+FOLLOW_PATH, res = nis_list (buf, USE_DGRAM+NO_AUTHINFO+FOLLOW_LINKS+FOLLOW_PATH,
NULL, NULL); NULL, NULL);
if (res == NULL)
{
*errnop = ENOMEM;
return NSS_STATUS_TRYAGAIN;
}
retval = niserr2nss (res->status); retval = niserr2nss (res->status);
if (retval != NSS_STATUS_SUCCESS) if (retval != NSS_STATUS_SUCCESS)
@ -152,6 +157,11 @@ _nss_nisplus_getsecretkey (const char *netname, char *skey, char *passwd,
res = nis_list (buf, USE_DGRAM+NO_AUTHINFO+FOLLOW_LINKS+FOLLOW_PATH, res = nis_list (buf, USE_DGRAM+NO_AUTHINFO+FOLLOW_LINKS+FOLLOW_PATH,
NULL, NULL); NULL, NULL);
if (res == NULL)
{
*errnop = ENOMEM;
return NSS_STATUS_TRYAGAIN;
}
retval = niserr2nss (res->status); retval = niserr2nss (res->status);
if (retval != NSS_STATUS_SUCCESS) if (retval != NSS_STATUS_SUCCESS)
@ -269,6 +279,11 @@ _nss_nisplus_netname2user (char netname[MAXNETNAMELEN + 1], uid_t *uidp,
/* XXX but we cant, for now. XXX */ /* XXX but we cant, for now. XXX */
res = nis_list (sname, USE_DGRAM+NO_AUTHINFO+FOLLOW_LINKS+FOLLOW_PATH, res = nis_list (sname, USE_DGRAM+NO_AUTHINFO+FOLLOW_LINKS+FOLLOW_PATH,
NULL, NULL); NULL, NULL);
if (res == NULL)
{
*errnop = ENOMEM;
return NSS_STATUS_TRYAGAIN;
}
switch (res->status) switch (res->status)
{ {
case NIS_SUCCESS: case NIS_SUCCESS:
@ -337,6 +352,11 @@ _nss_nisplus_netname2user (char netname[MAXNETNAMELEN + 1], uid_t *uidp,
/* XXX but we cant, for now. XXX */ /* XXX but we cant, for now. XXX */
res = nis_list (sname, USE_DGRAM+NO_AUTHINFO+FOLLOW_LINKS+FOLLOW_PATH, res = nis_list (sname, USE_DGRAM+NO_AUTHINFO+FOLLOW_LINKS+FOLLOW_PATH,
NULL, NULL); NULL, NULL);
if (res == NULL)
{
*errnop = ENOMEM;
return NSS_STATUS_TRYAGAIN;
}
switch(res->status) switch(res->status)
{ {
case NIS_NOTFOUND: case NIS_NOTFOUND:

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1997, 1999, 2001, 2002 Free Software Foundation, Inc. /* Copyright (C) 1997, 1999, 2001, 2002, 2003 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997. Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
@ -192,6 +192,11 @@ _nss_nisplus_getpwnam_r (const char *name, struct passwd *pw,
result = nis_list(buf, FOLLOW_PATH | FOLLOW_LINKS, NULL, NULL); result = nis_list(buf, FOLLOW_PATH | FOLLOW_LINKS, NULL, NULL);
if (result == NULL)
{
*errnop = ENOMEM;
return NSS_STATUS_TRYAGAIN;
}
if (niserr2nss (result->status) != NSS_STATUS_SUCCESS) if (niserr2nss (result->status) != NSS_STATUS_SUCCESS)
{ {
enum nss_status status = niserr2nss (result->status); enum nss_status status = niserr2nss (result->status);
@ -246,6 +251,11 @@ _nss_nisplus_getpwuid_r (const uid_t uid, struct passwd *pw,
result = nis_list(buf, FOLLOW_PATH | FOLLOW_LINKS, NULL, NULL); result = nis_list(buf, FOLLOW_PATH | FOLLOW_LINKS, NULL, NULL);
if (result == NULL)
{
*errnop = ENOMEM;
return NSS_STATUS_TRYAGAIN;
}
if (niserr2nss (result->status) != NSS_STATUS_SUCCESS) if (niserr2nss (result->status) != NSS_STATUS_SUCCESS)
{ {
enum nss_status status = niserr2nss (result->status); enum nss_status status = niserr2nss (result->status);

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1997, 1998, 2001, 2002 Free Software Foundation, Inc. /* Copyright (C) 1997, 1998, 2001, 2002, 2003 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997. Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
@ -290,9 +290,12 @@ _nss_nisplus_getrpcbyname_r (const char *name, struct rpcent *rpc,
sprintf (buf, "[name=%s],%s", name, tablename_val); sprintf (buf, "[name=%s],%s", name, tablename_val);
result = nis_list (buf, FOLLOW_PATH | FOLLOW_LINKS, NULL, NULL); result = nis_list (buf, FOLLOW_PATH | FOLLOW_LINKS, NULL, NULL);
if (result != NULL)
{
/* If we do not find it, try it as original name. But if the /* If we do not find it, try it as original name. But if the
database is correct, we should find it in the first case, too */ database is correct, we should find it in the first case, too */
if ((result->status != NIS_SUCCESS && result->status != NIS_S_SUCCESS) if ((result->status != NIS_SUCCESS
&& result->status != NIS_S_SUCCESS)
|| __type_of (result->objects.objects_val) != NIS_ENTRY_OBJ || __type_of (result->objects.objects_val) != NIS_ENTRY_OBJ
|| strcmp (result->objects.objects_val->EN_data.en_type, || strcmp (result->objects.objects_val->EN_data.en_type,
"rpc_tbl") != 0 "rpc_tbl") != 0
@ -304,7 +307,13 @@ _nss_nisplus_getrpcbyname_r (const char *name, struct rpcent *rpc,
nis_freeresult (result); nis_freeresult (result);
result = nis_list (buf, FOLLOW_PATH | FOLLOW_LINKS , NULL, NULL); result = nis_list (buf, FOLLOW_PATH | FOLLOW_LINKS , NULL, NULL);
}
if (result == NULL)
{
*errnop = ENOMEM;
return NSS_STATUS_TRYAGAIN;
}
if (niserr2nss (result->status) != NSS_STATUS_SUCCESS) if (niserr2nss (result->status) != NSS_STATUS_SUCCESS)
{ {
enum nss_status status = niserr2nss (result->status); enum nss_status status = niserr2nss (result->status);
@ -357,6 +366,11 @@ _nss_nisplus_getrpcbynumber_r (const int number, struct rpcent *rpc,
result = nis_list(buf, FOLLOW_LINKS | FOLLOW_PATH, NULL, NULL); result = nis_list(buf, FOLLOW_LINKS | FOLLOW_PATH, NULL, NULL);
if (result == NULL)
{
*errnop = ENOMEM;
return NSS_STATUS_TRYAGAIN;
}
if (niserr2nss (result->status) != NSS_STATUS_SUCCESS) if (niserr2nss (result->status) != NSS_STATUS_SUCCESS)
{ {
enum nss_status status = niserr2nss (result->status); enum nss_status status = niserr2nss (result->status);

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1997, 1998, 1999, 2001, 2002 Free Software Foundation, Inc. /* Copyright (C) 1997,1998,1999,2001,2002,2003 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@suse.de>, 1997. Contributed by Thorsten Kukuk <kukuk@suse.de>, 1997.
@ -305,9 +305,12 @@ _nss_nisplus_getservbyname_r (const char *name, const char *protocol,
tablename_val); tablename_val);
result = nis_list (buf, FOLLOW_PATH | FOLLOW_LINKS, NULL, NULL); result = nis_list (buf, FOLLOW_PATH | FOLLOW_LINKS, NULL, NULL);
if (result != NULL)
{
/* If we do not find it, try it as original name. But if the /* If we do not find it, try it as original name. But if the
database is correct, we should find it in the first case, too */ database is correct, we should find it in the first case, too */
if ((result->status != NIS_SUCCESS && result->status != NIS_S_SUCCESS) if ((result->status != NIS_SUCCESS
&& result->status != NIS_S_SUCCESS)
|| __type_of (result->objects.objects_val) != NIS_ENTRY_OBJ || __type_of (result->objects.objects_val) != NIS_ENTRY_OBJ
|| strcmp (result->objects.objects_val->EN_data.en_type, || strcmp (result->objects.objects_val->EN_data.en_type,
"services_tbl") != 0 "services_tbl") != 0
@ -320,7 +323,13 @@ _nss_nisplus_getservbyname_r (const char *name, const char *protocol,
nis_freeresult (result); nis_freeresult (result);
result = nis_list (buf, FOLLOW_PATH | FOLLOW_LINKS, NULL, NULL); result = nis_list (buf, FOLLOW_PATH | FOLLOW_LINKS, NULL, NULL);
}
if (result == NULL)
{
*errnop = ENOMEM;
return NSS_STATUS_TRYAGAIN;
}
if (niserr2nss (result->status) != NSS_STATUS_SUCCESS) if (niserr2nss (result->status) != NSS_STATUS_SUCCESS)
{ {
enum nss_status status = niserr2nss (result->status); enum nss_status status = niserr2nss (result->status);
@ -382,6 +391,11 @@ _nss_nisplus_getservbyport_r (const int number, const char *protocol,
result = nis_list (buf, FOLLOW_PATH | FOLLOW_LINKS, NULL, NULL); result = nis_list (buf, FOLLOW_PATH | FOLLOW_LINKS, NULL, NULL);
if (result == NULL)
{
*errnop = ENOMEM;
return NSS_STATUS_TRYAGAIN;
}
if (niserr2nss (result->status) != NSS_STATUS_SUCCESS) if (niserr2nss (result->status) != NSS_STATUS_SUCCESS)
{ {
enum nss_status status = niserr2nss (result->status); enum nss_status status = niserr2nss (result->status);

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1997, 2001, 2002 Free Software Foundation, Inc. /* Copyright (C) 1997, 2001, 2002, 2003 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997. Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
@ -192,6 +192,11 @@ _nss_nisplus_getspnam_r (const char *name, struct spwd *sp,
result = nis_list (buf, FOLLOW_PATH | FOLLOW_LINKS, NULL, NULL); result = nis_list (buf, FOLLOW_PATH | FOLLOW_LINKS, NULL, NULL);
if (result == NULL)
{
*errnop = ENOMEM;
return NSS_STATUS_TRYAGAIN;
}
if (niserr2nss (result->status) != NSS_STATUS_SUCCESS) if (niserr2nss (result->status) != NSS_STATUS_SUCCESS)
{ {
enum nss_status status = niserr2nss (result->status); enum nss_status status = niserr2nss (result->status);