summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1998-06-16 11:43:48 +0000
committerUlrich Drepper <drepper@redhat.com>1998-06-16 11:43:48 +0000
commit91eee4dd69397fa6e7b328022670d459f582b047 (patch)
tree85ba752cb426bcfa60e04a2d5e88efae378bfd04
parentfed8f7f7aeb06dfae0dfbfb085c6857cc457c254 (diff)
downloadglibc-91eee4dd69397fa6e7b328022670d459f582b047.tar.gz
Update.
1998-06-16 Thorsten Kukuk <kukuk@vt.uni-paderborn.de> * sunrpc/svc.c: Check for NULL pointer. * nis/libnsl.map: Add public NIS+ xdr functions. * nis/rpcsvc/nis_callback.h: New file. * nis/rpcsvc/nis.h: Move xdr_* functions from here ... * nis/nis_xdr.h: ... here. * nis/nis_add.c: Use internal _xdr_* functions, check for NULL pointers, use NIS+ defines where possible. * nis/nis_cache.c: Likewise. * nis/nis_cache2_xdr.c: Likewise. * nis/nis_call.c: Likewise. * nis/nis_checkpoint.c: Likewise. * nis/nis_clone_dir.c: Likewise. * nis/nis_clone_obj.c: Likewise. * nis/nis_clone_res.c: Likewise. * nis/nis_creategroup.c: Likewise. * nis/nis_file.c: Likewise. * nis/nis_free.c: Likewise. * nis/nis_getservlist.c: Likewise. * nis/nis_local_names.c: likewise. * nis/nis_lookup.c: Likewise. * nis/nis_mkdir.c: Likewise. * nis/nis_modify.c: Likewise. * nis/nis_ping.c: Likewise. * nis/nis_print.c: Likewise. * nis/nis_remove.c: Likewise. * nis/nis_removemember.c: Likewise. * nis/nis_rmdir.c: Likewise. * nis/nis_server.c: Likewise. * nis/nis_table.c: Likewise. * nis/nis_util.c: Likewise. * nis/nis_verifygroup.c: Likewise. * nis/nis_xdr.c: Likewise. * nis/nis_callback.c: Likewise, and move xdr functions from here ... * nis/nis_xdr.c: ... to here.
-rw-r--r--ChangeLog40
-rw-r--r--nis/libnsl.map2
-rw-r--r--nis/nis_add.c51
-rw-r--r--nis/nis_cache.c5
-rw-r--r--nis/nis_cache2_xdr.c8
-rw-r--r--nis/nis_call.c10
-rw-r--r--nis/nis_callback.c67
-rw-r--r--nis/nis_checkpoint.c20
-rw-r--r--nis/nis_clone_dir.c10
-rw-r--r--nis/nis_clone_obj.c8
-rw-r--r--nis/nis_clone_res.c10
-rw-r--r--nis/nis_creategroup.c2
-rw-r--r--nis/nis_file.c11
-rw-r--r--nis/nis_free.c13
-rw-r--r--nis/nis_getservlist.c6
-rw-r--r--nis/nis_local_names.c4
-rw-r--r--nis/nis_lookup.c24
-rw-r--r--nis/nis_mkdir.c10
-rw-r--r--nis/nis_modify.c61
-rw-r--r--nis/nis_ping.c9
-rw-r--r--nis/nis_print.c2
-rw-r--r--nis/nis_remove.c11
-rw-r--r--nis/nis_removemember.c12
-rw-r--r--nis/nis_rmdir.c6
-rw-r--r--nis/nis_server.c10
-rw-r--r--nis/nis_table.c207
-rw-r--r--nis/nis_util.c6
-rw-r--r--nis/nis_verifygroup.c4
-rw-r--r--nis/nis_xdr.c274
-rw-r--r--nis/nis_xdr.h45
-rw-r--r--nis/rpcsvc/nis.h31
-rw-r--r--nis/rpcsvc/nis_callback.h71
-rw-r--r--sunrpc/svc.c10
33 files changed, 579 insertions, 481 deletions
diff --git a/ChangeLog b/ChangeLog
index 5fd5ad89c9..029af609e9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,43 @@
+1998-06-16 Thorsten Kukuk <kukuk@vt.uni-paderborn.de>
+
+ * sunrpc/svc.c: Check for NULL pointer.
+
+ * nis/libnsl.map: Add public NIS+ xdr functions.
+
+ * nis/rpcsvc/nis_callback.h: New file.
+ * nis/rpcsvc/nis.h: Move xdr_* functions from here ...
+ * nis/nis_xdr.h: ... here.
+
+ * nis/nis_add.c: Use internal _xdr_* functions, check for NULL
+ pointers, use NIS+ defines where possible.
+ * nis/nis_cache.c: Likewise.
+ * nis/nis_cache2_xdr.c: Likewise.
+ * nis/nis_call.c: Likewise.
+ * nis/nis_checkpoint.c: Likewise.
+ * nis/nis_clone_dir.c: Likewise.
+ * nis/nis_clone_obj.c: Likewise.
+ * nis/nis_clone_res.c: Likewise.
+ * nis/nis_creategroup.c: Likewise.
+ * nis/nis_file.c: Likewise.
+ * nis/nis_free.c: Likewise.
+ * nis/nis_getservlist.c: Likewise.
+ * nis/nis_local_names.c: likewise.
+ * nis/nis_lookup.c: Likewise.
+ * nis/nis_mkdir.c: Likewise.
+ * nis/nis_modify.c: Likewise.
+ * nis/nis_ping.c: Likewise.
+ * nis/nis_print.c: Likewise.
+ * nis/nis_remove.c: Likewise.
+ * nis/nis_removemember.c: Likewise.
+ * nis/nis_rmdir.c: Likewise.
+ * nis/nis_server.c: Likewise.
+ * nis/nis_table.c: Likewise.
+ * nis/nis_util.c: Likewise.
+ * nis/nis_verifygroup.c: Likewise.
+ * nis/nis_xdr.c: Likewise.
+ * nis/nis_callback.c: Likewise, and move xdr functions from here ...
+ * nis/nis_xdr.c: ... to here.
+
1998-06-15 18:07 Ulrich Drepper <drepper@cygnus.com>
* iconvdata/ksc5601.h: Clean up a bit.
diff --git a/nis/libnsl.map b/nis/libnsl.map
index 21c46747bc..9d0efd0567 100644
--- a/nis/libnsl.map
+++ b/nis/libnsl.map
@@ -51,6 +51,8 @@ GLIBC_2.1 {
nis_sperror; nis_sperror_r; nis_stats;
nis_verifygroup; nis_write_obj;
+ xdr_cback_data; xdr_obj_p;
+
# This functions are needed by the NIS+ tools and rpc.nisd,
# they should never be used in a normal user program !
__do_niscall2; __free_fdresult; __nis_default_access;
diff --git a/nis/nis_add.c b/nis/nis_add.c
index d30ccde2f6..07fa0fb1e9 100644
--- a/nis/nis_add.c
+++ b/nis/nis_add.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1997, 1998 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@uni-paderborn.de>, 1997.
@@ -19,53 +19,52 @@
#include <rpcsvc/nis.h>
+#include "nis_xdr.h"
#include "nis_intern.h"
nis_result *
-nis_add (const_nis_name name, const nis_object *obj)
+nis_add (const_nis_name name, const nis_object *obj2)
{
+ nis_object obj;
nis_result *res;
nis_error status;
struct ns_request req;
- char *p1, *p2, *p3, *p4;
char buf1 [strlen (name) + 20];
char buf4 [strlen (name) + 20];
res = calloc (1, sizeof (nis_result));
+ if (res == NULL)
+ return NULL;
req.ns_name = (char *)name;
- req.ns_object.ns_object_len = 1;
- req.ns_object.ns_object_val = nis_clone_object (obj, NULL);
+ memcpy (&obj, obj2, sizeof (nis_object));
+
+ if (obj.zo_name == NULL || strlen (obj.zo_name) == 0)
+ obj.zo_name = nis_leaf_of_r (name, buf1, sizeof (buf1));
- p1 = req.ns_object.ns_object_val[0].zo_name;
- if (p1 == NULL || strlen (p1) == 0)
- req.ns_object.ns_object_val[0].zo_name =
- nis_leaf_of_r (name, buf1, sizeof (buf1));
+ if (obj.zo_owner == NULL || strlen (obj.zo_owner) == 0)
+ obj.zo_owner = nis_local_principal ();
- p2 = req.ns_object.ns_object_val[0].zo_owner;
- if (p2 == NULL || strlen (p2) == 0)
- req.ns_object.ns_object_val[0].zo_owner = nis_local_principal ();
+ if (obj.zo_group == NULL || strlen (obj.zo_group) == 0)
+ obj.zo_group = nis_local_group ();
- p3 = req.ns_object.ns_object_val[0].zo_group;
- if (p3 == NULL || strlen (p3) == 0)
- req.ns_object.ns_object_val[0].zo_group = nis_local_group ();
+ obj.zo_domain = nis_domain_of_r (name, buf4, sizeof (buf4));
- p4 = req.ns_object.ns_object_val[0].zo_domain;
- req.ns_object.ns_object_val[0].zo_domain =
- nis_domain_of_r (name, buf4, sizeof (buf4));
+ req.ns_object.ns_object_val = nis_clone_object (&obj, NULL);
+ if (req.ns_object.ns_object_val == NULL)
+ {
+ NIS_RES_STATUS (res) = NIS_NOMEMORY;
+ return res;
+ }
+ req.ns_object.ns_object_len = 1;
if ((status = __do_niscall (req.ns_object.ns_object_val[0].zo_domain,
- NIS_ADD, (xdrproc_t) xdr_ns_request,
- (caddr_t) &req, (xdrproc_t) xdr_nis_result,
+ NIS_ADD, (xdrproc_t) _xdr_ns_request,
+ (caddr_t) &req, (xdrproc_t) _xdr_nis_result,
(caddr_t) res, MASTER_ONLY,
NULL)) != RPC_SUCCESS)
- res->status = status;
-
- req.ns_object.ns_object_val[0].zo_name = p1;
- req.ns_object.ns_object_val[0].zo_owner = p2;
- req.ns_object.ns_object_val[0].zo_group = p3;
- req.ns_object.ns_object_val[0].zo_domain = p4;
+ NIS_RES_STATUS (res) = status;
nis_destroy_object (req.ns_object.ns_object_val);
diff --git a/nis/nis_cache.c b/nis/nis_cache.c
index 26cac675a5..9ee21b148d 100644
--- a/nis/nis_cache.c
+++ b/nis/nis_cache.c
@@ -20,8 +20,9 @@
#include <string.h>
#include <unistd.h>
#include <rpcsvc/nis.h>
-#include "nis_intern.h"
+#include "nis_xdr.h"
+#include "nis_intern.h"
#include "nis_cache2.h"
static struct timeval TIMEOUT = { 25, 0 };
@@ -85,7 +86,7 @@ __nis_cache_search (const_nis_name name, u_long flags, cache2_info *cinfo)
xdrmem_create (&xdrs, fsres.dir_data.dir_data_val,
fsres.dir_data.dir_data_len, XDR_DECODE);
- xdr_directory_obj (&xdrs, obj);
+ _xdr_directory_obj (&xdrs, obj);
xdr_destroy (&xdrs);
cinfo->server_used = fsres.server_used;
diff --git a/nis/nis_cache2_xdr.c b/nis/nis_cache2_xdr.c
index b988f3f973..caa3964bca 100644
--- a/nis/nis_cache2_xdr.c
+++ b/nis/nis_cache2_xdr.c
@@ -5,14 +5,16 @@
#include <rpc/types.h>
#include <rpc/xdr.h>
+#include <rpcsvc/nis.h>
+#include "nis_xdr.h"
#include "nis_cache2.h"
-#include <rpcsvc/nis.h>
+
bool_t
xdr_fs_result(XDR *xdrs, fs_result *objp)
{
- if (!xdr_nis_error(xdrs, &objp->status)) {
+ if (!_xdr_nis_error(xdrs, &objp->status)) {
return FALSE;
}
if (!xdr_long(xdrs, &objp->class)) {
@@ -33,7 +35,7 @@ xdr_fs_result(XDR *xdrs, fs_result *objp)
bool_t
xdr_fs_request(XDR *xdrs, fs_request *objp)
{
- if (!xdr_nis_name(xdrs, &objp->name)) {
+ if (!_xdr_nis_name(xdrs, &objp->name)) {
return FALSE;
}
if (!xdr_long(xdrs, &objp->old_class)) {
diff --git a/nis/nis_call.c b/nis/nis_call.c
index 957399ee98..ff9e768fe4 100644
--- a/nis/nis_call.c
+++ b/nis/nis_call.c
@@ -26,6 +26,8 @@
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
+
+#include "nis_xdr.h"
#include "nis_intern.h"
static struct timeval RPCTIMEOUT = {10, 0};
@@ -461,7 +463,7 @@ rec_dirsearch (const_nis_name name, directory_obj *dir, u_long flags,
obj = calloc(1, sizeof(directory_obj));
xdrmem_create(&xdrs, fd_res->dir_data.dir_data_val,
fd_res->dir_data.dir_data_len, XDR_DECODE);
- xdr_directory_obj(&xdrs, obj);
+ _xdr_directory_obj(&xdrs, obj);
xdr_destroy(&xdrs);
__free_fdresult (fd_res);
if (obj != NULL)
@@ -525,7 +527,7 @@ rec_dirsearch (const_nis_name name, directory_obj *dir, u_long flags,
obj = calloc(1, sizeof(directory_obj));
xdrmem_create(&xdrs, fd_res->dir_data.dir_data_val,
fd_res->dir_data.dir_data_len, XDR_DECODE);
- xdr_directory_obj(&xdrs, obj);
+ _xdr_directory_obj(&xdrs, obj);
xdr_destroy(&xdrs);
__free_fdresult (fd_res);
if (obj != NULL)
@@ -576,8 +578,8 @@ first_shoot (const_nis_name name, directory_obj *dir, u_long flags)
return NULL;
xdrmem_create(&xdrs, fd_res->dir_data.dir_data_val,
fd_res->dir_data.dir_data_len, XDR_DECODE);
- xdr_directory_obj(&xdrs, obj);
- xdr_destroy(&xdrs);
+ _xdr_directory_obj (&xdrs, obj);
+ xdr_destroy (&xdrs);
__free_fdresult (fd_res);
if (obj != NULL)
{
diff --git a/nis/nis_callback.c b/nis/nis_callback.c
index 9d138fde60..4c5693a3b5 100644
--- a/nis/nis_callback.c
+++ b/nis/nis_callback.c
@@ -31,8 +31,10 @@
#include <arpa/inet.h>
#include <rpc/key_prot.h>
#include <rpcsvc/nis.h>
+#include <rpcsvc/nis_callback.h>
#include <bits/libc-lock.h>
+#include "nis_xdr.h"
#include "nis_intern.h"
/* Sorry, we are not able to make this threadsafe. Stupid. But some
@@ -40,30 +42,12 @@
cookie. Maybe we could use keys for threads ? Have to learn more
about pthreads -- kukuk@vt.uni-paderborn.de */
-#define CB_PROG ((u_long)100302)
-#define CB_VERS ((u_long)1)
-#define CBPROC_RECEIVE ((u_long)1)
-#define CBPROC_FINISH ((u_long)2)
-#define CBPROC_ERROR ((u_long)3)
-
-typedef nis_object *obj_p;
-
-struct cback_data
- {
- struct
- {
- u_int entries_len;
- obj_p *entries_val;
- }
- entries;
- };
-typedef struct cback_data cback_data;
-
static nis_cb *data;
__libc_lock_define_initialized (static, callback)
+#if 0
static char *
__nis_getpkey(const char *sname)
{
@@ -91,7 +75,7 @@ __nis_getpkey(const char *sname)
if (res == NULL)
return NULL;
- if (res->status != NIS_SUCCESS)
+ if (NIS_RES_STATUS (res) != NIS_SUCCESS)
{
nis_freeresult (res);
return NULL;
@@ -108,9 +92,7 @@ __nis_getpkey(const char *sname)
return strdup (pkey);
}
-
-
-static bool_t xdr_cback_data (XDR *, cback_data *);
+#endif
static void
cb_prog_1 (struct svc_req *rqstp, SVCXPRT *transp)
@@ -181,7 +163,7 @@ cb_prog_1 (struct svc_req *rqstp, SVCXPRT *transp)
result = (char *) &bool_result;
break;
case CBPROC_ERROR:
- xdr_argument = (xdrproc_t) xdr_nis_error;
+ xdr_argument = (xdrproc_t) _xdr_nis_error;
xdr_result = (xdrproc_t) xdr_void;
memset (&argument, 0, sizeof (argument));
if (!svc_getargs (transp, xdr_argument, (caddr_t) & argument))
@@ -208,25 +190,6 @@ cb_prog_1 (struct svc_req *rqstp, SVCXPRT *transp)
return;
}
-static bool_t
-xdr_obj_p (XDR * xdrs, obj_p *objp)
-{
- if (!xdr_pointer (xdrs, (char **) objp, sizeof (nis_object),
- (xdrproc_t) xdr_nis_object))
- return FALSE;
- return TRUE;
-}
-
-static bool_t
-xdr_cback_data (XDR *xdrs, cback_data *objp)
-{
- if (!xdr_array (xdrs, (char **) &objp->entries.entries_val,
- (u_int *) & objp->entries.entries_len, ~0, sizeof (obj_p),
- (xdrproc_t) xdr_obj_p))
- return FALSE;
- return TRUE;
-}
-
static nis_error
internal_nis_do_callback (struct dir_binding *bptr, netobj *cookie,
struct nis_cb *cb)
@@ -319,7 +282,7 @@ __nis_create_callback (int (*callback) (const_nis_name, const nis_object *,
{
free (cb);
syslog (LOG_ERR, "NIS+: out of memory allocating callback");
- return (NULL);
+ return NULL;
}
cb->serv->name = strdup (nis_local_principal ());
cb->serv->ep.ep_val = (endpoint *) calloc (2, sizeof (endpoint));
@@ -328,7 +291,7 @@ __nis_create_callback (int (*callback) (const_nis_name, const nis_object *,
cb->callback = callback;
cb->userdata = userdata;
- if ((flags & NO_AUTHINFO) && key_secretkey_is_set ())
+ if ((flags & NO_AUTHINFO) || !key_secretkey_is_set ())
{
cb->serv->key_type = NIS_PK_NONE;
cb->serv->pkey.n_bytes = NULL;
@@ -336,6 +299,7 @@ __nis_create_callback (int (*callback) (const_nis_name, const nis_object *,
}
else
{
+#if 0
if ((cb->serv->pkey.n_bytes = __nis_getpkey (cb->serv->name)) == NULL)
{
cb->serv->pkey.n_len = 0;
@@ -346,6 +310,11 @@ __nis_create_callback (int (*callback) (const_nis_name, const nis_object *,
cb->serv->key_type = NIS_PK_DH;
cb->serv->pkey.n_len = strlen(cb->serv->pkey.n_bytes);
}
+#else
+ cb->serv->pkey.n_len =0;
+ cb->serv->pkey.n_bytes = NULL;
+ cb->serv->key_type = NIS_PK_DH;
+#endif
}
if (flags & USE_DGRAM)
@@ -363,7 +332,7 @@ __nis_create_callback (int (*callback) (const_nis_name, const nis_object *,
{
xprt_unregister (cb->xprt);
svc_destroy (cb->xprt);
- xdr_free ((xdrproc_t) xdr_nis_server, (char *) cb->serv);
+ xdr_free ((xdrproc_t) _xdr_nis_server, (char *) cb->serv);
free (cb->serv);
free (cb);
syslog (LOG_ERR, "NIS+: failed to register callback dispatcher");
@@ -374,11 +343,11 @@ __nis_create_callback (int (*callback) (const_nis_name, const nis_object *,
{
xprt_unregister (cb->xprt);
svc_destroy (cb->xprt);
- xdr_free ((xdrproc_t) xdr_nis_server, (char *) cb->serv);
+ xdr_free ((xdrproc_t) _xdr_nis_server, (char *) cb->serv);
free (cb->serv);
free (cb);
syslog (LOG_ERR, "NIS+: failed to read local socket info");
- return (NULL);
+ return NULL;
}
port = sin.sin_port;
get_myaddress (&sin);
@@ -395,7 +364,7 @@ __nis_destroy_callback (struct nis_cb *cb)
xprt_unregister (cb->xprt);
svc_destroy (cb->xprt);
close (cb->sock);
- xdr_free ((xdrproc_t) xdr_nis_server, (char *) cb->serv);
+ xdr_free ((xdrproc_t) _xdr_nis_server, (char *) cb->serv);
free (cb->serv);
free (cb);
diff --git a/nis/nis_checkpoint.c b/nis/nis_checkpoint.c
index 665dccba06..585214a3b4 100644
--- a/nis/nis_checkpoint.c
+++ b/nis/nis_checkpoint.c
@@ -18,6 +18,8 @@
Boston, MA 02111-1307, USA. */
#include <rpcsvc/nis.h>
+
+#include "nis_xdr.h"
#include "nis_intern.h"
nis_result *
@@ -26,10 +28,11 @@ nis_checkpoint(const_nis_name dirname)
nis_result *res;
res = calloc (1, sizeof (nis_result));
+ if (res == NULL)
+ return NULL;
if (dirname != NULL)
{
- cp_result *cpres = NULL;
nis_result *res2;
u_int i;
@@ -48,16 +51,19 @@ nis_checkpoint(const_nis_name dirname)
for (i = 0;
i < NIS_RES_OBJECT (res2)->DI_data.do_servers.do_servers_len; ++i)
{
+ cp_result cpres;
+
+ memset (&cpres, '\0', sizeof (cp_result));
if (__do_niscall2 (&NIS_RES_OBJECT(res2)->DI_data.do_servers.do_servers_val[i],
- 1, NIS_CHECKPOINT, (xdrproc_t) xdr_nis_name,
- (caddr_t) &dirname, (xdrproc_t) xdr_cp_result,
- (caddr_t) &cpres, 0, NULL, NULL) != RPC_SUCCESS)
+ 1, NIS_CHECKPOINT, (xdrproc_t) _xdr_nis_name,
+ (caddr_t) &dirname, (xdrproc_t) _xdr_cp_result,
+ (caddr_t) &cpres, 0, NULL, NULL) != NIS_SUCCESS)
NIS_RES_STATUS (res) = NIS_RPCERROR;
else
{
- res->status += cpres->cp_status;
- res->zticks += cpres->cp_zticks;
- res->dticks += cpres->cp_dticks;
+ NIS_RES_STATUS (res) = cpres.cp_status;
+ res->zticks += cpres.cp_zticks;
+ res->dticks += cpres.cp_dticks;
}
}
nis_freeresult (res2);
diff --git a/nis/nis_clone_dir.c b/nis/nis_clone_dir.c
index 4d641e58f7..a59bd78cdf 100644
--- a/nis/nis_clone_dir.c
+++ b/nis/nis_clone_dir.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 1997 Free Software Foundation, Inc.
+/* Copyright (c) 1997, 1998 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
@@ -21,6 +21,8 @@
#include <rpc/rpc.h>
#include <rpcsvc/nis.h>
+#include "nis_xdr.h"
+
directory_obj *
nis_clone_directory (const directory_obj *src, directory_obj *dest)
{
@@ -32,7 +34,7 @@ nis_clone_directory (const directory_obj *src, directory_obj *dest)
if (src == NULL)
return (NULL);
- size = xdr_sizeof ((xdrproc_t)xdr_directory_obj, (char *)src);
+ size = xdr_sizeof ((xdrproc_t)_xdr_directory_obj, (char *)src);
if ((addr = calloc(1, size)) == NULL)
return NULL;
@@ -48,7 +50,7 @@ nis_clone_directory (const directory_obj *src, directory_obj *dest)
res = dest;
xdrmem_create(&xdrs, addr, size, XDR_ENCODE);
- if (!xdr_directory_obj (&xdrs, (directory_obj *)src))
+ if (!_xdr_directory_obj (&xdrs, (directory_obj *)src))
{
xdr_destroy (&xdrs);
free (addr);
@@ -56,7 +58,7 @@ nis_clone_directory (const directory_obj *src, directory_obj *dest)
}
xdr_destroy (&xdrs);
xdrmem_create (&xdrs, addr, size, XDR_DECODE);
- if (!xdr_directory_obj (&xdrs, res))
+ if (!_xdr_directory_obj (&xdrs, res))
{
xdr_destroy (&xdrs);
free (addr);
diff --git a/nis/nis_clone_obj.c b/nis/nis_clone_obj.c
index 133c2558b4..9a1490a1bf 100644
--- a/nis/nis_clone_obj.c
+++ b/nis/nis_clone_obj.c
@@ -21,6 +21,8 @@
#include <rpc/rpc.h>
#include <rpcsvc/nis.h>
+#include "nis_xdr.h"
+
nis_object *
nis_clone_object (const nis_object *src, nis_object *dest)
{
@@ -32,7 +34,7 @@ nis_clone_object (const nis_object *src, nis_object *dest)
if (src == NULL)
return (NULL);
- size = xdr_sizeof ((xdrproc_t)xdr_nis_object, (char *)src);
+ size = xdr_sizeof ((xdrproc_t)_xdr_nis_object, (char *)src);
if ((addr = calloc(1, size)) == NULL)
return NULL;
@@ -48,7 +50,7 @@ nis_clone_object (const nis_object *src, nis_object *dest)
res = dest;
xdrmem_create(&xdrs, addr, size, XDR_ENCODE);
- if (!xdr_nis_object (&xdrs, (nis_object *)src))
+ if (!_xdr_nis_object (&xdrs, (nis_object *)src))
{
xdr_destroy (&xdrs);
free (addr);
@@ -56,7 +58,7 @@ nis_clone_object (const nis_object *src, nis_object *dest)
}
xdr_destroy (&xdrs);
xdrmem_create(&xdrs, addr, size, XDR_DECODE);
- if (!xdr_nis_object(&xdrs, res))
+ if (!_xdr_nis_object(&xdrs, res))
{
xdr_destroy (&xdrs);
free (addr);
diff --git a/nis/nis_clone_res.c b/nis/nis_clone_res.c
index 9bdc4d8835..d39fcafa7b 100644
--- a/nis/nis_clone_res.c
+++ b/nis/nis_clone_res.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 1997 Free Software Foundation, Inc.
+/* Copyright (c) 1997, 1998 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
@@ -21,6 +21,8 @@
#include <rpc/rpc.h>
#include <rpcsvc/nis.h>
+#include "nis_xdr.h"
+
nis_result *
nis_clone_result (const nis_result *src, nis_result *dest)
{
@@ -32,7 +34,7 @@ nis_clone_result (const nis_result *src, nis_result *dest)
if (src == NULL)
return (NULL);
- size = xdr_sizeof ((xdrproc_t)xdr_nis_result, (char *)src);
+ size = xdr_sizeof ((xdrproc_t)_xdr_nis_result, (char *)src);
if ((addr = calloc(1, size)) == NULL)
return NULL;
@@ -48,7 +50,7 @@ nis_clone_result (const nis_result *src, nis_result *dest)
res = dest;
xdrmem_create(&xdrs, addr, size, XDR_ENCODE);
- if (!xdr_nis_result (&xdrs, (nis_result *)src))
+ if (!_xdr_nis_result (&xdrs, (nis_result *)src))
{
xdr_destroy (&xdrs);
free (addr);
@@ -56,7 +58,7 @@ nis_clone_result (const nis_result *src, nis_result *dest)
}
xdr_destroy (&xdrs);
xdrmem_create(&xdrs, addr, size, XDR_DECODE);
- if (!xdr_nis_result(&xdrs, res))
+ if (!_xdr_nis_result(&xdrs, res))
{
xdr_destroy (&xdrs);
free (addr);
diff --git a/nis/nis_creategroup.c b/nis/nis_creategroup.c
index a96d67d29c..8333e09c89 100644
--- a/nis/nis_creategroup.c
+++ b/nis/nis_creategroup.c
@@ -62,7 +62,7 @@ nis_creategroup (const_nis_name group, u_long flags)
res = nis_add (buf, obj);
if (res == NULL)
return NIS_NOMEMORY;
- status = res->status;
+ status = NIS_RES_STATUS (res);
nis_freeresult (res);
nis_free_object (obj);
diff --git a/nis/nis_file.c b/nis/nis_file.c
index fdd7cd4214..4634e67f61 100644
--- a/nis/nis_file.c
+++ b/nis/nis_file.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 1997 Free Software Foundation, Inc.
+/* Copyright (c) 1997, 1998 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
@@ -21,6 +21,7 @@
#include <stdlib.h>
#include <string.h>
#include <rpcsvc/nis.h>
+#include "nis_xdr.h"
static const char cold_start_file[] = "/var/nis/NIS_COLD_START";
@@ -36,7 +37,7 @@ readColdStartFile (void)
return NULL;
memset (&obj, '\0', sizeof (obj));
xdrstdio_create (&xdrs, in, XDR_DECODE);
- if (!xdr_directory_obj (&xdrs, &obj))
+ if (!_xdr_directory_obj (&xdrs, &obj))
return NULL;
return nis_clone_directory (&obj, NULL);
@@ -53,7 +54,7 @@ writeColdStartFile (const directory_obj *obj)
return FALSE;
xdrstdio_create (&xdrs, out, XDR_ENCODE);
- if (!xdr_directory_obj (&xdrs, (directory_obj *) obj))
+ if (!_xdr_directory_obj (&xdrs, (directory_obj *) obj))
return FALSE;
return TRUE;
@@ -72,7 +73,7 @@ nis_read_obj (const char *name)
memset (&obj, '\0', sizeof (obj));
xdrstdio_create (&xdrs, in, XDR_DECODE);
- if (!xdr_nis_object (&xdrs, &obj))
+ if (!_xdr_nis_object (&xdrs, &obj))
return NULL;
return nis_clone_object (&obj, NULL);
@@ -89,7 +90,7 @@ nis_write_obj (const char *name, const nis_object *obj)
return FALSE;
xdrstdio_create (&xdrs, out, XDR_ENCODE);
- if (!xdr_nis_object (&xdrs, (nis_object *) obj))
+ if (!_xdr_nis_object (&xdrs, (nis_object *) obj))
return FALSE;
return TRUE;
diff --git a/nis/nis_free.c b/nis/nis_free.c
index 5d08882f84..0b065572e3 100644
--- a/nis/nis_free.c
+++ b/nis/nis_free.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 1997 Free Software Foundation, Inc.
+/* Copyright (c) 1997, 1998 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
@@ -18,13 +18,14 @@
Boston, MA 02111-1307, USA. */
#include <rpcsvc/nis.h>
+#include "nis_xdr.h"
void
__free_fdresult (fd_result *res)
{
if (res != NULL)
{
- xdr_free ((xdrproc_t)xdr_fd_result, (char *)res);
+ xdr_free ((xdrproc_t)_xdr_fd_result, (char *)res);
free (res);
}
}
@@ -34,7 +35,7 @@ nis_free_request (ib_request *ibreq)
{
if (ibreq != NULL)
{
- xdr_free ((xdrproc_t)xdr_ib_request, (char *)ibreq);
+ xdr_free ((xdrproc_t)_xdr_ib_request, (char *)ibreq);
free (ibreq);
}
}
@@ -44,7 +45,7 @@ nis_free_directory (directory_obj *obj)
{
if (obj != NULL)
{
- xdr_free ((xdrproc_t)xdr_directory_obj, (char *)obj);
+ xdr_free ((xdrproc_t)_xdr_directory_obj, (char *)obj);
free (obj);
}
}
@@ -54,7 +55,7 @@ nis_free_object (nis_object *obj)
{
if (obj != NULL)
{
- xdr_free ((xdrproc_t)xdr_nis_object, (char *)obj);
+ xdr_free ((xdrproc_t)_xdr_nis_object, (char *)obj);
free (obj);
}
}
@@ -64,7 +65,7 @@ nis_freeresult (nis_result *res)
{
if (res != NULL)
{
- xdr_free ((xdrproc_t)xdr_nis_result, (char *)res);
+ xdr_free ((xdrproc_t)_xdr_nis_result, (char *)res);
free (res);
}
}
diff --git a/nis/nis_getservlist.c b/nis/nis_getservlist.c
index 1629c24053..f88c156f89 100644
--- a/nis/nis_getservlist.c
+++ b/nis/nis_getservlist.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 1997 Free Software Foundation, Inc.
+/* Copyright (c) 1997, 1998 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
@@ -19,6 +19,8 @@
#include <string.h>
#include <rpcsvc/nis.h>
+
+#include "nis_xdr.h"
#include "nis_intern.h"
nis_server **
@@ -111,7 +113,7 @@ nis_freeservlist (nis_server **serv)
i = 0;
while (serv[i] != NULL)
{
- xdr_free ((xdrproc_t)xdr_nis_server, (char *)serv[i]);
+ xdr_free ((xdrproc_t)_xdr_nis_server, (char *)serv[i]);
free (serv[i]);
++i;
}
diff --git a/nis/nis_local_names.c b/nis/nis_local_names.c
index bcae995837..22601a46aa 100644
--- a/nis/nis_local_names.c
+++ b/nis/nis_local_names.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 1997 Free Software Foundation, Inc.
+/* Copyright (c) 1997, 1998 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
@@ -115,7 +115,7 @@ nis_local_principal (void)
if (res == NULL)
return strcpy (__principal, "nobody");
- if (res->status == NIS_SUCCESS)
+ if (NIS_RES_STATUS (res) == NIS_SUCCESS)
{
if (res->objects.objects_len > 1)
{
diff --git a/nis/nis_lookup.c b/nis/nis_lookup.c
index cbc64c34a4..6a2198ac21 100644
--- a/nis/nis_lookup.c
+++ b/nis/nis_lookup.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1997, 1998 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@uni-paderborn.de>, 1997.
@@ -19,7 +19,7 @@
#include <string.h>
#include <rpcsvc/nis.h>
-
+#include "nis_xdr.h"
#include "nis_intern.h"
nis_result *
@@ -35,20 +35,22 @@ nis_lookup (const_nis_name name, const u_long flags)
nis_name namebuf[2] = {NULL, NULL};
res = calloc (1, sizeof (nis_result));
+ if (res == NULL)
+ return NULL;
if (flags & EXPAND_NAME)
{
names = nis_getnames (name);
if (names == NULL)
{
- res->status = NIS_NAMEUNREACHABLE;
+ NIS_RES_STATUS (res) = NIS_NAMEUNREACHABLE;
return res;
}
}
else
{
names = namebuf;
- names[0] = (nis_name) name;
+ names[0] = (nis_name)name;
}
req.ns_name = names[0];
@@ -59,14 +61,14 @@ nis_lookup (const_nis_name name, const u_long flags)
memset (res, '\0', sizeof (nis_result));
status = __do_niscall (req.ns_name, NIS_LOOKUP,
- (xdrproc_t) xdr_ns_request,
+ (xdrproc_t) _xdr_ns_request,
(caddr_t) & req,
- (xdrproc_t) xdr_nis_result,
+ (xdrproc_t) _xdr_nis_result,
(caddr_t) res, flags, NULL);
if (status != NIS_SUCCESS)
- res->status = status;
+ NIS_RES_STATUS (res) = status;
- switch (res->status)
+ switch (NIS_RES_STATUS (res))
{
case NIS_PARTIAL:
case NIS_SUCCESS:
@@ -77,7 +79,7 @@ nis_lookup (const_nis_name name, const u_long flags)
/* if we hit the link limit, bail */
if (count_links > NIS_MAXLINKS)
{
- res->status = NIS_LINKNAMEERROR;
+ NIS_RES_STATUS (res) = NIS_LINKNAMEERROR;
++done;
break;
}
@@ -87,6 +89,8 @@ nis_lookup (const_nis_name name, const u_long flags)
req.ns_name = strdup (NIS_RES_OBJECT (res)->LI_data.li_name);
nis_freeresult (res);
res = calloc (1, sizeof (nis_result));
+ if (res == NULL)
+ return NULL;
}
else
++done;
@@ -104,7 +108,7 @@ nis_lookup (const_nis_name name, const u_long flags)
if (count_links)
{
free (req.ns_name);
- res->status = NIS_LINKNAMEERROR;
+ NIS_RES_STATUS (res) = NIS_LINKNAMEERROR;
++done;
break;
}
diff --git a/nis/nis_mkdir.c b/nis/nis_mkdir.c
index e7858306ee..71fc4ba877 100644
--- a/nis/nis_mkdir.c
+++ b/nis/nis_mkdir.c
@@ -18,6 +18,8 @@
Boston, MA 02111-1307, USA. */
#include <rpcsvc/nis.h>
+
+#include "nis_xdr.h"
#include "nis_intern.h"
nis_error
@@ -26,13 +28,13 @@ nis_mkdir (const_nis_name dir, const nis_server *server)
nis_error res, res2;
if (server == NULL)
- res2 = __do_niscall (dir, NIS_MKDIR, (xdrproc_t) xdr_nis_name,
- (caddr_t) &dir, (xdrproc_t) xdr_nis_error,
+ res2 = __do_niscall (dir, NIS_MKDIR, (xdrproc_t) _xdr_nis_name,
+ (caddr_t) &dir, (xdrproc_t) _xdr_nis_error,
(caddr_t) &res, 0, NULL);
else
res2 = __do_niscall2 (server, 1, NIS_MKDIR,
- (xdrproc_t) xdr_nis_name,
- (caddr_t) &dir, (xdrproc_t) xdr_nis_error,
+ (xdrproc_t) _xdr_nis_name,
+ (caddr_t) &dir, (xdrproc_t) _xdr_nis_error,
(caddr_t) &res, 0, NULL, NULL);
if (res2 != NIS_SUCCESS)
return res2;
diff --git a/nis/nis_modify.c b/nis/nis_modify.c
index 3f2cca4698..57efe82bf2 100644
--- a/nis/nis_modify.c
+++ b/nis/nis_modify.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1997, 1998 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@uni-paderborn.de>, 1997.
@@ -19,52 +19,53 @@
#include <rpcsvc/nis.h>
+#include "nis_xdr.h"
#include "nis_intern.h"
nis_result *
-nis_modify (const_nis_name name, const nis_object *obj)
+nis_modify (const_nis_name name, const nis_object *obj2)
{
+ nis_object obj;
nis_result *res;
nis_error status;
struct ns_request req;
- char *p1, *p2, *p3, *p4;
- char buf1 [strlen (name) + 20];
- char buf4 [strlen (name) + 20];
+ size_t namelen = strlen (name);
+ char buf1[namelen + 20];
+ char buf4[namelen + 20];
res = calloc (1, sizeof (nis_result));
+ if (res == NULL)
+ return NULL;
- req.ns_name = (char *) name;
+ req.ns_name = (char *)name;
- req.ns_object.ns_object_len = 1;
- req.ns_object.ns_object_val = nis_clone_object (obj, NULL);
+ memcpy (&obj, obj2, sizeof (nis_object));
- p1 = req.ns_object.ns_object_val[0].zo_name;
- if (p1 == NULL || strlen (p1) == 0)
- req.ns_object.ns_object_val[0].zo_name =
- nis_leaf_of_r (name, buf1, sizeof (buf1));
+ if (obj.zo_name == NULL || obj.zo_name[0] == '\0')
+ obj.zo_name = nis_leaf_of_r (name, buf1, sizeof (buf1));
- p2 = req.ns_object.ns_object_val[0].zo_owner;
- if (p2 == NULL || strlen (p2) == 0)
- req.ns_object.ns_object_val[0].zo_owner = nis_local_principal ();
+ if (obj.zo_owner == NULL || obj.zo_owner[0] == '\0')
+ obj.zo_owner = nis_local_principal ();
- p3 = req.ns_object.ns_object_val[0].zo_group;
- if (p3 == NULL || strlen (p3) == 0)
- req.ns_object.ns_object_val[0].zo_group = nis_local_group ();
+ if (obj.zo_group == NULL || obj.zo_group[0] == '\0')
+ obj.zo_group = nis_local_group ();
- p4 = req.ns_object.ns_object_val[0].zo_domain;
- req.ns_object.ns_object_val[0].zo_domain =
- nis_domain_of_r (name, buf4, sizeof (buf4));
+ obj.zo_domain = nis_domain_of_r (name, buf4, sizeof (buf4));
- if ((status = __do_niscall (name, NIS_MODIFY, (xdrproc_t) xdr_ns_request,
- (caddr_t) & req, (xdrproc_t) xdr_nis_result,
- (caddr_t) res, MASTER_ONLY,
- NULL)) != RPC_SUCCESS)
- NIS_RES_STATUS (res) = status;
+ req.ns_object.ns_object_val = nis_clone_object (&obj, NULL);
+ if (req.ns_object.ns_object_val == NULL)
+ {
+ NIS_RES_STATUS (res) = NIS_NOMEMORY;
+ return res;
+ }
+ req.ns_object.ns_object_len = 1;
- req.ns_object.ns_object_val[0].zo_name = p1;
- req.ns_object.ns_object_val[0].zo_owner = p2;
- req.ns_object.ns_object_val[0].zo_group = p3;
- req.ns_object.ns_object_val[0].zo_domain = p4;
+ status = __do_niscall (name, NIS_MODIFY, (xdrproc_t) _xdr_ns_request,
+ (caddr_t) & req, (xdrproc_t) _xdr_nis_result,
+ (caddr_t) res, MASTER_ONLY,
+ NULL);
+ if (status != RPC_SUCCESS)
+ NIS_RES_STATUS (res) = status;
nis_destroy_object (req.ns_object.ns_object_val);
diff --git a/nis/nis_ping.c b/nis/nis_ping.c
index 03562c3e84..1becd4bf89 100644
--- a/nis/nis_ping.c
+++ b/nis/nis_ping.c
@@ -18,6 +18,8 @@
Boston, MA 02111-1307, USA. */
#include <rpcsvc/nis.h>
+
+#include "nis_xdr.h"
#include "nis_intern.h"
void
@@ -34,7 +36,7 @@ nis_ping (const_nis_name dirname, u_long utime, const nis_object *dirobj)
if (dirobj == NULL)
{
res = nis_lookup (dirname, MASTER_ONLY);
- if (res->status != NIS_SUCCESS)
+ if (NIS_RES_STATUS (res) != NIS_SUCCESS)
return;
obj = res->objects.objects_val;
}
@@ -55,9 +57,10 @@ nis_ping (const_nis_name dirname, u_long utime, const nis_object *dirobj)
args.dir = (char *) dirname;
args.stamp = utime;
- for (i = 0; i < obj->DI_data.do_servers.do_servers_len; ++i)
+ /* Send the ping only to replicas */
+ for (i = 1; i < obj->DI_data.do_servers.do_servers_len; ++i)
__do_niscall2 (&obj->DI_data.do_servers.do_servers_val[i], 1,
- NIS_PING, (xdrproc_t) xdr_ping_args,
+ NIS_PING, (xdrproc_t) _xdr_ping_args,
(caddr_t) &args, (xdrproc_t) xdr_void,
(caddr_t) NULL, 0, NULL, NULL);
if (res)
diff --git a/nis/nis_print.c b/nis/nis_print.c
index 01a2d9dcec..0e36017615 100644
--- a/nis/nis_print.c
+++ b/nis/nis_print.c
@@ -351,7 +351,7 @@ nis_print_result (const nis_result *res)
{
unsigned int i;
- printf (_("Status : %s\n"), nis_sperrno (res->status));
+ printf (_("Status : %s\n"), nis_sperrno (NIS_RES_STATUS (res)));
printf (_("Number of objects : %u\n"), res->objects.objects_len);
for (i = 0; i < res->objects.objects_len; i++)
diff --git a/nis/nis_remove.c b/nis/nis_remove.c
index cbbbdfcfd0..390fbe86a8 100644
--- a/nis/nis_remove.c
+++ b/nis/nis_remove.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1997, 1998 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@uni-paderborn.de>, 1997.
@@ -19,6 +19,7 @@
#include <rpcsvc/nis.h>
+#include "nis_xdr.h"
#include "nis_intern.h"
nis_result *
@@ -29,8 +30,10 @@ nis_remove (const_nis_name name, const nis_object *obj)
struct ns_request req;
res = calloc (1, sizeof (nis_result));
+ if (res == NULL)
+ return NULL;
- req.ns_name = (char *) name;
+ req.ns_name = (char *)name;
if (obj != NULL)
{
@@ -43,8 +46,8 @@ nis_remove (const_nis_name name, const nis_object *obj)
req.ns_object.ns_object_val = NULL;
}
- if ((status = __do_niscall (name, NIS_REMOVE, (xdrproc_t) xdr_ns_request,
- (caddr_t) & req, (xdrproc_t) xdr_nis_result,
+ if ((status = __do_niscall (name, NIS_REMOVE, (xdrproc_t) _xdr_ns_request,
+ (caddr_t) &req, (xdrproc_t) _xdr_nis_result,
(caddr_t) res, MASTER_ONLY,
NULL)) != RPC_SUCCESS)
NIS_RES_STATUS (res) = status;
diff --git a/nis/nis_removemember.c b/nis/nis_removemember.c
index 71807a3ffe..28050a1ac3 100644
--- a/nis/nis_removemember.c
+++ b/nis/nis_removemember.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 1997 Free Software Foundation, Inc.
+/* Copyright (c) 1997, 1998 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
@@ -43,9 +43,9 @@ nis_removemember (const_nis_name member, const_nis_name group)
stpcpy (cp, cp2);
}
res = nis_lookup (buf, FOLLOW_LINKS|EXPAND_NAME);
- if (res->status != NIS_SUCCESS)
+ if (NIS_RES_STATUS (res) != NIS_SUCCESS)
{
- status = res->status;
+ status = NIS_RES_STATUS (res);
nis_freeresult (res);
return status;
}
@@ -57,6 +57,8 @@ nis_removemember (const_nis_name member, const_nis_name group)
newmem =
calloc (1, 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;
@@ -76,6 +78,8 @@ nis_removemember (const_nis_name member, const_nis_name group)
}
free (NIS_RES_OBJECT (res)->GR_data.gr_members.gr_members_val);
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;
@@ -83,7 +87,7 @@ nis_removemember (const_nis_name member, const_nis_name group)
*cp++ = '.';
strncpy (cp, NIS_RES_OBJECT (res)->zo_domain, NIS_MAXNAMELEN);
res2 = nis_modify (buf, NIS_RES_OBJECT (res));
- status = res2->status;
+ status = NIS_RES_STATUS (res2);
nis_freeresult (res);
nis_freeresult (res2);
diff --git a/nis/nis_rmdir.c b/nis/nis_rmdir.c
index 1fc1f09639..1f3e91874c 100644
--- a/nis/nis_rmdir.c
+++ b/nis/nis_rmdir.c
@@ -18,6 +18,8 @@
Boston, MA 02111-1307, USA. */
#include <rpcsvc/nis.h>
+
+#include "nis_xdr.h"
#include "nis_intern.h"
nis_error
@@ -29,8 +31,8 @@ nis_rmdir (const_nis_name dir, const nis_server *server)
return NIS_SYSTEMERROR;
res2 = __do_niscall2 (server, 1, NIS_RMDIR,
- (xdrproc_t) xdr_nis_name,
- (caddr_t) &dir, (xdrproc_t) xdr_nis_error,
+ (xdrproc_t) _xdr_nis_name,
+ (caddr_t) &dir, (xdrproc_t) _xdr_nis_error,
(caddr_t) &res, 0, NULL, NULL);
if (res2 != NIS_SUCCESS)
return res2;
diff --git a/nis/nis_server.c b/nis/nis_server.c
index 26b7ca5358..aa0f05eb39 100644
--- a/nis/nis_server.c
+++ b/nis/nis_server.c
@@ -19,6 +19,8 @@
#include <string.h>
#include <rpcsvc/nis.h>
+
+#include "nis_xdr.h"
#include "nis_intern.h"
nis_error
@@ -37,8 +39,8 @@ nis_servstate (const nis_server *serv, const nis_tag *tags,
if (serv == NULL)
return NIS_BADOBJECT;
- if (__do_niscall2 (serv, 1, NIS_SERVSTATE, (xdrproc_t) xdr_nis_taglist,
- (caddr_t) &taglist, (xdrproc_t) xdr_nis_taglist,
+ if (__do_niscall2 (serv, 1, NIS_SERVSTATE, (xdrproc_t) _xdr_nis_taglist,
+ (caddr_t) &taglist, (xdrproc_t) _xdr_nis_taglist,
(caddr_t) &tagres, 0, NULL, NULL) != RPC_SUCCESS)
return NIS_RPCERROR;
@@ -63,8 +65,8 @@ nis_stats (const nis_server *serv, const nis_tag *tags,
if (serv == NULL)
return NIS_BADOBJECT;
- if (__do_niscall2 (serv, 1, NIS_STATUS, (xdrproc_t) xdr_nis_taglist,
- (caddr_t) &taglist, (xdrproc_t) xdr_nis_taglist,
+ if (__do_niscall2 (serv, 1, NIS_STATUS, (xdrproc_t) _xdr_nis_taglist,
+ (caddr_t) &taglist, (xdrproc_t) _xdr_nis_taglist,
(caddr_t) &tagres, 0, NULL, NULL) != RPC_SUCCESS)
return NIS_RPCERROR;
diff --git a/nis/nis_table.c b/nis/nis_table.c
index 084ce68193..70d2b80fbc 100644
--- a/nis/nis_table.c
+++ b/nis/nis_table.c
@@ -19,6 +19,8 @@
#include <string.h>
#include <rpcsvc/nis.h>
+
+#include "nis_xdr.h"
#include "nis_intern.h"
static void
@@ -175,10 +177,12 @@ nis_list (const_nis_name name, u_long flags,
nis_cb *cb = NULL;
res = calloc (1, sizeof (nis_result));
+ if (res == NULL)
+ return NULL;
if (__create_ib_request (name, ibreq, flags) == NULL)
{
- res->status = NIS_BADNAME;
+ NIS_RES_STATUS (res) = NIS_BADNAME;
return res;
}
@@ -189,7 +193,7 @@ nis_list (const_nis_name name, u_long flags,
ibreq->ibr_name = NULL;
if (names == NULL)
{
- res->status = NIS_BADNAME;
+ NIS_RES_STATUS (res) = NIS_BADNAME;
return res;
}
ibreq->ibr_name = strdup (names[name_nr]);
@@ -210,14 +214,12 @@ nis_list (const_nis_name name, u_long flags,
char *ntable, *p;
u_long done = 0, failures = 0;
- memset (res, '\0', sizeof (nis_result));
-
while (names[name_nr] != NULL && !done)
{
lres = nis_lookup (names[name_nr], newflags);
- if (lres == NULL || lres->status != NIS_SUCCESS)
+ if (lres == NULL || NIS_RES_STATUS (lres) != NIS_SUCCESS)
{
- res->status = lres->status;
+ NIS_RES_STATUS (res) = NIS_RES_STATUS (lres);
nis_freeresult (lres);
++name_nr;
continue;
@@ -228,7 +230,7 @@ nis_list (const_nis_name name, u_long flags,
if (__type_of (NIS_RES_OBJECT (lres)) != NIS_TABLE_OBJ)
{
nis_freeresult (lres);
- res->status = NIS_INVALIDOBJ;
+ NIS_RES_STATUS (res) = NIS_INVALIDOBJ;
break;
}
@@ -263,7 +265,7 @@ nis_list (const_nis_name name, u_long flags,
res = nis_list (ntable, newflags, callback, userdata);
if (res == NULL)
return NULL;
- switch (res->status)
+ switch (NIS_RES_STATUS (res))
{
case NIS_SUCCESS:
case NIS_CBRESULTS:
@@ -281,10 +283,10 @@ nis_list (const_nis_name name, u_long flags,
break;
}
}
- if (res->status == NIS_SUCCESS && failures)
- res->status = NIS_S_SUCCESS;
- if (res->status == NIS_NOTFOUND && failures)
- res->status = NIS_S_NOTFOUND;
+ if (NIS_RES_STATUS (res) == NIS_SUCCESS && failures)
+ NIS_RES_STATUS (res) = NIS_S_SUCCESS;
+ if (NIS_RES_STATUS (res) == NIS_NOTFOUND && failures)
+ NIS_RES_STATUS (res) = NIS_S_NOTFOUND;
break;
}
}
@@ -302,13 +304,13 @@ nis_list (const_nis_name name, u_long flags,
memset (res, '\0', sizeof (nis_result));
status = __do_niscall (ibreq->ibr_name, NIS_IBLIST,
- (xdrproc_t) xdr_ib_request,
- (caddr_t) ibreq, (xdrproc_t) xdr_nis_result,
+ (xdrproc_t) _xdr_ib_request,
+ (caddr_t) ibreq, (xdrproc_t) _xdr_nis_result,
(caddr_t) res, flags, cb);
if (status != NIS_SUCCESS)
- res->status = status;
+ NIS_RES_STATUS (res) = status;
- switch (res->status)
+ switch (NIS_RES_STATUS (res))
{
case NIS_PARTIAL:
case NIS_SUCCESS:
@@ -319,7 +321,7 @@ nis_list (const_nis_name name, u_long flags,
/* If we hit the link limit, bail. */
if (count_links > NIS_MAXLINKS)
{
- res->status = NIS_LINKNAMEERROR;
+ NIS_RES_STATUS (res) = NIS_LINKNAMEERROR;
++done;
break;
}
@@ -344,7 +346,9 @@ nis_list (const_nis_name name, u_long flags,
++done;
break;
case NIS_CBRESULTS:
- /* Calback is handled in nis_call.c (__do_niscall2). */
+ /* Calback is handled in nis_call.c (__do_niscall2),
+ but we have to change the error code */
+ NIS_RES_STATUS (res) = cb->result;
++done;
break;
case NIS_UNAVAIL:
@@ -356,7 +360,7 @@ nis_list (const_nis_name name, u_long flags,
if (count_links)
{
free (ibreq->ibr_name);
- res->status = NIS_LINKNAMEERROR;
+ NIS_RES_STATUS (res) = NIS_LINKNAMEERROR;
++done;
break;
}
@@ -388,55 +392,58 @@ nis_list (const_nis_name name, u_long flags,
}
nis_result *
-nis_add_entry (const_nis_name name, const nis_object *obj,
- u_long flags)
+nis_add_entry (const_nis_name name, const nis_object *obj2, u_long flags)
{
+ nis_object obj;
nis_result *res;
nis_error status;
ib_request *ibreq = calloc (1, sizeof (ib_request));
- char *p1, *p2, *p3, *p4;
char buf1[strlen (name) + 20];
char buf4[strlen (name) + 20];
res = calloc (1, sizeof (nis_result));
+ if (res == NULL)
+ return NULL;
+
+ if (ibreq == NULL)
+ {
+ NIS_RES_STATUS (res) = NIS_NOMEMORY;
+ return res;
+ }
if (__create_ib_request (name, ibreq, flags) == NULL)
{
- res->status = NIS_BADNAME;
+ NIS_RES_STATUS (res) = NIS_BADNAME;
return res;
}
- ibreq->ibr_obj.ibr_obj_val = nis_clone_object (obj, NULL);
- ibreq->ibr_obj.ibr_obj_len = 1;
+ memcpy (&obj, obj2, sizeof (nis_object));
- p1 = ibreq->ibr_obj.ibr_obj_val->zo_name;
- if (p1 == NULL || strlen (p1) == 0)
- ibreq->ibr_obj.ibr_obj_val->zo_name =
- nis_leaf_of_r (name, buf1, sizeof (buf1));
+ if (obj.zo_name == NULL || strlen (obj.zo_name) == 0)
+ obj.zo_name = nis_leaf_of_r (name, buf1, sizeof (buf1));
- p2 = ibreq->ibr_obj.ibr_obj_val->zo_owner;
- if (p2 == NULL || strlen (p2) == 0)
- ibreq->ibr_obj.ibr_obj_val->zo_owner = nis_local_principal ();
+ if (obj.zo_owner == NULL || strlen (obj.zo_owner) == 0)
+ obj.zo_owner = nis_local_principal ();
- p3 = ibreq->ibr_obj.ibr_obj_val->zo_group;
- if (p3 == NULL || strlen (p3) == 0)
- ibreq->ibr_obj.ibr_obj_val->zo_group = nis_local_group ();
+ if (obj.zo_group == NULL || strlen (obj.zo_group) == 0)
+ obj.zo_group = nis_local_group ();
- p4 = ibreq->ibr_obj.ibr_obj_val->zo_domain;
- ibreq->ibr_obj.ibr_obj_val->zo_domain =
- nis_domain_of_r (name, buf4, sizeof (buf4));
+ obj.zo_domain = nis_domain_of_r (name, buf4, sizeof (buf4));
+
+ ibreq->ibr_obj.ibr_obj_val = nis_clone_object (&obj, NULL);
+ if (ibreq->ibr_obj.ibr_obj_val == NULL)
+ {
+ NIS_RES_STATUS (res) = NIS_NOMEMORY;
+ return res;
+ }
+ ibreq->ibr_obj.ibr_obj_len = 1;
if ((status = __do_niscall (ibreq->ibr_name, NIS_IBADD,
- (xdrproc_t) xdr_ib_request,
+ (xdrproc_t) _xdr_ib_request,
(caddr_t) ibreq,
- (xdrproc_t) xdr_nis_result,
+ (xdrproc_t) _xdr_nis_result,
(caddr_t) res, 0, NULL)) != NIS_SUCCESS)
- res->status = status;
-
- ibreq->ibr_obj.ibr_obj_val->zo_name = p1;
- ibreq->ibr_obj.ibr_obj_val->zo_owner = p2;
- ibreq->ibr_obj.ibr_obj_val->zo_group = p3;
- ibreq->ibr_obj.ibr_obj_val->zo_domain = p4;
+ NIS_RES_STATUS (res) = status;
nis_free_request (ibreq);
@@ -444,13 +451,12 @@ nis_add_entry (const_nis_name name, const nis_object *obj,
}
nis_result *
-nis_modify_entry (const_nis_name name, const nis_object *obj,
- u_long flags)
+nis_modify_entry (const_nis_name name, const nis_object *obj2, u_long flags)
{
+ nis_object obj;
nis_result *res;
nis_error status;
ib_request *ibreq = calloc (1, sizeof (ib_request));
- char *p1, *p2, *p3, *p4;
char buf1[strlen (name) + 20];
char buf4[strlen (name) + 20];
@@ -458,40 +464,36 @@ nis_modify_entry (const_nis_name name, const nis_object *obj,
if (__create_ib_request (name, ibreq, flags) == NULL)
{
- res->status = NIS_BADNAME;
+ NIS_RES_STATUS (res) = NIS_BADNAME;
return res;
}
- ibreq->ibr_obj.ibr_obj_val = nis_clone_object (obj, NULL);
- ibreq->ibr_obj.ibr_obj_len = 1;
+ memcpy (&obj, obj2, sizeof (nis_object));
- p1 = ibreq->ibr_obj.ibr_obj_val->zo_name;
- if (p1 == NULL || strlen (p1) == 0)
- ibreq->ibr_obj.ibr_obj_val->zo_name =
- nis_leaf_of_r (name, buf1, sizeof (buf1));
+ if (obj.zo_name == NULL || strlen (obj.zo_name) == 0)
+ obj.zo_name = nis_leaf_of_r (name, buf1, sizeof (buf1));
- p2 = ibreq->ibr_obj.ibr_obj_val->zo_owner;
- if (p2 == NULL || strlen (p2) == 0)
- ibreq->ibr_obj.ibr_obj_val->zo_owner = nis_local_principal ();
+ if (obj.zo_owner == NULL || strlen (obj.zo_owner) == 0)
+ obj.zo_owner = nis_local_principal ();
- p3 = ibreq->ibr_obj.ibr_obj_val->zo_group;
- if (p3 == NULL || strlen (p3) == 0)
- ibreq->ibr_obj.ibr_obj_val->zo_group = nis_local_group ();
+ if (obj.zo_group == NULL || strlen (obj.zo_group) == 0)
+ obj.zo_group = nis_local_group ();
- p4 = ibreq->ibr_obj.ibr_obj_val->zo_domain;
- ibreq->ibr_obj.ibr_obj_val->zo_domain =
- nis_domain_of_r (name, buf4, sizeof (buf4));
+ obj.zo_domain = nis_domain_of_r (name, buf4, sizeof (buf4));
+
+ ibreq->ibr_obj.ibr_obj_val = nis_clone_object (&obj, NULL);
+ if (ibreq->ibr_obj.ibr_obj_val == NULL)
+ {
+ NIS_RES_STATUS (res) = NIS_NOMEMORY;
+ return res;
+ }
+ ibreq->ibr_obj.ibr_obj_len = 1;
if ((status = __do_niscall (ibreq->ibr_name, NIS_IBMODIFY,
- (xdrproc_t) xdr_ib_request,
- (caddr_t) ibreq, (xdrproc_t) xdr_nis_result,
+ (xdrproc_t) _xdr_ib_request,
+ (caddr_t) ibreq, (xdrproc_t) _xdr_nis_result,
(caddr_t) res, 0, NULL)) != NIS_SUCCESS)
- res->status = status;
-
- ibreq->ibr_obj.ibr_obj_val->zo_name = p1;
- ibreq->ibr_obj.ibr_obj_val->zo_owner = p2;
- ibreq->ibr_obj.ibr_obj_val->zo_group = p3;
- ibreq->ibr_obj.ibr_obj_val->zo_domain = p4;
+ NIS_RES_STATUS (res) = status;
nis_free_request (ibreq);
@@ -507,24 +509,37 @@ nis_remove_entry (const_nis_name name, const nis_object *obj,
nis_error status;
res = calloc (1, sizeof (nis_result));
+ if (res == NULL)
+ return NULL;
+
+ if (ibreq == NULL)
+ {
+ NIS_RES_STATUS (res) = NIS_NOMEMORY;
+ return res;
+ }
if (__create_ib_request (name, ibreq, flags) == NULL)
{
- res->status = NIS_BADNAME;
+ NIS_RES_STATUS (res) = NIS_BADNAME;
return res;
}
if (obj != NULL)
{
ibreq->ibr_obj.ibr_obj_val = nis_clone_object (obj, NULL);
+ if (ibreq->ibr_obj.ibr_obj_val == NULL)
+ {
+ NIS_RES_STATUS (res) = NIS_NOMEMORY;
+ return res;
+ }
ibreq->ibr_obj.ibr_obj_len = 1;
}
if ((status = __do_niscall (ibreq->ibr_name, NIS_IBREMOVE,
- (xdrproc_t) xdr_ib_request,
- (caddr_t) ibreq, (xdrproc_t) xdr_nis_result,
+ (xdrproc_t) _xdr_ib_request,
+ (caddr_t) ibreq, (xdrproc_t) _xdr_nis_result,
(caddr_t) res, 0, NULL)) != NIS_SUCCESS)
- res->status = status;
+ NIS_RES_STATUS (res) = status;
nis_free_request (ibreq);
@@ -539,18 +554,26 @@ nis_first_entry (const_nis_name name)
nis_error status;
res = calloc (1, sizeof (nis_result));
+ if (res == NULL)
+ return NULL;
+
+ if (ibreq == NULL)
+ {
+ NIS_RES_STATUS (res) = NIS_NOMEMORY;
+ return res;
+ }
if (__create_ib_request (name, ibreq, 0) == NULL)
{
- res->status = NIS_BADNAME;
+ 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,
+ (xdrproc_t) _xdr_ib_request,
+ (caddr_t) ibreq, (xdrproc_t) _xdr_nis_result,
(caddr_t) res, 0, NULL)) != NIS_SUCCESS)
- res->status = status;
+ NIS_RES_STATUS (res) = status;
nis_free_request (ibreq);
@@ -565,10 +588,18 @@ nis_next_entry (const_nis_name name, const netobj *cookie)
nis_error status;
res = calloc (1, sizeof (nis_result));
+ if (res == NULL)
+ return NULL;
+
+ if (ibreq == NULL)
+ {
+ NIS_RES_STATUS (res) = NIS_NOMEMORY;
+ return res;
+ }
if (__create_ib_request (name, ibreq, 0) == NULL)
{
- res->status = NIS_BADNAME;
+ NIS_RES_STATUS (res) = NIS_BADNAME;
return res;
}
@@ -577,19 +608,19 @@ nis_next_entry (const_nis_name name, const netobj *cookie)
ibreq->ibr_cookie.n_bytes = malloc (cookie->n_len);
if (ibreq->ibr_cookie.n_bytes == NULL)
{
- res->status = NIS_NOMEMORY;
- free (res);
- return NULL;
+ NIS_RES_STATUS (res) = NIS_NOMEMORY;
+ nis_free_request (ibreq);
+ return res;
}
memcpy (ibreq->ibr_cookie.n_bytes, cookie->n_bytes, cookie->n_len);
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,
+ (xdrproc_t) _xdr_ib_request,
+ (caddr_t) ibreq, (xdrproc_t) _xdr_nis_result,
(caddr_t) res, 0, NULL)) != NIS_SUCCESS)
- res->status = status;
+ NIS_RES_STATUS (res) = status;
nis_free_request (ibreq);
diff --git a/nis/nis_util.c b/nis/nis_util.c
index e516647bec..656b1a48c1 100644
--- a/nis/nis_util.c
+++ b/nis/nis_util.c
@@ -19,6 +19,8 @@
#include <string.h>
#include <rpcsvc/nis.h>
+
+#include "nis_xdr.h"
#include "nis_intern.h"
fd_result *
@@ -34,8 +36,8 @@ __nis_finddirectory (directory_obj *dir, const_nis_name name)
status = __do_niscall2 (dir->do_servers.do_servers_val,
dir->do_servers.do_servers_len,
- NIS_FINDDIRECTORY, (xdrproc_t) xdr_fd_args,
- (caddr_t) &fd_args, (xdrproc_t) xdr_fd_result,
+ NIS_FINDDIRECTORY, (xdrproc_t) _xdr_fd_args,
+ (caddr_t) &fd_args, (xdrproc_t) _xdr_fd_result,
(caddr_t) fd_res, NO_AUTHINFO|USE_DGRAM, NULL, NULL);
if (status != NIS_SUCCESS)
fd_res->status = status;
diff --git a/nis/nis_verifygroup.c b/nis/nis_verifygroup.c
index be65120ae8..6d3ec7b7b7 100644
--- a/nis/nis_verifygroup.c
+++ b/nis/nis_verifygroup.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 1997 Free Software Foundation, Inc.
+/* Copyright (c) 1997, 1998 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
@@ -41,7 +41,7 @@ nis_verifygroup (const_nis_name group)
stpcpy (cp, cp2);
}
res = nis_lookup (buf, 0);
- status = res->status;
+ status = NIS_RES_STATUS (res);
nis_freeresult (res);
return status;
}
diff --git a/nis/nis_xdr.c b/nis/nis_xdr.c
index 0c253da127..efeb7d09dd 100644
--- a/nis/nis_xdr.c
+++ b/nis/nis_xdr.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 1997 Free Software Foundation, Inc.
+/* Copyright (c) 1997, 1998 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
@@ -18,8 +18,14 @@
Boston, MA 02111-1307, USA. */
#include <rpcsvc/nis.h>
+#include <rpcsvc/nis_callback.h> /* for "official" Solaris xdr functions */
-bool_t
+/* This functions do exist without beginning "_" under Solaris 2.x, but
+ we have no prototypes for them. To avoid the same problems as with the
+ YP xdr functions, we don't make them public. */
+#include "nis_xdr.h"
+
+static bool_t
xdr_nis_attr (XDR *xdrs, nis_attr *objp)
{
if (!xdr_string (xdrs, &objp->zattr_ndx, ~0))
@@ -31,14 +37,14 @@ xdr_nis_attr (XDR *xdrs, nis_attr *objp)
}
bool_t
-xdr_nis_name (XDR *xdrs, nis_name *objp)
+_xdr_nis_name (XDR *xdrs, nis_name *objp)
{
if (!xdr_string (xdrs, objp, ~0))
return FALSE;
return TRUE;
}
-bool_t
+static bool_t
xdr_zotypes (XDR *xdrs, zotypes *objp)
{
if (!xdr_enum (xdrs, (enum_t *) objp))
@@ -46,7 +52,7 @@ xdr_zotypes (XDR *xdrs, zotypes *objp)
return TRUE;
}
-bool_t
+static bool_t
xdr_nstype (XDR *xdrs, nstype *objp)
{
if (!xdr_enum (xdrs, (enum_t *) objp))
@@ -54,7 +60,7 @@ xdr_nstype (XDR *xdrs, nstype *objp)
return TRUE;
}
-bool_t
+static bool_t
xdr_oar_mask (XDR *xdrs, oar_mask *objp)
{
if (!xdr_u_long (xdrs, &objp->oa_rights))
@@ -64,7 +70,7 @@ xdr_oar_mask (XDR *xdrs, oar_mask *objp)
return TRUE;
}
-bool_t
+static bool_t
xdr_endpoint (XDR *xdrs, endpoint *objp)
{
if (!xdr_string (xdrs, &objp->uaddr, ~0))
@@ -77,9 +83,9 @@ xdr_endpoint (XDR *xdrs, endpoint *objp)
}
bool_t
-xdr_nis_server (XDR *xdrs, nis_server *objp)
+_xdr_nis_server (XDR *xdrs, nis_server *objp)
{
- if (!xdr_nis_name (xdrs, &objp->name))
+ if (!_xdr_nis_name (xdrs, &objp->name))
return FALSE;
if (!xdr_array (xdrs, (char **) &objp->ep.ep_val, (u_int *) &objp->ep.ep_len,
~0, sizeof (endpoint), (xdrproc_t) xdr_endpoint))
@@ -92,15 +98,15 @@ xdr_nis_server (XDR *xdrs, nis_server *objp)
}
bool_t
-xdr_directory_obj (XDR *xdrs, directory_obj *objp)
+_xdr_directory_obj (XDR *xdrs, directory_obj *objp)
{
- if (!xdr_nis_name (xdrs, &objp->do_name))
+ if (!_xdr_nis_name (xdrs, &objp->do_name))
return FALSE;
if (!xdr_nstype (xdrs, &objp->do_type))
return FALSE;
if (!xdr_array (xdrs, (char **) &objp->do_servers.do_servers_val,
(u_int *) & objp->do_servers.do_servers_len, ~0,
- sizeof (nis_server), (xdrproc_t) xdr_nis_server))
+ sizeof (nis_server), (xdrproc_t) _xdr_nis_server))
return FALSE;
if (!xdr_u_long (xdrs, &objp->do_ttl))
@@ -112,7 +118,7 @@ xdr_directory_obj (XDR *xdrs, directory_obj *objp)
return TRUE;
}
-bool_t
+static bool_t
xdr_entry_col (XDR *xdrs, entry_col *objp)
{
if (!xdr_u_long (xdrs, &objp->ec_flags))
@@ -123,7 +129,7 @@ xdr_entry_col (XDR *xdrs, entry_col *objp)
return TRUE;
}
-bool_t
+static bool_t
xdr_entry_obj (XDR *xdrs, entry_obj *objp)
{
if (!xdr_string (xdrs, &objp->en_type, ~0))
@@ -135,19 +141,19 @@ xdr_entry_obj (XDR *xdrs, entry_obj *objp)
return TRUE;
}
-bool_t
+static bool_t
xdr_group_obj (XDR *xdrs, group_obj *objp)
{
if (!xdr_u_long (xdrs, &objp->gr_flags))
return FALSE;
if (!xdr_array (xdrs, (char **) &objp->gr_members.gr_members_val,
(u_int *) &objp->gr_members.gr_members_len, ~0,
- sizeof (nis_name), (xdrproc_t) xdr_nis_name))
+ sizeof (nis_name), (xdrproc_t) _xdr_nis_name))
return FALSE;
return TRUE;
}
-bool_t
+static bool_t
xdr_link_obj (XDR *xdrs, link_obj *objp)
{
if (!xdr_zotypes (xdrs, &objp->li_rtype))
@@ -156,12 +162,12 @@ xdr_link_obj (XDR *xdrs, link_obj *objp)
(u_int *) &objp->li_attrs.li_attrs_len, ~0,
sizeof (nis_attr), (xdrproc_t) xdr_nis_attr))
return FALSE;
- if (!xdr_nis_name (xdrs, &objp->li_name))
+ if (!_xdr_nis_name (xdrs, &objp->li_name))
return FALSE;
return TRUE;
}
-bool_t
+static bool_t
xdr_table_col (XDR *xdrs, table_col *objp)
{
if (!xdr_string (xdrs, &objp->tc_name, 64))
@@ -173,7 +179,7 @@ xdr_table_col (XDR *xdrs, table_col *objp)
return TRUE;
}
-bool_t
+static bool_t
xdr_table_obj (XDR *xdrs, table_obj *objp)
{
if (!xdr_string (xdrs, &objp->ta_type, 64))
@@ -191,7 +197,7 @@ xdr_table_obj (XDR *xdrs, table_obj *objp)
return TRUE;
}
-bool_t
+static bool_t
xdr_objdata (XDR *xdrs, objdata *objp)
{
if (!xdr_zotypes (xdrs, &objp->zo_type))
@@ -199,7 +205,7 @@ xdr_objdata (XDR *xdrs, objdata *objp)
switch (objp->zo_type)
{
case NIS_DIRECTORY_OBJ:
- if (!xdr_directory_obj (xdrs, &objp->objdata_u.di_data))
+ if (!_xdr_directory_obj (xdrs, &objp->objdata_u.di_data))
return FALSE;
break;
case NIS_GROUP_OBJ:
@@ -233,7 +239,7 @@ xdr_objdata (XDR *xdrs, objdata *objp)
return TRUE;
}
-bool_t
+static bool_t
xdr_nis_oid (XDR *xdrs, nis_oid *objp)
{
if (!xdr_u_long (xdrs, &objp->ctime))
@@ -244,17 +250,17 @@ xdr_nis_oid (XDR *xdrs, nis_oid *objp)
}
bool_t
-xdr_nis_object (XDR *xdrs, nis_object *objp)
+_xdr_nis_object (XDR *xdrs, nis_object *objp)
{
if (!xdr_nis_oid (xdrs, &objp->zo_oid))
return FALSE;
- if (!xdr_nis_name (xdrs, &objp->zo_name))
+ if (!_xdr_nis_name (xdrs, &objp->zo_name))
return FALSE;
- if (!xdr_nis_name (xdrs, &objp->zo_owner))
+ if (!_xdr_nis_name (xdrs, &objp->zo_owner))
return FALSE;
- if (!xdr_nis_name (xdrs, &objp->zo_group))
+ if (!_xdr_nis_name (xdrs, &objp->zo_group))
return FALSE;
- if (!xdr_nis_name (xdrs, &objp->zo_domain))
+ if (!_xdr_nis_name (xdrs, &objp->zo_domain))
return FALSE;
if (!xdr_u_long (xdrs, &objp->zo_access))
return FALSE;
@@ -266,7 +272,7 @@ xdr_nis_object (XDR *xdrs, nis_object *objp)
}
bool_t
-xdr_nis_error (XDR *xdrs, nis_error *objp)
+_xdr_nis_error (XDR *xdrs, nis_error *objp)
{
if (!xdr_enum (xdrs, (enum_t *) objp))
return FALSE;
@@ -274,17 +280,17 @@ xdr_nis_error (XDR *xdrs, nis_error *objp)
}
bool_t
-xdr_nis_result (XDR *xdrs, nis_result *objp)
+_xdr_nis_result (XDR *xdrs, nis_result *objp)
{
register long *buf;
if (xdrs->x_op == XDR_ENCODE)
{
- if (!xdr_nis_error (xdrs, &objp->status))
+ if (!_xdr_nis_error (xdrs, &objp->status))
return FALSE;
if (!xdr_array (xdrs, (char **) &objp->objects.objects_val,
(u_int *) &objp->objects.objects_len, ~0,
- sizeof (nis_object), (xdrproc_t) xdr_nis_object))
+ sizeof (nis_object), (xdrproc_t) _xdr_nis_object))
return FALSE;
if (!xdr_netobj (xdrs, &objp->cookie))
return FALSE;
@@ -292,22 +298,13 @@ xdr_nis_result (XDR *xdrs, nis_result *objp)
if (buf == NULL)
{
if (!xdr_u_long (xdrs, &objp->zticks))
- {
- return FALSE;
- }
+ return FALSE;
if (!xdr_u_long (xdrs, &objp->dticks))
- {
- return FALSE;
- }
+ return FALSE;
if (!xdr_u_long (xdrs, &objp->aticks))
- {
- return FALSE;
- }
+ return FALSE;
if (!xdr_u_long (xdrs, &objp->cticks))
- {
- return FALSE;
- }
-
+ return FALSE;
}
else
{
@@ -316,45 +313,29 @@ xdr_nis_result (XDR *xdrs, nis_result *objp)
IXDR_PUT_U_LONG (buf, objp->aticks);
IXDR_PUT_U_LONG (buf, objp->cticks);
}
-
return TRUE;
}
else if (xdrs->x_op == XDR_DECODE)
{
- if (!xdr_nis_error (xdrs, &objp->status))
- {
- return FALSE;
- }
+ if (!_xdr_nis_error (xdrs, &objp->status))
+ return FALSE;
if (!xdr_array (xdrs, (char **) &objp->objects.objects_val,
(u_int *) &objp->objects.objects_len, ~0,
- sizeof (nis_object), (xdrproc_t) xdr_nis_object))
- {
- return FALSE;
- }
+ sizeof (nis_object), (xdrproc_t) _xdr_nis_object))
+ return FALSE;
if (!xdr_netobj (xdrs, &objp->cookie))
- {
- return FALSE;
- }
+ return FALSE;
buf = XDR_INLINE (xdrs, 4 * BYTES_PER_XDR_UNIT);
if (buf == NULL)
{
if (!xdr_u_long (xdrs, &objp->zticks))
- {
- return FALSE;
- }
+ return FALSE;
if (!xdr_u_long (xdrs, &objp->dticks))
- {
- return FALSE;
- }
+ return FALSE;
if (!xdr_u_long (xdrs, &objp->aticks))
- {
- return FALSE;
- }
+ return FALSE;
if (!xdr_u_long (xdrs, &objp->cticks))
- {
- return FALSE;
- }
-
+ return FALSE;
}
else
{
@@ -366,55 +347,41 @@ xdr_nis_result (XDR *xdrs, nis_result *objp)
return TRUE;
}
- if (!xdr_nis_error (xdrs, &objp->status))
- {
- return FALSE;
- }
+ if (!_xdr_nis_error (xdrs, &objp->status))
+ return FALSE;
if (!xdr_array (xdrs, (char **) &objp->objects.objects_val,
(u_int *) &objp->objects.objects_len, ~0,
- sizeof (nis_object), (xdrproc_t) xdr_nis_object))
- {
- return FALSE;
- }
+ sizeof (nis_object), (xdrproc_t) _xdr_nis_object))
+ return FALSE;
if (!xdr_netobj (xdrs, &objp->cookie))
- {
- return FALSE;
- }
+ return FALSE;
if (!xdr_u_long (xdrs, &objp->zticks))
- {
- return FALSE;
- }
+ return FALSE;
if (!xdr_u_long (xdrs, &objp->dticks))
- {
- return FALSE;
- }
+ return FALSE;
if (!xdr_u_long (xdrs, &objp->aticks))
- {
- return FALSE;
- }
+ return FALSE;
if (!xdr_u_long (xdrs, &objp->cticks))
- {
- return FALSE;
- }
+ return FALSE;
return TRUE;
}
bool_t
-xdr_ns_request (XDR *xdrs, ns_request *objp)
+_xdr_ns_request (XDR *xdrs, ns_request *objp)
{
- if (!xdr_nis_name (xdrs, &objp->ns_name))
+ if (!_xdr_nis_name (xdrs, &objp->ns_name))
return FALSE;
if (!xdr_array (xdrs, (char **) &objp->ns_object.ns_object_val,
(u_int *) &objp->ns_object.ns_object_len, 1,
- sizeof (nis_object), (xdrproc_t) xdr_nis_object))
+ sizeof (nis_object), (xdrproc_t) _xdr_nis_object))
return FALSE;
return TRUE;
}
bool_t
-xdr_ib_request (XDR *xdrs, ib_request *objp)
+_xdr_ib_request (XDR *xdrs, ib_request *objp)
{
- if (!xdr_nis_name (xdrs, &objp->ibr_name))
+ if (!_xdr_nis_name (xdrs, &objp->ibr_name))
return FALSE;
if (!xdr_array (xdrs, (char **) &objp->ibr_srch.ibr_srch_val,
(u_int *) &objp->ibr_srch.ibr_srch_len, ~0,
@@ -424,11 +391,11 @@ xdr_ib_request (XDR *xdrs, ib_request *objp)
return FALSE;
if (!xdr_array (xdrs, (char **) &objp->ibr_obj.ibr_obj_val,
(u_int *) &objp->ibr_obj.ibr_obj_len, 1,
- sizeof (nis_object), (xdrproc_t) xdr_nis_object))
+ sizeof (nis_object), (xdrproc_t) _xdr_nis_object))
return FALSE;
if (!xdr_array (xdrs, (char **) &objp->ibr_cbhost.ibr_cbhost_val,
(u_int *) &objp->ibr_cbhost.ibr_cbhost_len, 1,
- sizeof (nis_server), (xdrproc_t) xdr_nis_server))
+ sizeof (nis_server), (xdrproc_t) _xdr_nis_server))
return FALSE;
if (!xdr_u_long (xdrs, &objp->ibr_bufsize))
return FALSE;
@@ -438,9 +405,9 @@ xdr_ib_request (XDR *xdrs, ib_request *objp)
}
bool_t
-xdr_ping_args (XDR *xdrs, ping_args *objp)
+_xdr_ping_args (XDR *xdrs, ping_args *objp)
{
- if (!xdr_nis_name (xdrs, &objp->dir))
+ if (!_xdr_nis_name (xdrs, &objp->dir))
return FALSE;
if (!xdr_u_long (xdrs, &objp->stamp))
return FALSE;
@@ -448,57 +415,9 @@ xdr_ping_args (XDR *xdrs, ping_args *objp)
}
bool_t
-xdr_log_entry_t (XDR *xdrs, log_entry_t *objp)
-{
- if (!xdr_enum (xdrs, (enum_t *) objp))
- return FALSE;
- return TRUE;
-}
-
-bool_t
-xdr_log_entry (XDR *xdrs, log_entry *objp)
-{
- if (!xdr_u_long (xdrs, &objp->le_time))
- return FALSE;
- if (!xdr_log_entry_t (xdrs, &objp->le_type))
- return FALSE;
- if (!xdr_nis_name (xdrs, &objp->le_princp))
- return FALSE;
- if (!xdr_nis_name (xdrs, &objp->le_name))
- return FALSE;
- if (!xdr_array (xdrs, (char **) &objp->le_attrs.le_attrs_val,
- (u_int *) &objp->le_attrs.le_attrs_len, ~0,
- sizeof (nis_attr), (xdrproc_t) xdr_nis_attr))
- return FALSE;
- if (!xdr_nis_object (xdrs, &objp->le_object))
- return FALSE;
- return TRUE;
-}
-
-bool_t
-xdr_log_result (XDR *xdrs, log_result *objp)
-{
- if (!xdr_nis_error (xdrs, &objp->lr_status))
- {
- return FALSE;
- }
- if (!xdr_netobj (xdrs, &objp->lr_cookie))
- {
- return FALSE;
- }
- if (!xdr_array (xdrs, (char **) &objp->lr_entries.lr_entries_val,
- (u_int *) &objp->lr_entries.lr_entries_len, ~0,
- sizeof (log_entry), (xdrproc_t) xdr_log_entry))
- {
- return FALSE;
- }
- return TRUE;
-}
-
-bool_t
-xdr_cp_result (XDR *xdrs, cp_result *objp)
+_xdr_cp_result (XDR *xdrs, cp_result *objp)
{
- if (!xdr_nis_error (xdrs, &objp->cp_status))
+ if (!_xdr_nis_error (xdrs, &objp->cp_status))
return FALSE;
if (!xdr_u_long (xdrs, &objp->cp_zticks))
return FALSE;
@@ -508,7 +427,7 @@ xdr_cp_result (XDR *xdrs, cp_result *objp)
}
bool_t
-xdr_nis_tag (XDR *xdrs, nis_tag *objp)
+_xdr_nis_tag (XDR *xdrs, nis_tag *objp)
{
if (!xdr_u_long (xdrs, &objp->tag_type))
{
@@ -522,51 +441,58 @@ xdr_nis_tag (XDR *xdrs, nis_tag *objp)
}
bool_t
-xdr_nis_taglist (XDR *xdrs, nis_taglist *objp)
+_xdr_nis_taglist (XDR *xdrs, nis_taglist *objp)
{
if (!xdr_array (xdrs, (char **) &objp->tags.tags_val,
(u_int *) &objp->tags.tags_len, ~0, sizeof (nis_tag),
- (xdrproc_t) xdr_nis_tag))
+ (xdrproc_t) _xdr_nis_tag))
return FALSE;
return TRUE;
}
bool_t
-xdr_dump_args (XDR *xdrs, dump_args *objp)
+_xdr_fd_args (XDR *xdrs, fd_args *objp)
{
- if (!xdr_nis_name (xdrs, &objp->da_dir))
- return FALSE;
- if (!xdr_u_long (xdrs, &objp->da_time))
+ if (!_xdr_nis_name (xdrs, &objp->dir_name))
return FALSE;
- if (!xdr_array (xdrs, (char **) &objp->da_cbhost.da_cbhost_val,
- (u_int *) &objp->da_cbhost.da_cbhost_len, 1,
- sizeof (nis_server), (xdrproc_t) xdr_nis_server))
+ if (!_xdr_nis_name (xdrs, &objp->requester))
return FALSE;
return TRUE;
}
bool_t
-xdr_fd_args (XDR *xdrs, fd_args *objp)
+_xdr_fd_result (XDR *xdrs, fd_result *objp)
{
- if (!xdr_nis_name (xdrs, &objp->dir_name))
+ if (!_xdr_nis_error (xdrs, &objp->status))
+ return FALSE;
+ if (!_xdr_nis_name (xdrs, &objp->source))
+ return FALSE;
+ if (!xdr_bytes (xdrs, (char **) &objp->dir_data.dir_data_val,
+ (u_int *) &objp->dir_data.dir_data_len, ~0))
return FALSE;
- if (!xdr_nis_name (xdrs, &objp->requester))
+ if (!xdr_bytes (xdrs, (char **) &objp->signature.signature_val,
+ (u_int *) &objp->signature.signature_len, ~0))
return FALSE;
return TRUE;
}
+/* The following functions have prototypes in nis_callback.h. So
+ we make them public */
bool_t
-xdr_fd_result (XDR *xdrs, fd_result *objp)
+xdr_obj_p (XDR *xdrs, obj_p *objp)
{
- if (!xdr_nis_error (xdrs, &objp->status))
+ if (!xdr_pointer (xdrs, (char **)objp, sizeof (nis_object),
+ (xdrproc_t)_xdr_nis_object))
return FALSE;
- if (!xdr_nis_name (xdrs, &objp->source))
- return FALSE;
- if (!xdr_bytes (xdrs, (char **) &objp->dir_data.dir_data_val,
- (u_int *) &objp->dir_data.dir_data_len, ~0))
- return FALSE;
- if (!xdr_bytes (xdrs, (char **) &objp->signature.signature_val,
- (u_int *) &objp->signature.signature_len, ~0))
+ return TRUE;
+}
+
+bool_t
+xdr_cback_data (XDR *xdrs, cback_data *objp)
+{
+ if (!xdr_array (xdrs, (char **)&objp->entries.entries_val,
+ (u_int *) &objp->entries.entries_len, ~0,
+ sizeof (obj_p), (xdrproc_t) xdr_obj_p))
return FALSE;
return TRUE;
}
diff --git a/nis/nis_xdr.h b/nis/nis_xdr.h
new file mode 100644
index 0000000000..b2c0250b61
--- /dev/null
+++ b/nis/nis_xdr.h
@@ -0,0 +1,45 @@
+/* Copyright (c) 1998 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1998.
+
+ 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
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#ifndef __NIS_XDR_H
+#define __NIS_XDR_H 1
+
+#include <features.h>
+
+__BEGIN_DECLS
+
+extern bool_t _xdr_nis_attr __P ((XDR *, nis_attr*));
+extern bool_t _xdr_nis_name __P ((XDR *, nis_name*));
+extern bool_t _xdr_nis_server __P ((XDR *, nis_server*));
+extern bool_t _xdr_directory_obj __P ((XDR *, directory_obj*));
+extern bool_t _xdr_nis_object __P ((XDR *, nis_object*));
+extern bool_t _xdr_nis_error __P ((XDR *, nis_error*));
+extern bool_t _xdr_nis_result __P ((XDR *, nis_result*));
+extern bool_t _xdr_ns_request __P ((XDR *, ns_request*));
+extern bool_t _xdr_ib_request __P ((XDR *, ib_request*));
+extern bool_t _xdr_ping_args __P ((XDR *, ping_args*));
+extern bool_t _xdr_cp_result __P ((XDR *, cp_result*));
+extern bool_t _xdr_nis_tag __P ((XDR *, nis_tag*));
+extern bool_t _xdr_nis_taglist __P ((XDR *, nis_taglist*));
+extern bool_t _xdr_fd_args __P ((XDR *, fd_args*));
+extern bool_t _xdr_fd_result __P ((XDR *, fd_result*));
+
+__END_DECLS
+
+#endif
diff --git a/nis/rpcsvc/nis.h b/nis/rpcsvc/nis.h
index c0d25325c1..3148a8d8b2 100644
--- a/nis/rpcsvc/nis.h
+++ b/nis/rpcsvc/nis.h
@@ -81,10 +81,8 @@ struct nis_attr {
} zattr_val;
};
typedef struct nis_attr nis_attr;
-extern bool_t xdr_nis_attr __P ((XDR *, nis_attr*));
typedef char *nis_name;
-extern bool_t xdr_nis_name __P ((XDR *, nis_name*));
enum zotypes {
BOGUS_OBJ = 0,
@@ -105,7 +103,6 @@ enum zotypes {
NIS_PRIVATE_OBJ = 7
};
typedef enum zotypes zotypes;
-extern bool_t xdr_zotypes __P ((XDR *, zotypes*));
enum nstype {
UNKNOWN = 0,
@@ -119,14 +116,12 @@ enum nstype {
CDS = 8,
};
typedef enum nstype nstype;
-extern bool_t xdr_nstype __P ((XDR *, nstype*));
struct oar_mask {
u_long oa_rights;
zotypes oa_otype;
};
typedef struct oar_mask oar_mask;
-extern bool_t xdr_oar_mask __P ((XDR *, oar_mask*));
struct endpoint {
char *uaddr;
@@ -134,7 +129,6 @@ struct endpoint {
char *proto;
};
typedef struct endpoint endpoint;
-extern bool_t xdr_endpoint __P ((XDR *, endpoint*));
struct nis_server {
nis_name name;
@@ -146,7 +140,6 @@ struct nis_server {
netobj pkey;
};
typedef struct nis_server nis_server;
-extern bool_t xdr_nis_server __P ((XDR *, nis_server*));
struct directory_obj {
nis_name do_name;
@@ -162,7 +155,6 @@ struct directory_obj {
} do_armask;
};
typedef struct directory_obj directory_obj;
-extern bool_t xdr_directory_obj __P ((XDR *, directory_obj*));
#define EN_BINARY 1
#define EN_CRYPT 2
@@ -178,7 +170,6 @@ struct entry_col {
} ec_value;
};
typedef struct entry_col entry_col;
-extern bool_t xdr_entry_col __P ((XDR *, entry_col*));
struct entry_obj {
char *en_type;
@@ -188,7 +179,6 @@ struct entry_obj {
} en_cols;
};
typedef struct entry_obj entry_obj;
-extern bool_t xdr_entry_obj __P ((XDR *, entry_obj*));
struct group_obj {
u_long gr_flags;
@@ -198,7 +188,6 @@ struct group_obj {
} gr_members;
};
typedef struct group_obj group_obj;
-extern bool_t xdr_group_obj __P ((XDR *, group_obj*));
struct link_obj {
zotypes li_rtype;
@@ -209,7 +198,6 @@ struct link_obj {
nis_name li_name;
};
typedef struct link_obj link_obj;
-extern bool_t xdr_link_obj __P ((XDR *, link_obj*));
#define TA_BINARY 1
#define TA_CRYPT 2
@@ -225,7 +213,6 @@ struct table_col {
u_long tc_rights;
};
typedef struct table_col table_col;
-extern bool_t xdr_table_col __P ((XDR *, table_col*));
struct table_obj {
char *ta_type;
@@ -238,7 +225,6 @@ struct table_obj {
char *ta_path;
};
typedef struct table_obj table_obj;
-extern bool_t xdr_table_obj __P ((XDR *, table_obj*));
struct objdata {
zotypes zo_type;
@@ -255,14 +241,12 @@ struct objdata {
} objdata_u;
};
typedef struct objdata objdata;
-extern bool_t xdr_objdata __P ((XDR *, objdata*));
struct nis_oid {
u_long ctime;
u_long mtime;
};
typedef struct nis_oid nis_oid;
-extern bool_t xdr_nis_oid __P ((XDR *, nis_oid*));
struct nis_object {
nis_oid zo_oid;
@@ -275,7 +259,6 @@ struct nis_object {
objdata zo_data;
};
typedef struct nis_object nis_object;
-extern bool_t xdr_nis_object __P ((XDR *, nis_object*));
#endif /* if __nis_object_h */
@@ -330,7 +313,6 @@ enum nis_error {
NIS_DUMPLATER = 47,
};
typedef enum nis_error nis_error;
-extern bool_t xdr_nis_error __P ((XDR *, nis_error*));
struct nis_result {
nis_error status;
@@ -345,7 +327,6 @@ struct nis_result {
u_long cticks;
};
typedef struct nis_result nis_result;
-extern bool_t xdr_nis_result __P ((XDR *, nis_result*));
struct ns_request {
nis_name ns_name;
@@ -355,7 +336,6 @@ struct ns_request {
} ns_object;
};
typedef struct ns_request ns_request;
-extern bool_t xdr_ns_request __P ((XDR *, ns_request*));
struct ib_request {
nis_name ibr_name;
@@ -376,14 +356,12 @@ struct ib_request {
netobj ibr_cookie;
};
typedef struct ib_request ib_request;
-extern bool_t xdr_ib_request __P ((XDR *, ib_request*));
struct ping_args {
nis_name dir;
u_long stamp;
};
typedef struct ping_args ping_args;
-extern bool_t xdr_ping_args __P ((XDR *, ping_args*));
enum log_entry_t {
LOG_NOP = 0,
@@ -397,7 +375,6 @@ enum log_entry_t {
UPD_STAMP = 8,
};
typedef enum log_entry_t log_entry_t;
-extern bool_t xdr_log_entry_t __P ((XDR *, log_entry_t*));
struct log_entry {
u_long le_time;
@@ -411,7 +388,6 @@ struct log_entry {
nis_object le_object;
};
typedef struct log_entry log_entry;
-extern bool_t xdr_log_entry __P ((XDR *, log_entry*));
struct log_result {
nis_error lr_status;
@@ -422,7 +398,6 @@ struct log_result {
} lr_entries;
};
typedef struct log_result log_result;
-extern bool_t xdr_log_result __P ((XDR *, log_result*));
struct cp_result {
nis_error cp_status;
@@ -430,14 +405,12 @@ struct cp_result {
u_long cp_dticks;
};
typedef struct cp_result cp_result;
-extern bool_t xdr_cp_result __P ((XDR *, cp_result*));
struct nis_tag {
u_long tag_type;
char *tag_val;
};
typedef struct nis_tag nis_tag;
-extern bool_t xdr_nis_tag __P ((XDR *, nis_tag*));
struct nis_taglist {
struct {
@@ -446,7 +419,6 @@ struct nis_taglist {
} tags;
};
typedef struct nis_taglist nis_taglist;
-extern bool_t xdr_nis_taglist __P ((XDR *, nis_taglist*));
struct dump_args {
nis_name da_dir;
@@ -457,14 +429,12 @@ struct dump_args {
} da_cbhost;
};
typedef struct dump_args dump_args;
-extern bool_t xdr_dump_args __P ((XDR *, dump_args*));
struct fd_args {
nis_name dir_name;
nis_name requester;
};
typedef struct fd_args fd_args;
-extern bool_t xdr_fd_args __P ((XDR *, fd_args*));
struct fd_result {
nis_error status;
@@ -479,7 +449,6 @@ struct fd_result {
} signature;
};
typedef struct fd_result fd_result;
-extern bool_t xdr_fd_result __P ((XDR *, fd_result*));
/* Generic client creating flags */
#define ZMH_VC 1
diff --git a/nis/rpcsvc/nis_callback.h b/nis/rpcsvc/nis_callback.h
new file mode 100644
index 0000000000..526a633831
--- /dev/null
+++ b/nis/rpcsvc/nis_callback.h
@@ -0,0 +1,71 @@
+/*
+ * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
+ * unrestricted use provided that this legend is included on all tape
+ * media and as a part of the software program in whole or part. Users
+ * may copy or modify Sun RPC without charge, but are not authorized
+ * to license or distribute it to anyone else except as part of a product or
+ * program developed by the user or with the express written consent of
+ * Sun Microsystems, Inc.
+ *
+ * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
+ * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
+ *
+ * Sun RPC is provided with no support and without any obligation on the
+ * part of Sun Microsystems, Inc. to assist in its use, correction,
+ * modification or enhancement.
+ *
+ * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
+ * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
+ * OR ANY PART THEREOF.
+ *
+ * In no event will Sun Microsystems, Inc. be liable for any lost revenue
+ * or profits or other special, indirect and consequential damages, even if
+ * Sun has been advised of the possibility of such damages.
+ *
+ * Sun Microsystems, Inc.
+ * 2550 Garcia Avenue
+ * Mountain View, California 94043
+ */
+#ifndef _RPCSVC_NIS_CALLBACK_H
+#define _RPCSVC_NIS_CALLBACK_H 1
+
+#include <rpc/rpc.h>
+#include <rpcsvc/nis.h>
+
+__BEGIN_DECLS
+
+typedef nis_object *obj_p;
+
+struct cback_data {
+ struct {
+ u_int entries_len;
+ obj_p *entries_val;
+ } entries;
+};
+typedef struct cback_data cback_data;
+
+#define CB_PROG ((u_long)100302)
+#define CB_VERS ((u_long)1)
+
+#define CBPROC_RECEIVE ((u_long)1)
+extern bool_t * cbproc_receive_1 __P ((cback_data *, CLIENT *));
+extern bool_t * cbproc_receive_1_svc __P ((cback_data *, struct svc_req *));
+
+#define CBPROC_FINISH ((u_long)2)
+extern void * cbproc_finish_1 __P ((void *, CLIENT *));
+extern void * cbproc_finish_1_svc __P ((void *, struct svc_req *));
+
+#define CBPROC_ERROR ((u_long)3)
+extern void * cbproc_error_1 __P ((nis_error *, CLIENT *));
+extern void * cbproc_error_1_svc __P ((nis_error *, struct svc_req *));
+extern int cb_prog_1_freeresult __P ((SVCXPRT *, xdrproc_t, caddr_t));
+
+/* the xdr functions */
+
+extern bool_t xdr_obj_p __P ((XDR *, obj_p*));
+extern bool_t xdr_cback_data __P ((XDR *, cback_data*));
+
+__END_DECLS
+
+#endif /* !_RPCVSC_NIS_CALLBACK_H */
diff --git a/sunrpc/svc.c b/sunrpc/svc.c
index 93d8bbd993..c4b91aa074 100644
--- a/sunrpc/svc.c
+++ b/sunrpc/svc.c
@@ -374,8 +374,7 @@ svcerr_progvers (xprt, low_vers, high_vers)
*/
void
-svc_getreq (rdfds)
- int rdfds;
+svc_getreq (int rdfds)
{
#ifdef FD_SETSIZE
fd_set readfds;
@@ -435,6 +434,10 @@ svc_getreqset (readfds)
/* sock has input waiting */
xprt = xports[sock];
#endif /* def FD_SETSIZE */
+ if (xprt == NULL)
+ /* But do we control sock? */
+ continue;
+
/* now receive msgs from xprtprt (support batch calls) */
do
{
@@ -481,8 +484,7 @@ svc_getreqset (readfds)
* is not served ...
*/
if (prog_found)
- svcerr_progvers (xprt,
- low_vers, high_vers);
+ svcerr_progvers (xprt, low_vers, high_vers);
else
svcerr_noprog (xprt);
/* Fall through to ... */