aboutsummaryrefslogtreecommitdiff
path: root/nis/nis_callback.c
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 /nis/nis_callback.c
parentfed8f7f7aeb06dfae0dfbfb085c6857cc457c254 (diff)
downloadglibc-91eee4dd69397fa6e7b328022670d459f582b047.zip
glibc-91eee4dd69397fa6e7b328022670d459f582b047.tar.gz
glibc-91eee4dd69397fa6e7b328022670d459f582b047.tar.bz2
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.
Diffstat (limited to 'nis/nis_callback.c')
-rw-r--r--nis/nis_callback.c67
1 files changed, 18 insertions, 49 deletions
diff --git a/nis/nis_callback.c b/nis/nis_callback.c
index 9d138fd..4c5693a 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);