forked from lattera/glibc
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1998-06-16 Thorsten Kukuk <[email protected]> * 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.
- Loading branch information
Ulrich Drepper
committed
Jun 16, 1998
1 parent
fed8f7f
commit 91eee4d
Showing
33 changed files
with
579 additions
and
481 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,43 @@ | ||
1998-06-16 Thorsten Kukuk <[email protected]> | ||
|
||
* 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 <[email protected]> | ||
|
||
* iconvdata/ksc5601.h: Clean up a bit. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 <[email protected]>, 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); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,39 +31,23 @@ | |
#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 | ||
functions doesn't send us a nis_result obj, so we don't have a | ||
cookie. Maybe we could use keys for threads ? Have to learn more | ||
about pthreads -- [email protected] */ | ||
|
||
#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,14 +291,15 @@ __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; | ||
cb->serv->pkey.n_len = 0; | ||
} | ||
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); | ||
|
||
|
Oops, something went wrong.