aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1999-05-16 10:14:25 +0000
committerUlrich Drepper <drepper@redhat.com>1999-05-16 10:14:25 +0000
commit32abdb710c9335481da780eab5ad790318d2fadf (patch)
tree70c94809f5ec43a895c614a445a32f4d18d925c5
parent7d853c902b9f79a32c8c1921b16107648c15f0e3 (diff)
downloadglibc-32abdb710c9335481da780eab5ad790318d2fadf.tar
glibc-32abdb710c9335481da780eab5ad790318d2fadf.tar.gz
glibc-32abdb710c9335481da780eab5ad790318d2fadf.tar.bz2
glibc-32abdb710c9335481da780eab5ad790318d2fadf.zip
Update.
1999-05-16 Thorsten Kukuk <kukuk@suse.de> * sunrpc/etc.rpc: Add portmapper, rstat_svc and pcnfs. * sunrpc/key_call.c: Fix memory leak, close file handle. * nis/nis_creategroup.c: Use malloc instead of calloc, set ctime and mtime. * nis/nis_subr.c: Check for realloc result. * nis/nis_file.c: Fix memory leak. * nis/nis_table.c: Pretty print. * nis/nis_getservlist.c: Likewise. * nis/nis_ismember.c: Likewise. * nis/nis_lookup.c: Likewise. * nis/nis_ping.c: Likewise. * nis/nis_removemember.c: Likewise. * nis/nis_util.c: Likewise, check calloc result.
-rw-r--r--ChangeLog16
-rw-r--r--nis/nis_file.c14
-rw-r--r--nis/nis_getservlist.c15
-rw-r--r--nis/nis_ismember.c51
-rw-r--r--nis/nis_lookup.c10
-rw-r--r--nis/nis_ping.c12
-rw-r--r--nis/nis_removemember.c22
-rw-r--r--nis/nis_subr.c47
-rw-r--r--nis/nis_table.c57
-rw-r--r--nis/nis_util.c8
-rw-r--r--sunrpc/etc.rpc8
-rw-r--r--sunrpc/key_call.c9
12 files changed, 167 insertions, 102 deletions
diff --git a/ChangeLog b/ChangeLog
index ffba81c694..d63f1ac49f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+1999-05-16 Thorsten Kukuk <kukuk@suse.de>
+
+ * sunrpc/etc.rpc: Add portmapper, rstat_svc and pcnfs.
+ * sunrpc/key_call.c: Fix memory leak, close file handle.
+ * nis/nis_creategroup.c: Use malloc instead of calloc,
+ set ctime and mtime.
+ * nis/nis_subr.c: Check for realloc result.
+ * nis/nis_file.c: Fix memory leak.
+ * nis/nis_table.c: Pretty print.
+ * nis/nis_getservlist.c: Likewise.
+ * nis/nis_ismember.c: Likewise.
+ * nis/nis_lookup.c: Likewise.
+ * nis/nis_ping.c: Likewise.
+ * nis/nis_removemember.c: Likewise.
+ * nis/nis_util.c: Likewise, check calloc result.
+
1999-05-16 Roland McGrath <roland@baalperazim.frob.com>
* sysdeps/unix/sysv/linux/sys/socketvar.h: Moved to ...
diff --git a/nis/nis_file.c b/nis/nis_file.c
index 8d652c30e5..13dbed8ef6 100644
--- a/nis/nis_file.c
+++ b/nis/nis_file.c
@@ -1,6 +1,6 @@
/* Copyright (c) 1997, 1998, 1999 Free Software Foundation, Inc.
This file is part of the GNU C Library.
- Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
+ Contributed by Thorsten Kukuk <kukuk@suse.de>, 1997.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
@@ -82,15 +82,19 @@ nis_read_obj (const char *name)
XDR xdrs;
FILE *in;
bool_t status;
- nis_object *obj = calloc (1, sizeof (nis_object));
-
- if (obj == NULL)
- return NULL;
+ nis_object *obj;
in = fopen (name, "rb");
if (in == NULL)
return NULL;
+ obj = calloc (1, sizeof (nis_object));
+ if (obj == NULL)
+ {
+ fclose (in);
+ return NULL;
+ }
+
xdrstdio_create (&xdrs, in, XDR_DECODE);
status =_xdr_nis_object (&xdrs, obj);
xdr_destroy (&xdrs);
diff --git a/nis/nis_getservlist.c b/nis/nis_getservlist.c
index a6f43f880d..5d93f38d9a 100644
--- a/nis/nis_getservlist.c
+++ b/nis/nis_getservlist.c
@@ -31,7 +31,7 @@ nis_getservlist (const_nis_name dir)
res = nis_lookup (dir, FOLLOW_LINKS);
- if (NIS_RES_STATUS (res) == NIS_SUCCESS)
+ if (res != NULL && NIS_RES_STATUS (res) == NIS_SUCCESS)
{
unsigned long i;
nis_server *server;
@@ -41,6 +41,7 @@ nis_getservlist (const_nis_name dir)
(NIS_RES_OBJECT (res)->DI_data.do_servers.do_servers_len + 1));
if (serv == NULL)
return NULL;
+
for (i = 0; i < NIS_RES_OBJECT (res)->DI_data.do_servers.do_servers_len;
++i)
{
@@ -48,7 +49,11 @@ nis_getservlist (const_nis_name dir)
&NIS_RES_OBJECT (res)->DI_data.do_servers.do_servers_val[i];
serv[i] = calloc (1, sizeof (nis_server));
if (server->name != NULL)
- serv[i]->name = strdup (server->name);
+ {
+ serv[i]->name = strdup (server->name);
+ if (serv[i]->name == NULL)
+ return NULL;
+ }
serv[i]->ep.ep_len = server->ep.ep_len;
if (serv[i]->ep.ep_len > 0)
@@ -96,8 +101,6 @@ nis_getservlist (const_nis_name dir)
serv[i]->pkey.n_bytes = NULL;
}
serv[i] = NULL;
-
- nis_freeresult (res);
}
else
{
@@ -105,6 +108,10 @@ nis_getservlist (const_nis_name dir)
if (serv != NULL)
serv[0] = NULL;
}
+
+ if (res != NULL)
+ nis_freeresult (res);
+
return serv;
}
diff --git a/nis/nis_ismember.c b/nis/nis_ismember.c
index 4a33f02cff..7580ee8c8e 100644
--- a/nis/nis_ismember.c
+++ b/nis/nis_ismember.c
@@ -1,6 +1,6 @@
-/* Copyright (c) 1997, 1998 Free Software Foundation, Inc.
+/* Copyright (c) 1997, 1998, 1999 Free Software Foundation, Inc.
This file is part of the GNU C Library.
- Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
+ Contributed by Thorsten Kukuk <kukuk@suse.de>, 1997.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
@@ -43,13 +43,21 @@ internal_ismember (const_nis_name principal, const_nis_name group)
*cp++ = '.';
strcpy (cp, cp2);
}
+
res = nis_lookup (buf, EXPAND_NAME|FOLLOW_LINKS);
- if (NIS_RES_STATUS (res) != NIS_SUCCESS)
- return 0;
+ if (res == NULL || NIS_RES_STATUS (res) != NIS_SUCCESS)
+ {
+ if (res)
+ nis_freeresult (res);
+ return 0;
+ }
if ((NIS_RES_NUMOBJ (res) != 1) ||
(__type_of (NIS_RES_OBJECT (res)) != NIS_GROUP_OBJ))
- return 0;
+ {
+ nis_freeresult (res);
+ return 0;
+ }
/* We search twice in the list, at first, if we have the name
with a "-", then if without. "-member" has priority */
@@ -59,14 +67,19 @@ internal_ismember (const_nis_name principal, const_nis_name group)
if (cp[0] == '-')
{
if (strcmp (&cp[1], principal) == 0)
- return -1;
+ {
+ nis_freeresult (res);
+ return -1;
+ }
if (cp[1] == '@')
switch (internal_ismember (principal, &cp[2]))
{
case -1:
+ nis_freeresult (res);
return -1;
case 1:
- return -1;
+ nis_freeresult (res);
+ return 1;
default:
break;
}
@@ -76,26 +89,34 @@ internal_ismember (const_nis_name principal, const_nis_name group)
char buf1[strlen (principal) + 2];
char buf2[strlen (cp) + 2];
- strcpy (buf1, nis_domain_of (principal));
- strcpy (buf2, nis_domain_of (cp));
- if (strcmp (buf1, buf2) == 0)
- return -1;
+ if (strcmp (nis_domain_of_r (principal, buf1, sizeof buf1),
+ nis_domain_of_r (cp, buf2, sizeof buf2)) == 0)
+ {
+ nis_freeresult (res);
+ return -1;
+ }
}
}
}
+
for (i = 0; i < NIS_RES_OBJECT (res)->GR_data.gr_members.gr_members_len; ++i)
{
cp = NIS_RES_OBJECT (res)->GR_data.gr_members.gr_members_val[i];
if (cp[0] != '-')
{
if (strcmp (cp, principal) == 0)
- return 1;
+ {
+ nis_freeresult (res);
+ return 1;
+ }
if (cp[0] == '@')
switch (internal_ismember (principal, &cp[1]))
{
case -1:
+ nis_freeresult (res);
return -1;
case 1:
+ nis_freeresult (res);
return 1;
default:
break;
@@ -108,10 +129,14 @@ internal_ismember (const_nis_name principal, const_nis_name group)
if (strcmp (nis_domain_of_r (principal, buf1, sizeof buf1),
nis_domain_of_r (cp, buf2, sizeof buf2)) == 0)
- return 1;
+ {
+ nis_freeresult (res);
+ return 1;
+ }
}
}
}
+ nis_freeresult (res);
return 0;
}
diff --git a/nis/nis_lookup.c b/nis/nis_lookup.c
index 4eed61ecdc..cdc5b3f1f9 100644
--- a/nis/nis_lookup.c
+++ b/nis/nis_lookup.c
@@ -121,14 +121,14 @@ nis_lookup (const_nis_name name, const unsigned int flags)
++count_links;
req.ns_name =
strdup (NIS_RES_OBJECT (res)->LI_data.li_name);
+ if (req.ns_name == NULL)
+ return NULL;
+
nis_freeresult (res);
res = calloc (1, sizeof (nis_result));
if (res == NULL)
- {
- __nisbind_destroy (&bptr);
- nis_free_directory (dir);
- return NULL;
- }
+ return NULL;
+
link_first_try = 1; /* Try at first the old binding */
goto again;
}
diff --git a/nis/nis_ping.c b/nis/nis_ping.c
index bc6db38e93..7e20716173 100644
--- a/nis/nis_ping.c
+++ b/nis/nis_ping.c
@@ -1,6 +1,6 @@
-/* Copyright (c) 1997, 1998 Free Software Foundation, Inc.
+/* Copyright (c) 1997, 1998, 1999 Free Software Foundation, Inc.
This file is part of the GNU C Library.
- Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
+ Contributed by Thorsten Kukuk <kukuk@suse.de>, 1997.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
@@ -37,8 +37,12 @@ nis_ping (const_nis_name dirname, unsigned int utime,
if (dirobj == NULL)
{
res = nis_lookup (dirname, MASTER_ONLY);
- if (NIS_RES_STATUS (res) != NIS_SUCCESS)
- return;
+ if (res == NULL || NIS_RES_STATUS (res) != NIS_SUCCESS)
+ {
+ if (res)
+ nis_freeresult (res);
+ return;
+ }
obj = res->objects.objects_val;
}
else
diff --git a/nis/nis_removemember.c b/nis/nis_removemember.c
index 4fa8893a84..2efa4cf060 100644
--- a/nis/nis_removemember.c
+++ b/nis/nis_removemember.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 1997, 1998 Free Software Foundation, Inc.
+/* Copyright (c) 1997, 1998, 1999 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
@@ -44,22 +44,31 @@ nis_removemember (const_nis_name member, const_nis_name group)
stpcpy (cp, cp2);
}
res = nis_lookup (buf, FOLLOW_LINKS|EXPAND_NAME);
- if (NIS_RES_STATUS (res) != NIS_SUCCESS)
+ if (res == NULL || NIS_RES_STATUS (res) != NIS_SUCCESS)
{
- status = NIS_RES_STATUS (res);
- nis_freeresult (res);
+ if (res)
+ {
+ status = NIS_RES_STATUS (res);
+ nis_freeresult (res);
+ }
+ else
+ return NIS_NOMEMORY;
return status;
}
if ((res->objects.objects_len != 1) ||
(__type_of (NIS_RES_OBJECT (res)) != NIS_GROUP_OBJ))
- return NIS_INVALIDOBJ;
+ {
+ nis_freeresult (res);
+ return NIS_INVALIDOBJ;
+ }
newmem =
- calloc (1, NIS_RES_OBJECT(res)->GR_data.gr_members.gr_members_len *
+ calloc (NIS_RES_OBJECT(res)->GR_data.gr_members.gr_members_len,
sizeof (char *));
if (newmem == NULL)
return NIS_NOMEMORY;
+
k = NIS_RES_OBJECT (res)[0].GR_data.gr_members.gr_members_len;
j = 0;
for (i = 0; i < NIS_RES_OBJECT(res)->GR_data.gr_members.gr_members_len;
@@ -81,6 +90,7 @@ nis_removemember (const_nis_name member, const_nis_name group)
newmem = realloc (newmem, k * sizeof (char*));
if (newmem == NULL)
return NIS_NOMEMORY;
+
NIS_RES_OBJECT (res)->GR_data.gr_members.gr_members_val = newmem;
NIS_RES_OBJECT (res)->GR_data.gr_members.gr_members_len = k;
diff --git a/nis/nis_subr.c b/nis/nis_subr.c
index 3283e4cf93..c7d58a60e9 100644
--- a/nis/nis_subr.c
+++ b/nis/nis_subr.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 1997 Free Software Foundation, Inc.
+/* Copyright (c) 1997, 1999 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
@@ -52,8 +52,8 @@ nis_leaf_of_r (const_nis_name name, char *buffer, size_t buflen)
errno = ERANGE;
return NULL;
}
- strncpy (buffer, name, i);
- buffer[i] = 0;
+
+ *((char *) __mempcpy (buffer, name, i)) = '\0';
}
return buffer;
@@ -87,8 +87,8 @@ nis_name_of_r (const_nis_name name, char *buffer, size_t buflen)
errno = ERANGE;
return NULL;
}
- memcpy (buffer, name, diff - 1);
- buffer[diff - 1] = '\0';
+
+ *((char *) __mempcpy (buffer, name, diff - 1)) = '\0';
if (diff - 1 == 0)
return NULL;
@@ -109,6 +109,9 @@ count_dots (const_nis_name str)
return count;
}
+/* If we run out of memory, we don't give already allocated memory
+ free. The overhead for bringing getnames back in a safe state to
+ free it is to big. */
nis_name *
nis_getnames (const_nis_name name)
{
@@ -116,22 +119,22 @@ nis_getnames (const_nis_name name)
char local_domain[NIS_MAXNAMELEN + 1];
char *path, *cp;
int count, pos, have_point;
+ char *saveptr;
strncpy (local_domain, nis_local_directory (), NIS_MAXNAMELEN);
local_domain[NIS_MAXNAMELEN] = '\0';
count = 1;
- if ((getnames = malloc ((count + 1) * sizeof (char *))) == NULL)
+ getnames = malloc ((count + 1) * sizeof (char *));
+ if (getnames == NULL)
return NULL;
/* Do we have a fully qualified NIS+ name ? If yes, give it back */
if (name[strlen (name) - 1] == '.')
{
if ((getnames[0] = strdup (name)) == NULL)
- {
- free (getnames);
- return NULL;
- }
+ return NULL;
+
getnames[1] = NULL;
return getnames;
@@ -148,7 +151,7 @@ nis_getnames (const_nis_name name)
pos = 0;
- cp = strtok (path, ":");
+ cp = __strtok_r (path, ":", &saveptr);
while (cp)
{
if (strcmp (cp, "$") == 0)
@@ -162,6 +165,8 @@ nis_getnames (const_nis_name name)
{
count += 5;
getnames = realloc (getnames, (count + 1) * sizeof (char *));
+ if (getnames == NULL)
+ return NULL;
}
tmp = malloc (strlen (cptr) + strlen (local_domain) +
strlen (name) + 2);
@@ -188,35 +193,35 @@ nis_getnames (const_nis_name name)
else
{
char *tmp;
+ size_t cplen = strlen (cp);
- if (cp[strlen (cp) - 1] == '$')
+ if (cp[cplen - 1] == '$')
{
char *p;
- tmp = malloc (strlen (cp) + strlen (local_domain) +
- strlen (name) + 2);
+ tmp = malloc (cplen + strlen (local_domain) + strlen (name) + 2);
if (tmp == NULL)
return NULL;
- p = stpcpy (tmp, name);
+ p = __stpcpy (tmp, name);
*p++ = '.';
- p = stpcpy (p, cp);
+ p = __mempcpy (p, cp, cplen);
--p;
if (p[-1] != '.')
*p++ = '.';
- stpcpy (p, local_domain);
+ __stpcpy (p, local_domain);
}
else
{
char *p;
- tmp = malloc (strlen (cp) + strlen (name) + 2);
+ tmp = malloc (cplen + strlen (name) + 2);
if (tmp == NULL)
return NULL;
- p = stpcpy (tmp, name);
+ p = __stpcpy (tmp, name);
*p++ = '.';
- stpcpy (p, cp);
+ memcpy (p, cp, cplen + 1);
}
if (pos >= count)
@@ -229,7 +234,7 @@ nis_getnames (const_nis_name name)
getnames[pos] = tmp;
++pos;
}
- cp = strtok (NULL, ":");
+ cp = __strtok_r (NULL, ":", &saveptr);
}
getnames[pos] = NULL;
diff --git a/nis/nis_table.c b/nis/nis_table.c
index d8e521b85b..866a7207cd 100644
--- a/nis/nis_table.c
+++ b/nis/nis_table.c
@@ -43,10 +43,7 @@ __create_ib_request (const_nis_name name, unsigned int flags)
/* Not of "[key=value,key=value,...],foo.." format? */
if (cptr[0] != '[')
- {
- ibreq->ibr_name = strdup (cptr);
- return ibreq;
- }
+ return (ibreq->ibr_name = strdup (cptr)) == NULL ? NULL : ibreq;
/* "[key=value,...],foo" format */
ibreq->ibr_name = strchr (cptr, ']');
@@ -64,6 +61,8 @@ __create_ib_request (const_nis_name name, unsigned int flags)
ibreq->ibr_name[0] = '\0';
ibreq->ibr_name += 2;
ibreq->ibr_name = strdup (ibreq->ibr_name);
+ if (ibreq->ibr_name == NULL)
+ return NULL;
++cptr; /* Remove "[" */
@@ -87,31 +86,17 @@ __create_ib_request (const_nis_name name, unsigned int flags)
size += 1;
search_val = realloc (search_val, size * sizeof (nis_attr));
if (search_val == NULL)
- {
- nis_free_request (ibreq);
- return NULL;
- }
+ return NULL;
}
search_val[search_len].zattr_ndx = strdup (key);
if ((search_val[search_len].zattr_ndx) == NULL)
- {
- /* Let nis_free_request do the job for freeing search_val */
- ibreq->ibr_srch.ibr_srch_val = search_val;
- ibreq->ibr_srch.ibr_srch_len = search_len;
- nis_free_request (ibreq);
- return NULL;
- }
+ return NULL;
+
search_val[search_len].zattr_val.zattr_val_len = strlen (val) + 1;
search_val[search_len].zattr_val.zattr_val_val = strdup (val);
if (search_val[search_len].zattr_val.zattr_val_val == NULL)
- {
- /* Let nis_free_request do the job for freeing search_val */
- search_val[search_len].zattr_val.zattr_val_len = 0;
- ibreq->ibr_srch.ibr_srch_val = search_val;
- ibreq->ibr_srch.ibr_srch_len = search_len + 1;
- nis_free_request (ibreq);
- return NULL;
- }
+ return NULL;
+
++search_len;
}
@@ -629,16 +614,19 @@ nis_first_entry (const_nis_name name)
return res;
}
- if ((ibreq =__create_ib_request (name, 0)) == NULL)
+ ibreq = __create_ib_request (name, 0);
+ if (ibreq == NULL)
{
NIS_RES_STATUS (res) = NIS_BADNAME;
return res;
}
- if ((status = __do_niscall (ibreq->ibr_name, NIS_IBFIRST,
- (xdrproc_t) _xdr_ib_request,
- (caddr_t) ibreq, (xdrproc_t) _xdr_nis_result,
- (caddr_t) res, 0, NULL)) != NIS_SUCCESS)
+ status = __do_niscall (ibreq->ibr_name, NIS_IBFIRST,
+ (xdrproc_t) _xdr_ib_request,
+ (caddr_t) ibreq, (xdrproc_t) _xdr_nis_result,
+ (caddr_t) res, 0, NULL);
+
+ if (status != NIS_SUCCESS)
NIS_RES_STATUS (res) = status;
nis_free_request (ibreq);
@@ -663,7 +651,8 @@ nis_next_entry (const_nis_name name, const netobj *cookie)
return res;
}
- if (( ibreq =__create_ib_request (name, 0)) == NULL)
+ ibreq = __create_ib_request (name, 0);
+ if (ibreq == NULL)
{
NIS_RES_STATUS (res) = NIS_BADNAME;
return res;
@@ -675,10 +664,12 @@ nis_next_entry (const_nis_name name, const netobj *cookie)
ibreq->ibr_cookie.n_len = cookie->n_len;
}
- if ((status = __do_niscall (ibreq->ibr_name, NIS_IBNEXT,
- (xdrproc_t) _xdr_ib_request,
- (caddr_t) ibreq, (xdrproc_t) _xdr_nis_result,
- (caddr_t) res, 0, NULL)) != NIS_SUCCESS)
+ status = __do_niscall (ibreq->ibr_name, NIS_IBNEXT,
+ (xdrproc_t) _xdr_ib_request,
+ (caddr_t) ibreq, (xdrproc_t) _xdr_nis_result,
+ (caddr_t) res, 0, NULL);
+
+ if (status != NIS_SUCCESS)
NIS_RES_STATUS (res) = status;
if (cookie != NULL)
diff --git a/nis/nis_util.c b/nis/nis_util.c
index 86197fcedc..f701672671 100644
--- a/nis/nis_util.c
+++ b/nis/nis_util.c
@@ -1,6 +1,6 @@
-/* Copyright (c) 1997, 1998 Free Software Foundation, Inc.
+/* Copyright (c) 1997, 1998, 1999 Free Software Foundation, Inc.
This file is part of the GNU C Library.
- Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
+ Contributed by Thorsten Kukuk <kukuk@suse.de>, 1997.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
@@ -30,9 +30,11 @@ __nis_finddirectory (directory_obj *dir, const_nis_name name)
fd_args fd_args;
fd_result *fd_res;
- fd_args.dir_name = strdup (name);
+ fd_args.dir_name = (char *)name;
fd_args.requester = nis_local_host();
fd_res = calloc (1, sizeof (fd_result));
+ if (fd_res == NULL)
+ return NULL;
status = __do_niscall2 (dir->do_servers.do_servers_val,
dir->do_servers.do_servers_len,
diff --git a/sunrpc/etc.rpc b/sunrpc/etc.rpc
index 2987459da4..a80522f4db 100644
--- a/sunrpc/etc.rpc
+++ b/sunrpc/etc.rpc
@@ -2,8 +2,8 @@
#
# rpc
#
-rpcbind 100000 portmap sunrpc rpcbind
-rstatd 100001 rstat rup perfmeter
+portmapper 100000 portmap sunrpc rpcbind
+rstatd 100001 rstat rup perfmeter rstat_svc
rusersd 100002 rusers
nfs 100003 nfsprog
ypserv 100004 ypprog
@@ -26,9 +26,9 @@ nlockmgr 100021
x25.inr 100022
statmon 100023
status 100024
+bootparam 100026
ypupdated 100028 ypupdate
keyserv 100029 keyserver
-bootparam 100026
sunlink_mapper 100033
tfsd 100037
nsed 100038
@@ -62,7 +62,7 @@ sadmind 100232
nisd 100300 rpc.nisd
nispasswd 100303 rpc.nispasswdd
ufsd 100233 ufsd
-pcnfsd 150001
+pcnfsd 150001 pcnfs
amd 300019 amq
bwnfsd 545580417
fypxfrd 600100069 freebsd-ypxfrd
diff --git a/sunrpc/key_call.c b/sunrpc/key_call.c
index 5aef933cbf..2f4ca25d94 100644
--- a/sunrpc/key_call.c
+++ b/sunrpc/key_call.c
@@ -491,7 +491,7 @@ key_call_door (u_long proc, xdrproc_t xdr_arg, char *arg,
xdrproc_t xdr_rslt, char *rslt)
{
XDR xdrs;
- int fd;
+ int fd, ret;
door_arg_t args;
char *data_ptr;
u_long data_len = 0;
@@ -525,12 +525,13 @@ key_call_door (u_long proc, xdrproc_t xdr_arg, char *arg,
args.rbuf = res;
args.rsize = sizeof (res);
- if (__door_call (fd, &args) < 0)
- return 0;
-
+ ret = __door_call (fd, &args);
free (data_ptr);
close (fd);
+ if (ret < 0)
+ return 0;
+
memcpy (&data_len, args.data_ptr, sizeof (u_long));
if (data_len != 0)
return 0;