mirror of
https://sourceware.org/git/glibc.git
synced 2024-12-22 10:50:07 +00:00
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.
This commit is contained in:
parent
fed8f7f7ae
commit
91eee4dd69
40
ChangeLog
40
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>
|
1998-06-15 18:07 Ulrich Drepper <drepper@cygnus.com>
|
||||||
|
|
||||||
* iconvdata/ksc5601.h: Clean up a bit.
|
* iconvdata/ksc5601.h: Clean up a bit.
|
||||||
|
@ -51,6 +51,8 @@ GLIBC_2.1 {
|
|||||||
nis_sperror; nis_sperror_r; nis_stats;
|
nis_sperror; nis_sperror_r; nis_stats;
|
||||||
nis_verifygroup; nis_write_obj;
|
nis_verifygroup; nis_write_obj;
|
||||||
|
|
||||||
|
xdr_cback_data; xdr_obj_p;
|
||||||
|
|
||||||
# This functions are needed by the NIS+ tools and rpc.nisd,
|
# This functions are needed by the NIS+ tools and rpc.nisd,
|
||||||
# they should never be used in a normal user program !
|
# they should never be used in a normal user program !
|
||||||
__do_niscall2; __free_fdresult; __nis_default_access;
|
__do_niscall2; __free_fdresult; __nis_default_access;
|
||||||
|
@ -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.
|
This file is part of the GNU C Library.
|
||||||
Contributed by Thorsten Kukuk <kukuk@uni-paderborn.de>, 1997.
|
Contributed by Thorsten Kukuk <kukuk@uni-paderborn.de>, 1997.
|
||||||
|
|
||||||
@ -19,53 +19,52 @@
|
|||||||
|
|
||||||
#include <rpcsvc/nis.h>
|
#include <rpcsvc/nis.h>
|
||||||
|
|
||||||
|
#include "nis_xdr.h"
|
||||||
#include "nis_intern.h"
|
#include "nis_intern.h"
|
||||||
|
|
||||||
nis_result *
|
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_result *res;
|
||||||
nis_error status;
|
nis_error status;
|
||||||
struct ns_request req;
|
struct ns_request req;
|
||||||
char *p1, *p2, *p3, *p4;
|
|
||||||
char buf1 [strlen (name) + 20];
|
char buf1 [strlen (name) + 20];
|
||||||
char buf4 [strlen (name) + 20];
|
char buf4 [strlen (name) + 20];
|
||||||
|
|
||||||
res = calloc (1, sizeof (nis_result));
|
res = calloc (1, sizeof (nis_result));
|
||||||
|
if (res == NULL)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
req.ns_name = (char *)name;
|
req.ns_name = (char *)name;
|
||||||
|
|
||||||
|
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));
|
||||||
|
|
||||||
|
if (obj.zo_owner == NULL || strlen (obj.zo_owner) == 0)
|
||||||
|
obj.zo_owner = nis_local_principal ();
|
||||||
|
|
||||||
|
if (obj.zo_group == NULL || strlen (obj.zo_group) == 0)
|
||||||
|
obj.zo_group = nis_local_group ();
|
||||||
|
|
||||||
|
obj.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;
|
req.ns_object.ns_object_len = 1;
|
||||||
req.ns_object.ns_object_val = nis_clone_object (obj, NULL);
|
|
||||||
|
|
||||||
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));
|
|
||||||
|
|
||||||
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 ();
|
|
||||||
|
|
||||||
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 ();
|
|
||||||
|
|
||||||
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));
|
|
||||||
|
|
||||||
if ((status = __do_niscall (req.ns_object.ns_object_val[0].zo_domain,
|
if ((status = __do_niscall (req.ns_object.ns_object_val[0].zo_domain,
|
||||||
NIS_ADD, (xdrproc_t) xdr_ns_request,
|
NIS_ADD, (xdrproc_t) _xdr_ns_request,
|
||||||
(caddr_t) &req, (xdrproc_t) xdr_nis_result,
|
(caddr_t) &req, (xdrproc_t) _xdr_nis_result,
|
||||||
(caddr_t) res, MASTER_ONLY,
|
(caddr_t) res, MASTER_ONLY,
|
||||||
NULL)) != RPC_SUCCESS)
|
NULL)) != RPC_SUCCESS)
|
||||||
res->status = status;
|
NIS_RES_STATUS (res) = 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_destroy_object (req.ns_object.ns_object_val);
|
nis_destroy_object (req.ns_object.ns_object_val);
|
||||||
|
|
||||||
|
@ -20,8 +20,9 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <rpcsvc/nis.h>
|
#include <rpcsvc/nis.h>
|
||||||
#include "nis_intern.h"
|
|
||||||
|
|
||||||
|
#include "nis_xdr.h"
|
||||||
|
#include "nis_intern.h"
|
||||||
#include "nis_cache2.h"
|
#include "nis_cache2.h"
|
||||||
|
|
||||||
static struct timeval TIMEOUT = { 25, 0 };
|
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,
|
xdrmem_create (&xdrs, fsres.dir_data.dir_data_val,
|
||||||
fsres.dir_data.dir_data_len, XDR_DECODE);
|
fsres.dir_data.dir_data_len, XDR_DECODE);
|
||||||
xdr_directory_obj (&xdrs, obj);
|
_xdr_directory_obj (&xdrs, obj);
|
||||||
xdr_destroy (&xdrs);
|
xdr_destroy (&xdrs);
|
||||||
|
|
||||||
cinfo->server_used = fsres.server_used;
|
cinfo->server_used = fsres.server_used;
|
||||||
|
@ -5,14 +5,16 @@
|
|||||||
|
|
||||||
#include <rpc/types.h>
|
#include <rpc/types.h>
|
||||||
#include <rpc/xdr.h>
|
#include <rpc/xdr.h>
|
||||||
|
|
||||||
#include "nis_cache2.h"
|
|
||||||
#include <rpcsvc/nis.h>
|
#include <rpcsvc/nis.h>
|
||||||
|
|
||||||
|
#include "nis_xdr.h"
|
||||||
|
#include "nis_cache2.h"
|
||||||
|
|
||||||
|
|
||||||
bool_t
|
bool_t
|
||||||
xdr_fs_result(XDR *xdrs, fs_result *objp)
|
xdr_fs_result(XDR *xdrs, fs_result *objp)
|
||||||
{
|
{
|
||||||
if (!xdr_nis_error(xdrs, &objp->status)) {
|
if (!_xdr_nis_error(xdrs, &objp->status)) {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
if (!xdr_long(xdrs, &objp->class)) {
|
if (!xdr_long(xdrs, &objp->class)) {
|
||||||
@ -33,7 +35,7 @@ xdr_fs_result(XDR *xdrs, fs_result *objp)
|
|||||||
bool_t
|
bool_t
|
||||||
xdr_fs_request(XDR *xdrs, fs_request *objp)
|
xdr_fs_request(XDR *xdrs, fs_request *objp)
|
||||||
{
|
{
|
||||||
if (!xdr_nis_name(xdrs, &objp->name)) {
|
if (!_xdr_nis_name(xdrs, &objp->name)) {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
if (!xdr_long(xdrs, &objp->old_class)) {
|
if (!xdr_long(xdrs, &objp->old_class)) {
|
||||||
|
@ -26,6 +26,8 @@
|
|||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
|
|
||||||
|
#include "nis_xdr.h"
|
||||||
#include "nis_intern.h"
|
#include "nis_intern.h"
|
||||||
|
|
||||||
static struct timeval RPCTIMEOUT = {10, 0};
|
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));
|
obj = calloc(1, sizeof(directory_obj));
|
||||||
xdrmem_create(&xdrs, fd_res->dir_data.dir_data_val,
|
xdrmem_create(&xdrs, fd_res->dir_data.dir_data_val,
|
||||||
fd_res->dir_data.dir_data_len, XDR_DECODE);
|
fd_res->dir_data.dir_data_len, XDR_DECODE);
|
||||||
xdr_directory_obj(&xdrs, obj);
|
_xdr_directory_obj(&xdrs, obj);
|
||||||
xdr_destroy(&xdrs);
|
xdr_destroy(&xdrs);
|
||||||
__free_fdresult (fd_res);
|
__free_fdresult (fd_res);
|
||||||
if (obj != NULL)
|
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));
|
obj = calloc(1, sizeof(directory_obj));
|
||||||
xdrmem_create(&xdrs, fd_res->dir_data.dir_data_val,
|
xdrmem_create(&xdrs, fd_res->dir_data.dir_data_val,
|
||||||
fd_res->dir_data.dir_data_len, XDR_DECODE);
|
fd_res->dir_data.dir_data_len, XDR_DECODE);
|
||||||
xdr_directory_obj(&xdrs, obj);
|
_xdr_directory_obj(&xdrs, obj);
|
||||||
xdr_destroy(&xdrs);
|
xdr_destroy(&xdrs);
|
||||||
__free_fdresult (fd_res);
|
__free_fdresult (fd_res);
|
||||||
if (obj != NULL)
|
if (obj != NULL)
|
||||||
@ -576,8 +578,8 @@ first_shoot (const_nis_name name, directory_obj *dir, u_long flags)
|
|||||||
return NULL;
|
return NULL;
|
||||||
xdrmem_create(&xdrs, fd_res->dir_data.dir_data_val,
|
xdrmem_create(&xdrs, fd_res->dir_data.dir_data_val,
|
||||||
fd_res->dir_data.dir_data_len, XDR_DECODE);
|
fd_res->dir_data.dir_data_len, XDR_DECODE);
|
||||||
xdr_directory_obj(&xdrs, obj);
|
_xdr_directory_obj (&xdrs, obj);
|
||||||
xdr_destroy(&xdrs);
|
xdr_destroy (&xdrs);
|
||||||
__free_fdresult (fd_res);
|
__free_fdresult (fd_res);
|
||||||
if (obj != NULL)
|
if (obj != NULL)
|
||||||
{
|
{
|
||||||
|
@ -31,8 +31,10 @@
|
|||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
#include <rpc/key_prot.h>
|
#include <rpc/key_prot.h>
|
||||||
#include <rpcsvc/nis.h>
|
#include <rpcsvc/nis.h>
|
||||||
|
#include <rpcsvc/nis_callback.h>
|
||||||
#include <bits/libc-lock.h>
|
#include <bits/libc-lock.h>
|
||||||
|
|
||||||
|
#include "nis_xdr.h"
|
||||||
#include "nis_intern.h"
|
#include "nis_intern.h"
|
||||||
|
|
||||||
/* Sorry, we are not able to make this threadsafe. Stupid. But some
|
/* 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
|
cookie. Maybe we could use keys for threads ? Have to learn more
|
||||||
about pthreads -- kukuk@vt.uni-paderborn.de */
|
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;
|
static nis_cb *data;
|
||||||
|
|
||||||
__libc_lock_define_initialized (static, callback)
|
__libc_lock_define_initialized (static, callback)
|
||||||
|
|
||||||
|
|
||||||
|
#if 0
|
||||||
static char *
|
static char *
|
||||||
__nis_getpkey(const char *sname)
|
__nis_getpkey(const char *sname)
|
||||||
{
|
{
|
||||||
@ -91,7 +75,7 @@ __nis_getpkey(const char *sname)
|
|||||||
if (res == NULL)
|
if (res == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (res->status != NIS_SUCCESS)
|
if (NIS_RES_STATUS (res) != NIS_SUCCESS)
|
||||||
{
|
{
|
||||||
nis_freeresult (res);
|
nis_freeresult (res);
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -108,9 +92,7 @@ __nis_getpkey(const char *sname)
|
|||||||
|
|
||||||
return strdup (pkey);
|
return strdup (pkey);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static bool_t xdr_cback_data (XDR *, cback_data *);
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
cb_prog_1 (struct svc_req *rqstp, SVCXPRT *transp)
|
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;
|
result = (char *) &bool_result;
|
||||||
break;
|
break;
|
||||||
case CBPROC_ERROR:
|
case CBPROC_ERROR:
|
||||||
xdr_argument = (xdrproc_t) xdr_nis_error;
|
xdr_argument = (xdrproc_t) _xdr_nis_error;
|
||||||
xdr_result = (xdrproc_t) xdr_void;
|
xdr_result = (xdrproc_t) xdr_void;
|
||||||
memset (&argument, 0, sizeof (argument));
|
memset (&argument, 0, sizeof (argument));
|
||||||
if (!svc_getargs (transp, xdr_argument, (caddr_t) & argument))
|
if (!svc_getargs (transp, xdr_argument, (caddr_t) & argument))
|
||||||
@ -208,25 +190,6 @@ cb_prog_1 (struct svc_req *rqstp, SVCXPRT *transp)
|
|||||||
return;
|
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
|
static nis_error
|
||||||
internal_nis_do_callback (struct dir_binding *bptr, netobj *cookie,
|
internal_nis_do_callback (struct dir_binding *bptr, netobj *cookie,
|
||||||
struct nis_cb *cb)
|
struct nis_cb *cb)
|
||||||
@ -319,7 +282,7 @@ __nis_create_callback (int (*callback) (const_nis_name, const nis_object *,
|
|||||||
{
|
{
|
||||||
free (cb);
|
free (cb);
|
||||||
syslog (LOG_ERR, "NIS+: out of memory allocating callback");
|
syslog (LOG_ERR, "NIS+: out of memory allocating callback");
|
||||||
return (NULL);
|
return NULL;
|
||||||
}
|
}
|
||||||
cb->serv->name = strdup (nis_local_principal ());
|
cb->serv->name = strdup (nis_local_principal ());
|
||||||
cb->serv->ep.ep_val = (endpoint *) calloc (2, sizeof (endpoint));
|
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->callback = callback;
|
||||||
cb->userdata = userdata;
|
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->key_type = NIS_PK_NONE;
|
||||||
cb->serv->pkey.n_bytes = NULL;
|
cb->serv->pkey.n_bytes = NULL;
|
||||||
@ -336,6 +299,7 @@ __nis_create_callback (int (*callback) (const_nis_name, const nis_object *,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
#if 0
|
||||||
if ((cb->serv->pkey.n_bytes = __nis_getpkey (cb->serv->name)) == NULL)
|
if ((cb->serv->pkey.n_bytes = __nis_getpkey (cb->serv->name)) == NULL)
|
||||||
{
|
{
|
||||||
cb->serv->pkey.n_len = 0;
|
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->key_type = NIS_PK_DH;
|
||||||
cb->serv->pkey.n_len = strlen(cb->serv->pkey.n_bytes);
|
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)
|
if (flags & USE_DGRAM)
|
||||||
@ -363,7 +332,7 @@ __nis_create_callback (int (*callback) (const_nis_name, const nis_object *,
|
|||||||
{
|
{
|
||||||
xprt_unregister (cb->xprt);
|
xprt_unregister (cb->xprt);
|
||||||
svc_destroy (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->serv);
|
||||||
free (cb);
|
free (cb);
|
||||||
syslog (LOG_ERR, "NIS+: failed to register callback dispatcher");
|
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);
|
xprt_unregister (cb->xprt);
|
||||||
svc_destroy (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->serv);
|
||||||
free (cb);
|
free (cb);
|
||||||
syslog (LOG_ERR, "NIS+: failed to read local socket info");
|
syslog (LOG_ERR, "NIS+: failed to read local socket info");
|
||||||
return (NULL);
|
return NULL;
|
||||||
}
|
}
|
||||||
port = sin.sin_port;
|
port = sin.sin_port;
|
||||||
get_myaddress (&sin);
|
get_myaddress (&sin);
|
||||||
@ -395,7 +364,7 @@ __nis_destroy_callback (struct nis_cb *cb)
|
|||||||
xprt_unregister (cb->xprt);
|
xprt_unregister (cb->xprt);
|
||||||
svc_destroy (cb->xprt);
|
svc_destroy (cb->xprt);
|
||||||
close (cb->sock);
|
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->serv);
|
||||||
free (cb);
|
free (cb);
|
||||||
|
|
||||||
|
@ -18,6 +18,8 @@
|
|||||||
Boston, MA 02111-1307, USA. */
|
Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
#include <rpcsvc/nis.h>
|
#include <rpcsvc/nis.h>
|
||||||
|
|
||||||
|
#include "nis_xdr.h"
|
||||||
#include "nis_intern.h"
|
#include "nis_intern.h"
|
||||||
|
|
||||||
nis_result *
|
nis_result *
|
||||||
@ -26,10 +28,11 @@ nis_checkpoint(const_nis_name dirname)
|
|||||||
nis_result *res;
|
nis_result *res;
|
||||||
|
|
||||||
res = calloc (1, sizeof (nis_result));
|
res = calloc (1, sizeof (nis_result));
|
||||||
|
if (res == NULL)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
if (dirname != NULL)
|
if (dirname != NULL)
|
||||||
{
|
{
|
||||||
cp_result *cpres = NULL;
|
|
||||||
nis_result *res2;
|
nis_result *res2;
|
||||||
u_int i;
|
u_int i;
|
||||||
|
|
||||||
@ -48,16 +51,19 @@ nis_checkpoint(const_nis_name dirname)
|
|||||||
for (i = 0;
|
for (i = 0;
|
||||||
i < NIS_RES_OBJECT (res2)->DI_data.do_servers.do_servers_len; ++i)
|
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],
|
if (__do_niscall2 (&NIS_RES_OBJECT(res2)->DI_data.do_servers.do_servers_val[i],
|
||||||
1, NIS_CHECKPOINT, (xdrproc_t) xdr_nis_name,
|
1, NIS_CHECKPOINT, (xdrproc_t) _xdr_nis_name,
|
||||||
(caddr_t) &dirname, (xdrproc_t) xdr_cp_result,
|
(caddr_t) &dirname, (xdrproc_t) _xdr_cp_result,
|
||||||
(caddr_t) &cpres, 0, NULL, NULL) != RPC_SUCCESS)
|
(caddr_t) &cpres, 0, NULL, NULL) != NIS_SUCCESS)
|
||||||
NIS_RES_STATUS (res) = NIS_RPCERROR;
|
NIS_RES_STATUS (res) = NIS_RPCERROR;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
res->status += cpres->cp_status;
|
NIS_RES_STATUS (res) = cpres.cp_status;
|
||||||
res->zticks += cpres->cp_zticks;
|
res->zticks += cpres.cp_zticks;
|
||||||
res->dticks += cpres->cp_dticks;
|
res->dticks += cpres.cp_dticks;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
nis_freeresult (res2);
|
nis_freeresult (res2);
|
||||||
|
@ -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.
|
This file is part of the GNU C Library.
|
||||||
Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
|
Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
|
||||||
|
|
||||||
@ -21,6 +21,8 @@
|
|||||||
#include <rpc/rpc.h>
|
#include <rpc/rpc.h>
|
||||||
#include <rpcsvc/nis.h>
|
#include <rpcsvc/nis.h>
|
||||||
|
|
||||||
|
#include "nis_xdr.h"
|
||||||
|
|
||||||
directory_obj *
|
directory_obj *
|
||||||
nis_clone_directory (const directory_obj *src, directory_obj *dest)
|
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)
|
if (src == NULL)
|
||||||
return (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)
|
if ((addr = calloc(1, size)) == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
@ -48,7 +50,7 @@ nis_clone_directory (const directory_obj *src, directory_obj *dest)
|
|||||||
res = dest;
|
res = dest;
|
||||||
|
|
||||||
xdrmem_create(&xdrs, addr, size, XDR_ENCODE);
|
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);
|
xdr_destroy (&xdrs);
|
||||||
free (addr);
|
free (addr);
|
||||||
@ -56,7 +58,7 @@ nis_clone_directory (const directory_obj *src, directory_obj *dest)
|
|||||||
}
|
}
|
||||||
xdr_destroy (&xdrs);
|
xdr_destroy (&xdrs);
|
||||||
xdrmem_create (&xdrs, addr, size, XDR_DECODE);
|
xdrmem_create (&xdrs, addr, size, XDR_DECODE);
|
||||||
if (!xdr_directory_obj (&xdrs, res))
|
if (!_xdr_directory_obj (&xdrs, res))
|
||||||
{
|
{
|
||||||
xdr_destroy (&xdrs);
|
xdr_destroy (&xdrs);
|
||||||
free (addr);
|
free (addr);
|
||||||
|
@ -21,6 +21,8 @@
|
|||||||
#include <rpc/rpc.h>
|
#include <rpc/rpc.h>
|
||||||
#include <rpcsvc/nis.h>
|
#include <rpcsvc/nis.h>
|
||||||
|
|
||||||
|
#include "nis_xdr.h"
|
||||||
|
|
||||||
nis_object *
|
nis_object *
|
||||||
nis_clone_object (const nis_object *src, nis_object *dest)
|
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)
|
if (src == NULL)
|
||||||
return (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)
|
if ((addr = calloc(1, size)) == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
@ -48,7 +50,7 @@ nis_clone_object (const nis_object *src, nis_object *dest)
|
|||||||
res = dest;
|
res = dest;
|
||||||
|
|
||||||
xdrmem_create(&xdrs, addr, size, XDR_ENCODE);
|
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);
|
xdr_destroy (&xdrs);
|
||||||
free (addr);
|
free (addr);
|
||||||
@ -56,7 +58,7 @@ nis_clone_object (const nis_object *src, nis_object *dest)
|
|||||||
}
|
}
|
||||||
xdr_destroy (&xdrs);
|
xdr_destroy (&xdrs);
|
||||||
xdrmem_create(&xdrs, addr, size, XDR_DECODE);
|
xdrmem_create(&xdrs, addr, size, XDR_DECODE);
|
||||||
if (!xdr_nis_object(&xdrs, res))
|
if (!_xdr_nis_object(&xdrs, res))
|
||||||
{
|
{
|
||||||
xdr_destroy (&xdrs);
|
xdr_destroy (&xdrs);
|
||||||
free (addr);
|
free (addr);
|
||||||
|
@ -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.
|
This file is part of the GNU C Library.
|
||||||
Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
|
Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
|
||||||
|
|
||||||
@ -21,6 +21,8 @@
|
|||||||
#include <rpc/rpc.h>
|
#include <rpc/rpc.h>
|
||||||
#include <rpcsvc/nis.h>
|
#include <rpcsvc/nis.h>
|
||||||
|
|
||||||
|
#include "nis_xdr.h"
|
||||||
|
|
||||||
nis_result *
|
nis_result *
|
||||||
nis_clone_result (const nis_result *src, nis_result *dest)
|
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)
|
if (src == NULL)
|
||||||
return (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)
|
if ((addr = calloc(1, size)) == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
@ -48,7 +50,7 @@ nis_clone_result (const nis_result *src, nis_result *dest)
|
|||||||
res = dest;
|
res = dest;
|
||||||
|
|
||||||
xdrmem_create(&xdrs, addr, size, XDR_ENCODE);
|
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);
|
xdr_destroy (&xdrs);
|
||||||
free (addr);
|
free (addr);
|
||||||
@ -56,7 +58,7 @@ nis_clone_result (const nis_result *src, nis_result *dest)
|
|||||||
}
|
}
|
||||||
xdr_destroy (&xdrs);
|
xdr_destroy (&xdrs);
|
||||||
xdrmem_create(&xdrs, addr, size, XDR_DECODE);
|
xdrmem_create(&xdrs, addr, size, XDR_DECODE);
|
||||||
if (!xdr_nis_result(&xdrs, res))
|
if (!_xdr_nis_result(&xdrs, res))
|
||||||
{
|
{
|
||||||
xdr_destroy (&xdrs);
|
xdr_destroy (&xdrs);
|
||||||
free (addr);
|
free (addr);
|
||||||
|
@ -62,7 +62,7 @@ nis_creategroup (const_nis_name group, u_long flags)
|
|||||||
res = nis_add (buf, obj);
|
res = nis_add (buf, obj);
|
||||||
if (res == NULL)
|
if (res == NULL)
|
||||||
return NIS_NOMEMORY;
|
return NIS_NOMEMORY;
|
||||||
status = res->status;
|
status = NIS_RES_STATUS (res);
|
||||||
nis_freeresult (res);
|
nis_freeresult (res);
|
||||||
nis_free_object (obj);
|
nis_free_object (obj);
|
||||||
|
|
||||||
|
@ -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.
|
This file is part of the GNU C Library.
|
||||||
Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
|
Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
|
||||||
|
|
||||||
@ -21,6 +21,7 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <rpcsvc/nis.h>
|
#include <rpcsvc/nis.h>
|
||||||
|
#include "nis_xdr.h"
|
||||||
|
|
||||||
static const char cold_start_file[] = "/var/nis/NIS_COLD_START";
|
static const char cold_start_file[] = "/var/nis/NIS_COLD_START";
|
||||||
|
|
||||||
@ -36,7 +37,7 @@ readColdStartFile (void)
|
|||||||
return NULL;
|
return NULL;
|
||||||
memset (&obj, '\0', sizeof (obj));
|
memset (&obj, '\0', sizeof (obj));
|
||||||
xdrstdio_create (&xdrs, in, XDR_DECODE);
|
xdrstdio_create (&xdrs, in, XDR_DECODE);
|
||||||
if (!xdr_directory_obj (&xdrs, &obj))
|
if (!_xdr_directory_obj (&xdrs, &obj))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
return nis_clone_directory (&obj, NULL);
|
return nis_clone_directory (&obj, NULL);
|
||||||
@ -53,7 +54,7 @@ writeColdStartFile (const directory_obj *obj)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
xdrstdio_create (&xdrs, out, XDR_ENCODE);
|
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 FALSE;
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@ -72,7 +73,7 @@ nis_read_obj (const char *name)
|
|||||||
|
|
||||||
memset (&obj, '\0', sizeof (obj));
|
memset (&obj, '\0', sizeof (obj));
|
||||||
xdrstdio_create (&xdrs, in, XDR_DECODE);
|
xdrstdio_create (&xdrs, in, XDR_DECODE);
|
||||||
if (!xdr_nis_object (&xdrs, &obj))
|
if (!_xdr_nis_object (&xdrs, &obj))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
return nis_clone_object (&obj, NULL);
|
return nis_clone_object (&obj, NULL);
|
||||||
@ -89,7 +90,7 @@ nis_write_obj (const char *name, const nis_object *obj)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
xdrstdio_create (&xdrs, out, XDR_ENCODE);
|
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 FALSE;
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -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.
|
This file is part of the GNU C Library.
|
||||||
Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
|
Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
|
||||||
|
|
||||||
@ -18,13 +18,14 @@
|
|||||||
Boston, MA 02111-1307, USA. */
|
Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
#include <rpcsvc/nis.h>
|
#include <rpcsvc/nis.h>
|
||||||
|
#include "nis_xdr.h"
|
||||||
|
|
||||||
void
|
void
|
||||||
__free_fdresult (fd_result *res)
|
__free_fdresult (fd_result *res)
|
||||||
{
|
{
|
||||||
if (res != NULL)
|
if (res != NULL)
|
||||||
{
|
{
|
||||||
xdr_free ((xdrproc_t)xdr_fd_result, (char *)res);
|
xdr_free ((xdrproc_t)_xdr_fd_result, (char *)res);
|
||||||
free (res);
|
free (res);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -34,7 +35,7 @@ nis_free_request (ib_request *ibreq)
|
|||||||
{
|
{
|
||||||
if (ibreq != NULL)
|
if (ibreq != NULL)
|
||||||
{
|
{
|
||||||
xdr_free ((xdrproc_t)xdr_ib_request, (char *)ibreq);
|
xdr_free ((xdrproc_t)_xdr_ib_request, (char *)ibreq);
|
||||||
free (ibreq);
|
free (ibreq);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -44,7 +45,7 @@ nis_free_directory (directory_obj *obj)
|
|||||||
{
|
{
|
||||||
if (obj != NULL)
|
if (obj != NULL)
|
||||||
{
|
{
|
||||||
xdr_free ((xdrproc_t)xdr_directory_obj, (char *)obj);
|
xdr_free ((xdrproc_t)_xdr_directory_obj, (char *)obj);
|
||||||
free (obj);
|
free (obj);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -54,7 +55,7 @@ nis_free_object (nis_object *obj)
|
|||||||
{
|
{
|
||||||
if (obj != NULL)
|
if (obj != NULL)
|
||||||
{
|
{
|
||||||
xdr_free ((xdrproc_t)xdr_nis_object, (char *)obj);
|
xdr_free ((xdrproc_t)_xdr_nis_object, (char *)obj);
|
||||||
free (obj);
|
free (obj);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -64,7 +65,7 @@ nis_freeresult (nis_result *res)
|
|||||||
{
|
{
|
||||||
if (res != NULL)
|
if (res != NULL)
|
||||||
{
|
{
|
||||||
xdr_free ((xdrproc_t)xdr_nis_result, (char *)res);
|
xdr_free ((xdrproc_t)_xdr_nis_result, (char *)res);
|
||||||
free (res);
|
free (res);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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.
|
This file is part of the GNU C Library.
|
||||||
Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
|
Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
|
||||||
|
|
||||||
@ -19,6 +19,8 @@
|
|||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <rpcsvc/nis.h>
|
#include <rpcsvc/nis.h>
|
||||||
|
|
||||||
|
#include "nis_xdr.h"
|
||||||
#include "nis_intern.h"
|
#include "nis_intern.h"
|
||||||
|
|
||||||
nis_server **
|
nis_server **
|
||||||
@ -111,7 +113,7 @@ nis_freeservlist (nis_server **serv)
|
|||||||
i = 0;
|
i = 0;
|
||||||
while (serv[i] != NULL)
|
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]);
|
free (serv[i]);
|
||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
|
@ -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.
|
This file is part of the GNU C Library.
|
||||||
Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
|
Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
|
||||||
|
|
||||||
@ -115,7 +115,7 @@ nis_local_principal (void)
|
|||||||
if (res == NULL)
|
if (res == NULL)
|
||||||
return strcpy (__principal, "nobody");
|
return strcpy (__principal, "nobody");
|
||||||
|
|
||||||
if (res->status == NIS_SUCCESS)
|
if (NIS_RES_STATUS (res) == NIS_SUCCESS)
|
||||||
{
|
{
|
||||||
if (res->objects.objects_len > 1)
|
if (res->objects.objects_len > 1)
|
||||||
{
|
{
|
||||||
|
@ -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.
|
This file is part of the GNU C Library.
|
||||||
Contributed by Thorsten Kukuk <kukuk@uni-paderborn.de>, 1997.
|
Contributed by Thorsten Kukuk <kukuk@uni-paderborn.de>, 1997.
|
||||||
|
|
||||||
@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <rpcsvc/nis.h>
|
#include <rpcsvc/nis.h>
|
||||||
|
#include "nis_xdr.h"
|
||||||
#include "nis_intern.h"
|
#include "nis_intern.h"
|
||||||
|
|
||||||
nis_result *
|
nis_result *
|
||||||
@ -35,20 +35,22 @@ nis_lookup (const_nis_name name, const u_long flags)
|
|||||||
nis_name namebuf[2] = {NULL, NULL};
|
nis_name namebuf[2] = {NULL, NULL};
|
||||||
|
|
||||||
res = calloc (1, sizeof (nis_result));
|
res = calloc (1, sizeof (nis_result));
|
||||||
|
if (res == NULL)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
if (flags & EXPAND_NAME)
|
if (flags & EXPAND_NAME)
|
||||||
{
|
{
|
||||||
names = nis_getnames (name);
|
names = nis_getnames (name);
|
||||||
if (names == NULL)
|
if (names == NULL)
|
||||||
{
|
{
|
||||||
res->status = NIS_NAMEUNREACHABLE;
|
NIS_RES_STATUS (res) = NIS_NAMEUNREACHABLE;
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
names = namebuf;
|
names = namebuf;
|
||||||
names[0] = (nis_name) name;
|
names[0] = (nis_name)name;
|
||||||
}
|
}
|
||||||
|
|
||||||
req.ns_name = names[0];
|
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));
|
memset (res, '\0', sizeof (nis_result));
|
||||||
|
|
||||||
status = __do_niscall (req.ns_name, NIS_LOOKUP,
|
status = __do_niscall (req.ns_name, NIS_LOOKUP,
|
||||||
(xdrproc_t) xdr_ns_request,
|
(xdrproc_t) _xdr_ns_request,
|
||||||
(caddr_t) & req,
|
(caddr_t) & req,
|
||||||
(xdrproc_t) xdr_nis_result,
|
(xdrproc_t) _xdr_nis_result,
|
||||||
(caddr_t) res, flags, NULL);
|
(caddr_t) res, flags, NULL);
|
||||||
if (status != NIS_SUCCESS)
|
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_PARTIAL:
|
||||||
case NIS_SUCCESS:
|
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 we hit the link limit, bail */
|
||||||
if (count_links > NIS_MAXLINKS)
|
if (count_links > NIS_MAXLINKS)
|
||||||
{
|
{
|
||||||
res->status = NIS_LINKNAMEERROR;
|
NIS_RES_STATUS (res) = NIS_LINKNAMEERROR;
|
||||||
++done;
|
++done;
|
||||||
break;
|
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);
|
req.ns_name = strdup (NIS_RES_OBJECT (res)->LI_data.li_name);
|
||||||
nis_freeresult (res);
|
nis_freeresult (res);
|
||||||
res = calloc (1, sizeof (nis_result));
|
res = calloc (1, sizeof (nis_result));
|
||||||
|
if (res == NULL)
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
++done;
|
++done;
|
||||||
@ -104,7 +108,7 @@ nis_lookup (const_nis_name name, const u_long flags)
|
|||||||
if (count_links)
|
if (count_links)
|
||||||
{
|
{
|
||||||
free (req.ns_name);
|
free (req.ns_name);
|
||||||
res->status = NIS_LINKNAMEERROR;
|
NIS_RES_STATUS (res) = NIS_LINKNAMEERROR;
|
||||||
++done;
|
++done;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -18,6 +18,8 @@
|
|||||||
Boston, MA 02111-1307, USA. */
|
Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
#include <rpcsvc/nis.h>
|
#include <rpcsvc/nis.h>
|
||||||
|
|
||||||
|
#include "nis_xdr.h"
|
||||||
#include "nis_intern.h"
|
#include "nis_intern.h"
|
||||||
|
|
||||||
nis_error
|
nis_error
|
||||||
@ -26,13 +28,13 @@ nis_mkdir (const_nis_name dir, const nis_server *server)
|
|||||||
nis_error res, res2;
|
nis_error res, res2;
|
||||||
|
|
||||||
if (server == NULL)
|
if (server == NULL)
|
||||||
res2 = __do_niscall (dir, NIS_MKDIR, (xdrproc_t) xdr_nis_name,
|
res2 = __do_niscall (dir, NIS_MKDIR, (xdrproc_t) _xdr_nis_name,
|
||||||
(caddr_t) &dir, (xdrproc_t) xdr_nis_error,
|
(caddr_t) &dir, (xdrproc_t) _xdr_nis_error,
|
||||||
(caddr_t) &res, 0, NULL);
|
(caddr_t) &res, 0, NULL);
|
||||||
else
|
else
|
||||||
res2 = __do_niscall2 (server, 1, NIS_MKDIR,
|
res2 = __do_niscall2 (server, 1, NIS_MKDIR,
|
||||||
(xdrproc_t) xdr_nis_name,
|
(xdrproc_t) _xdr_nis_name,
|
||||||
(caddr_t) &dir, (xdrproc_t) xdr_nis_error,
|
(caddr_t) &dir, (xdrproc_t) _xdr_nis_error,
|
||||||
(caddr_t) &res, 0, NULL, NULL);
|
(caddr_t) &res, 0, NULL, NULL);
|
||||||
if (res2 != NIS_SUCCESS)
|
if (res2 != NIS_SUCCESS)
|
||||||
return res2;
|
return res2;
|
||||||
|
@ -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.
|
This file is part of the GNU C Library.
|
||||||
Contributed by Thorsten Kukuk <kukuk@uni-paderborn.de>, 1997.
|
Contributed by Thorsten Kukuk <kukuk@uni-paderborn.de>, 1997.
|
||||||
|
|
||||||
@ -19,53 +19,54 @@
|
|||||||
|
|
||||||
#include <rpcsvc/nis.h>
|
#include <rpcsvc/nis.h>
|
||||||
|
|
||||||
|
#include "nis_xdr.h"
|
||||||
#include "nis_intern.h"
|
#include "nis_intern.h"
|
||||||
|
|
||||||
nis_result *
|
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_result *res;
|
||||||
nis_error status;
|
nis_error status;
|
||||||
struct ns_request req;
|
struct ns_request req;
|
||||||
char *p1, *p2, *p3, *p4;
|
size_t namelen = strlen (name);
|
||||||
char buf1 [strlen (name) + 20];
|
char buf1[namelen + 20];
|
||||||
char buf4 [strlen (name) + 20];
|
char buf4[namelen + 20];
|
||||||
|
|
||||||
res = calloc (1, sizeof (nis_result));
|
res = calloc (1, sizeof (nis_result));
|
||||||
|
if (res == NULL)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
req.ns_name = (char *) name;
|
req.ns_name = (char *)name;
|
||||||
|
|
||||||
|
memcpy (&obj, obj2, sizeof (nis_object));
|
||||||
|
|
||||||
|
if (obj.zo_name == NULL || obj.zo_name[0] == '\0')
|
||||||
|
obj.zo_name = nis_leaf_of_r (name, buf1, sizeof (buf1));
|
||||||
|
|
||||||
|
if (obj.zo_owner == NULL || obj.zo_owner[0] == '\0')
|
||||||
|
obj.zo_owner = nis_local_principal ();
|
||||||
|
|
||||||
|
if (obj.zo_group == NULL || obj.zo_group[0] == '\0')
|
||||||
|
obj.zo_group = nis_local_group ();
|
||||||
|
|
||||||
|
obj.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;
|
req.ns_object.ns_object_len = 1;
|
||||||
req.ns_object.ns_object_val = nis_clone_object (obj, NULL);
|
|
||||||
|
|
||||||
p1 = req.ns_object.ns_object_val[0].zo_name;
|
status = __do_niscall (name, NIS_MODIFY, (xdrproc_t) _xdr_ns_request,
|
||||||
if (p1 == NULL || strlen (p1) == 0)
|
(caddr_t) & req, (xdrproc_t) _xdr_nis_result,
|
||||||
req.ns_object.ns_object_val[0].zo_name =
|
(caddr_t) res, MASTER_ONLY,
|
||||||
nis_leaf_of_r (name, buf1, sizeof (buf1));
|
NULL);
|
||||||
|
if (status != RPC_SUCCESS)
|
||||||
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 ();
|
|
||||||
|
|
||||||
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 ();
|
|
||||||
|
|
||||||
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));
|
|
||||||
|
|
||||||
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;
|
NIS_RES_STATUS (res) = 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_destroy_object (req.ns_object.ns_object_val);
|
nis_destroy_object (req.ns_object.ns_object_val);
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
|
@ -18,6 +18,8 @@
|
|||||||
Boston, MA 02111-1307, USA. */
|
Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
#include <rpcsvc/nis.h>
|
#include <rpcsvc/nis.h>
|
||||||
|
|
||||||
|
#include "nis_xdr.h"
|
||||||
#include "nis_intern.h"
|
#include "nis_intern.h"
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -34,7 +36,7 @@ nis_ping (const_nis_name dirname, u_long utime, const nis_object *dirobj)
|
|||||||
if (dirobj == NULL)
|
if (dirobj == NULL)
|
||||||
{
|
{
|
||||||
res = nis_lookup (dirname, MASTER_ONLY);
|
res = nis_lookup (dirname, MASTER_ONLY);
|
||||||
if (res->status != NIS_SUCCESS)
|
if (NIS_RES_STATUS (res) != NIS_SUCCESS)
|
||||||
return;
|
return;
|
||||||
obj = res->objects.objects_val;
|
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.dir = (char *) dirname;
|
||||||
args.stamp = utime;
|
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,
|
__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) &args, (xdrproc_t) xdr_void,
|
||||||
(caddr_t) NULL, 0, NULL, NULL);
|
(caddr_t) NULL, 0, NULL, NULL);
|
||||||
if (res)
|
if (res)
|
||||||
|
@ -351,7 +351,7 @@ nis_print_result (const nis_result *res)
|
|||||||
{
|
{
|
||||||
unsigned int i;
|
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);
|
printf (_("Number of objects : %u\n"), res->objects.objects_len);
|
||||||
|
|
||||||
for (i = 0; i < res->objects.objects_len; i++)
|
for (i = 0; i < res->objects.objects_len; i++)
|
||||||
|
@ -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.
|
This file is part of the GNU C Library.
|
||||||
Contributed by Thorsten Kukuk <kukuk@uni-paderborn.de>, 1997.
|
Contributed by Thorsten Kukuk <kukuk@uni-paderborn.de>, 1997.
|
||||||
|
|
||||||
@ -19,6 +19,7 @@
|
|||||||
|
|
||||||
#include <rpcsvc/nis.h>
|
#include <rpcsvc/nis.h>
|
||||||
|
|
||||||
|
#include "nis_xdr.h"
|
||||||
#include "nis_intern.h"
|
#include "nis_intern.h"
|
||||||
|
|
||||||
nis_result *
|
nis_result *
|
||||||
@ -29,8 +30,10 @@ nis_remove (const_nis_name name, const nis_object *obj)
|
|||||||
struct ns_request req;
|
struct ns_request req;
|
||||||
|
|
||||||
res = calloc (1, sizeof (nis_result));
|
res = calloc (1, sizeof (nis_result));
|
||||||
|
if (res == NULL)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
req.ns_name = (char *) name;
|
req.ns_name = (char *)name;
|
||||||
|
|
||||||
if (obj != NULL)
|
if (obj != NULL)
|
||||||
{
|
{
|
||||||
@ -43,8 +46,8 @@ nis_remove (const_nis_name name, const nis_object *obj)
|
|||||||
req.ns_object.ns_object_val = NULL;
|
req.ns_object.ns_object_val = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((status = __do_niscall (name, NIS_REMOVE, (xdrproc_t) xdr_ns_request,
|
if ((status = __do_niscall (name, NIS_REMOVE, (xdrproc_t) _xdr_ns_request,
|
||||||
(caddr_t) & req, (xdrproc_t) xdr_nis_result,
|
(caddr_t) &req, (xdrproc_t) _xdr_nis_result,
|
||||||
(caddr_t) res, MASTER_ONLY,
|
(caddr_t) res, MASTER_ONLY,
|
||||||
NULL)) != RPC_SUCCESS)
|
NULL)) != RPC_SUCCESS)
|
||||||
NIS_RES_STATUS (res) = status;
|
NIS_RES_STATUS (res) = status;
|
||||||
|
@ -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.
|
This file is part of the GNU C Library.
|
||||||
Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
|
Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
|
||||||
|
|
||||||
@ -43,9 +43,9 @@ nis_removemember (const_nis_name member, const_nis_name group)
|
|||||||
stpcpy (cp, cp2);
|
stpcpy (cp, cp2);
|
||||||
}
|
}
|
||||||
res = nis_lookup (buf, FOLLOW_LINKS|EXPAND_NAME);
|
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);
|
nis_freeresult (res);
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
@ -57,6 +57,8 @@ nis_removemember (const_nis_name member, const_nis_name group)
|
|||||||
newmem =
|
newmem =
|
||||||
calloc (1, NIS_RES_OBJECT(res)->GR_data.gr_members.gr_members_len *
|
calloc (1, NIS_RES_OBJECT(res)->GR_data.gr_members.gr_members_len *
|
||||||
sizeof (char *));
|
sizeof (char *));
|
||||||
|
if (newmem == NULL)
|
||||||
|
return NIS_NOMEMORY;
|
||||||
k = NIS_RES_OBJECT (res)[0].GR_data.gr_members.gr_members_len;
|
k = NIS_RES_OBJECT (res)[0].GR_data.gr_members.gr_members_len;
|
||||||
j = 0;
|
j = 0;
|
||||||
for (i = 0; i < NIS_RES_OBJECT(res)->GR_data.gr_members.gr_members_len;
|
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);
|
free (NIS_RES_OBJECT (res)->GR_data.gr_members.gr_members_val);
|
||||||
newmem = realloc (newmem, k * sizeof (char*));
|
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_val = newmem;
|
||||||
NIS_RES_OBJECT (res)->GR_data.gr_members.gr_members_len = k;
|
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++ = '.';
|
*cp++ = '.';
|
||||||
strncpy (cp, NIS_RES_OBJECT (res)->zo_domain, NIS_MAXNAMELEN);
|
strncpy (cp, NIS_RES_OBJECT (res)->zo_domain, NIS_MAXNAMELEN);
|
||||||
res2 = nis_modify (buf, NIS_RES_OBJECT (res));
|
res2 = nis_modify (buf, NIS_RES_OBJECT (res));
|
||||||
status = res2->status;
|
status = NIS_RES_STATUS (res2);
|
||||||
nis_freeresult (res);
|
nis_freeresult (res);
|
||||||
nis_freeresult (res2);
|
nis_freeresult (res2);
|
||||||
|
|
||||||
|
@ -18,6 +18,8 @@
|
|||||||
Boston, MA 02111-1307, USA. */
|
Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
#include <rpcsvc/nis.h>
|
#include <rpcsvc/nis.h>
|
||||||
|
|
||||||
|
#include "nis_xdr.h"
|
||||||
#include "nis_intern.h"
|
#include "nis_intern.h"
|
||||||
|
|
||||||
nis_error
|
nis_error
|
||||||
@ -29,8 +31,8 @@ nis_rmdir (const_nis_name dir, const nis_server *server)
|
|||||||
return NIS_SYSTEMERROR;
|
return NIS_SYSTEMERROR;
|
||||||
|
|
||||||
res2 = __do_niscall2 (server, 1, NIS_RMDIR,
|
res2 = __do_niscall2 (server, 1, NIS_RMDIR,
|
||||||
(xdrproc_t) xdr_nis_name,
|
(xdrproc_t) _xdr_nis_name,
|
||||||
(caddr_t) &dir, (xdrproc_t) xdr_nis_error,
|
(caddr_t) &dir, (xdrproc_t) _xdr_nis_error,
|
||||||
(caddr_t) &res, 0, NULL, NULL);
|
(caddr_t) &res, 0, NULL, NULL);
|
||||||
if (res2 != NIS_SUCCESS)
|
if (res2 != NIS_SUCCESS)
|
||||||
return res2;
|
return res2;
|
||||||
|
@ -19,6 +19,8 @@
|
|||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <rpcsvc/nis.h>
|
#include <rpcsvc/nis.h>
|
||||||
|
|
||||||
|
#include "nis_xdr.h"
|
||||||
#include "nis_intern.h"
|
#include "nis_intern.h"
|
||||||
|
|
||||||
nis_error
|
nis_error
|
||||||
@ -37,8 +39,8 @@ nis_servstate (const nis_server *serv, const nis_tag *tags,
|
|||||||
if (serv == NULL)
|
if (serv == NULL)
|
||||||
return NIS_BADOBJECT;
|
return NIS_BADOBJECT;
|
||||||
|
|
||||||
if (__do_niscall2 (serv, 1, NIS_SERVSTATE, (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) &taglist, (xdrproc_t) _xdr_nis_taglist,
|
||||||
(caddr_t) &tagres, 0, NULL, NULL) != RPC_SUCCESS)
|
(caddr_t) &tagres, 0, NULL, NULL) != RPC_SUCCESS)
|
||||||
return NIS_RPCERROR;
|
return NIS_RPCERROR;
|
||||||
|
|
||||||
@ -63,8 +65,8 @@ nis_stats (const nis_server *serv, const nis_tag *tags,
|
|||||||
if (serv == NULL)
|
if (serv == NULL)
|
||||||
return NIS_BADOBJECT;
|
return NIS_BADOBJECT;
|
||||||
|
|
||||||
if (__do_niscall2 (serv, 1, NIS_STATUS, (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) &taglist, (xdrproc_t) _xdr_nis_taglist,
|
||||||
(caddr_t) &tagres, 0, NULL, NULL) != RPC_SUCCESS)
|
(caddr_t) &tagres, 0, NULL, NULL) != RPC_SUCCESS)
|
||||||
return NIS_RPCERROR;
|
return NIS_RPCERROR;
|
||||||
|
|
||||||
|
221
nis/nis_table.c
221
nis/nis_table.c
@ -19,6 +19,8 @@
|
|||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <rpcsvc/nis.h>
|
#include <rpcsvc/nis.h>
|
||||||
|
|
||||||
|
#include "nis_xdr.h"
|
||||||
#include "nis_intern.h"
|
#include "nis_intern.h"
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -175,10 +177,12 @@ nis_list (const_nis_name name, u_long flags,
|
|||||||
nis_cb *cb = NULL;
|
nis_cb *cb = NULL;
|
||||||
|
|
||||||
res = calloc (1, sizeof (nis_result));
|
res = calloc (1, sizeof (nis_result));
|
||||||
|
if (res == NULL)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
if (__create_ib_request (name, ibreq, flags) == NULL)
|
if (__create_ib_request (name, ibreq, flags) == NULL)
|
||||||
{
|
{
|
||||||
res->status = NIS_BADNAME;
|
NIS_RES_STATUS (res) = NIS_BADNAME;
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -189,7 +193,7 @@ nis_list (const_nis_name name, u_long flags,
|
|||||||
ibreq->ibr_name = NULL;
|
ibreq->ibr_name = NULL;
|
||||||
if (names == NULL)
|
if (names == NULL)
|
||||||
{
|
{
|
||||||
res->status = NIS_BADNAME;
|
NIS_RES_STATUS (res) = NIS_BADNAME;
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
ibreq->ibr_name = strdup (names[name_nr]);
|
ibreq->ibr_name = strdup (names[name_nr]);
|
||||||
@ -210,14 +214,12 @@ nis_list (const_nis_name name, u_long flags,
|
|||||||
char *ntable, *p;
|
char *ntable, *p;
|
||||||
u_long done = 0, failures = 0;
|
u_long done = 0, failures = 0;
|
||||||
|
|
||||||
memset (res, '\0', sizeof (nis_result));
|
|
||||||
|
|
||||||
while (names[name_nr] != NULL && !done)
|
while (names[name_nr] != NULL && !done)
|
||||||
{
|
{
|
||||||
lres = nis_lookup (names[name_nr], newflags);
|
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);
|
nis_freeresult (lres);
|
||||||
++name_nr;
|
++name_nr;
|
||||||
continue;
|
continue;
|
||||||
@ -228,7 +230,7 @@ nis_list (const_nis_name name, u_long flags,
|
|||||||
if (__type_of (NIS_RES_OBJECT (lres)) != NIS_TABLE_OBJ)
|
if (__type_of (NIS_RES_OBJECT (lres)) != NIS_TABLE_OBJ)
|
||||||
{
|
{
|
||||||
nis_freeresult (lres);
|
nis_freeresult (lres);
|
||||||
res->status = NIS_INVALIDOBJ;
|
NIS_RES_STATUS (res) = NIS_INVALIDOBJ;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -263,7 +265,7 @@ nis_list (const_nis_name name, u_long flags,
|
|||||||
res = nis_list (ntable, newflags, callback, userdata);
|
res = nis_list (ntable, newflags, callback, userdata);
|
||||||
if (res == NULL)
|
if (res == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
switch (res->status)
|
switch (NIS_RES_STATUS (res))
|
||||||
{
|
{
|
||||||
case NIS_SUCCESS:
|
case NIS_SUCCESS:
|
||||||
case NIS_CBRESULTS:
|
case NIS_CBRESULTS:
|
||||||
@ -281,10 +283,10 @@ nis_list (const_nis_name name, u_long flags,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (res->status == NIS_SUCCESS && failures)
|
if (NIS_RES_STATUS (res) == NIS_SUCCESS && failures)
|
||||||
res->status = NIS_S_SUCCESS;
|
NIS_RES_STATUS (res) = NIS_S_SUCCESS;
|
||||||
if (res->status == NIS_NOTFOUND && failures)
|
if (NIS_RES_STATUS (res) == NIS_NOTFOUND && failures)
|
||||||
res->status = NIS_S_NOTFOUND;
|
NIS_RES_STATUS (res) = NIS_S_NOTFOUND;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -302,13 +304,13 @@ nis_list (const_nis_name name, u_long flags,
|
|||||||
memset (res, '\0', sizeof (nis_result));
|
memset (res, '\0', sizeof (nis_result));
|
||||||
|
|
||||||
status = __do_niscall (ibreq->ibr_name, NIS_IBLIST,
|
status = __do_niscall (ibreq->ibr_name, NIS_IBLIST,
|
||||||
(xdrproc_t) xdr_ib_request,
|
(xdrproc_t) _xdr_ib_request,
|
||||||
(caddr_t) ibreq, (xdrproc_t) xdr_nis_result,
|
(caddr_t) ibreq, (xdrproc_t) _xdr_nis_result,
|
||||||
(caddr_t) res, flags, cb);
|
(caddr_t) res, flags, cb);
|
||||||
if (status != NIS_SUCCESS)
|
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_PARTIAL:
|
||||||
case NIS_SUCCESS:
|
case NIS_SUCCESS:
|
||||||
@ -319,7 +321,7 @@ nis_list (const_nis_name name, u_long flags,
|
|||||||
/* If we hit the link limit, bail. */
|
/* If we hit the link limit, bail. */
|
||||||
if (count_links > NIS_MAXLINKS)
|
if (count_links > NIS_MAXLINKS)
|
||||||
{
|
{
|
||||||
res->status = NIS_LINKNAMEERROR;
|
NIS_RES_STATUS (res) = NIS_LINKNAMEERROR;
|
||||||
++done;
|
++done;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -344,7 +346,9 @@ nis_list (const_nis_name name, u_long flags,
|
|||||||
++done;
|
++done;
|
||||||
break;
|
break;
|
||||||
case NIS_CBRESULTS:
|
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;
|
++done;
|
||||||
break;
|
break;
|
||||||
case NIS_UNAVAIL:
|
case NIS_UNAVAIL:
|
||||||
@ -356,7 +360,7 @@ nis_list (const_nis_name name, u_long flags,
|
|||||||
if (count_links)
|
if (count_links)
|
||||||
{
|
{
|
||||||
free (ibreq->ibr_name);
|
free (ibreq->ibr_name);
|
||||||
res->status = NIS_LINKNAMEERROR;
|
NIS_RES_STATUS (res) = NIS_LINKNAMEERROR;
|
||||||
++done;
|
++done;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -388,55 +392,58 @@ nis_list (const_nis_name name, u_long flags,
|
|||||||
}
|
}
|
||||||
|
|
||||||
nis_result *
|
nis_result *
|
||||||
nis_add_entry (const_nis_name name, const nis_object *obj,
|
nis_add_entry (const_nis_name name, const nis_object *obj2, u_long flags)
|
||||||
u_long flags)
|
|
||||||
{
|
{
|
||||||
|
nis_object obj;
|
||||||
nis_result *res;
|
nis_result *res;
|
||||||
nis_error status;
|
nis_error status;
|
||||||
ib_request *ibreq = calloc (1, sizeof (ib_request));
|
ib_request *ibreq = calloc (1, sizeof (ib_request));
|
||||||
char *p1, *p2, *p3, *p4;
|
|
||||||
char buf1[strlen (name) + 20];
|
char buf1[strlen (name) + 20];
|
||||||
char buf4[strlen (name) + 20];
|
char buf4[strlen (name) + 20];
|
||||||
|
|
||||||
res = calloc (1, sizeof (nis_result));
|
res = calloc (1, sizeof (nis_result));
|
||||||
|
if (res == NULL)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
if (__create_ib_request (name, ibreq, flags) == NULL)
|
if (ibreq == NULL)
|
||||||
{
|
{
|
||||||
res->status = NIS_BADNAME;
|
NIS_RES_STATUS (res) = NIS_NOMEMORY;
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
ibreq->ibr_obj.ibr_obj_val = nis_clone_object (obj, NULL);
|
if (__create_ib_request (name, ibreq, flags) == NULL)
|
||||||
|
{
|
||||||
|
NIS_RES_STATUS (res) = NIS_BADNAME;
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
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));
|
||||||
|
|
||||||
|
if (obj.zo_owner == NULL || strlen (obj.zo_owner) == 0)
|
||||||
|
obj.zo_owner = nis_local_principal ();
|
||||||
|
|
||||||
|
if (obj.zo_group == NULL || strlen (obj.zo_group) == 0)
|
||||||
|
obj.zo_group = nis_local_group ();
|
||||||
|
|
||||||
|
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;
|
ibreq->ibr_obj.ibr_obj_len = 1;
|
||||||
|
|
||||||
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));
|
|
||||||
|
|
||||||
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 ();
|
|
||||||
|
|
||||||
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 ();
|
|
||||||
|
|
||||||
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));
|
|
||||||
|
|
||||||
if ((status = __do_niscall (ibreq->ibr_name, NIS_IBADD,
|
if ((status = __do_niscall (ibreq->ibr_name, NIS_IBADD,
|
||||||
(xdrproc_t) xdr_ib_request,
|
(xdrproc_t) _xdr_ib_request,
|
||||||
(caddr_t) ibreq,
|
(caddr_t) ibreq,
|
||||||
(xdrproc_t) xdr_nis_result,
|
(xdrproc_t) _xdr_nis_result,
|
||||||
(caddr_t) res, 0, NULL)) != NIS_SUCCESS)
|
(caddr_t) res, 0, NULL)) != NIS_SUCCESS)
|
||||||
res->status = status;
|
NIS_RES_STATUS (res) = 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_free_request (ibreq);
|
nis_free_request (ibreq);
|
||||||
|
|
||||||
@ -444,13 +451,12 @@ nis_add_entry (const_nis_name name, const nis_object *obj,
|
|||||||
}
|
}
|
||||||
|
|
||||||
nis_result *
|
nis_result *
|
||||||
nis_modify_entry (const_nis_name name, const nis_object *obj,
|
nis_modify_entry (const_nis_name name, const nis_object *obj2, u_long flags)
|
||||||
u_long flags)
|
|
||||||
{
|
{
|
||||||
|
nis_object obj;
|
||||||
nis_result *res;
|
nis_result *res;
|
||||||
nis_error status;
|
nis_error status;
|
||||||
ib_request *ibreq = calloc (1, sizeof (ib_request));
|
ib_request *ibreq = calloc (1, sizeof (ib_request));
|
||||||
char *p1, *p2, *p3, *p4;
|
|
||||||
char buf1[strlen (name) + 20];
|
char buf1[strlen (name) + 20];
|
||||||
char buf4[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)
|
if (__create_ib_request (name, ibreq, flags) == NULL)
|
||||||
{
|
{
|
||||||
res->status = NIS_BADNAME;
|
NIS_RES_STATUS (res) = NIS_BADNAME;
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
ibreq->ibr_obj.ibr_obj_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));
|
||||||
|
|
||||||
|
if (obj.zo_owner == NULL || strlen (obj.zo_owner) == 0)
|
||||||
|
obj.zo_owner = nis_local_principal ();
|
||||||
|
|
||||||
|
if (obj.zo_group == NULL || strlen (obj.zo_group) == 0)
|
||||||
|
obj.zo_group = nis_local_group ();
|
||||||
|
|
||||||
|
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;
|
ibreq->ibr_obj.ibr_obj_len = 1;
|
||||||
|
|
||||||
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));
|
|
||||||
|
|
||||||
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 ();
|
|
||||||
|
|
||||||
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 ();
|
|
||||||
|
|
||||||
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));
|
|
||||||
|
|
||||||
if ((status = __do_niscall (ibreq->ibr_name, NIS_IBMODIFY,
|
if ((status = __do_niscall (ibreq->ibr_name, NIS_IBMODIFY,
|
||||||
(xdrproc_t) xdr_ib_request,
|
(xdrproc_t) _xdr_ib_request,
|
||||||
(caddr_t) ibreq, (xdrproc_t) xdr_nis_result,
|
(caddr_t) ibreq, (xdrproc_t) _xdr_nis_result,
|
||||||
(caddr_t) res, 0, NULL)) != NIS_SUCCESS)
|
(caddr_t) res, 0, NULL)) != NIS_SUCCESS)
|
||||||
res->status = status;
|
NIS_RES_STATUS (res) = 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_free_request (ibreq);
|
nis_free_request (ibreq);
|
||||||
|
|
||||||
@ -507,24 +509,37 @@ nis_remove_entry (const_nis_name name, const nis_object *obj,
|
|||||||
nis_error status;
|
nis_error status;
|
||||||
|
|
||||||
res = calloc (1, sizeof (nis_result));
|
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)
|
if (__create_ib_request (name, ibreq, flags) == NULL)
|
||||||
{
|
{
|
||||||
res->status = NIS_BADNAME;
|
NIS_RES_STATUS (res) = NIS_BADNAME;
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (obj != NULL)
|
if (obj != NULL)
|
||||||
{
|
{
|
||||||
ibreq->ibr_obj.ibr_obj_val = nis_clone_object (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;
|
ibreq->ibr_obj.ibr_obj_len = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((status = __do_niscall (ibreq->ibr_name, NIS_IBREMOVE,
|
if ((status = __do_niscall (ibreq->ibr_name, NIS_IBREMOVE,
|
||||||
(xdrproc_t) xdr_ib_request,
|
(xdrproc_t) _xdr_ib_request,
|
||||||
(caddr_t) ibreq, (xdrproc_t) xdr_nis_result,
|
(caddr_t) ibreq, (xdrproc_t) _xdr_nis_result,
|
||||||
(caddr_t) res, 0, NULL)) != NIS_SUCCESS)
|
(caddr_t) res, 0, NULL)) != NIS_SUCCESS)
|
||||||
res->status = status;
|
NIS_RES_STATUS (res) = status;
|
||||||
|
|
||||||
nis_free_request (ibreq);
|
nis_free_request (ibreq);
|
||||||
|
|
||||||
@ -539,18 +554,26 @@ nis_first_entry (const_nis_name name)
|
|||||||
nis_error status;
|
nis_error status;
|
||||||
|
|
||||||
res = calloc (1, sizeof (nis_result));
|
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)
|
if (__create_ib_request (name, ibreq, 0) == NULL)
|
||||||
{
|
{
|
||||||
res->status = NIS_BADNAME;
|
NIS_RES_STATUS (res) = NIS_BADNAME;
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((status = __do_niscall (ibreq->ibr_name, NIS_IBFIRST,
|
if ((status = __do_niscall (ibreq->ibr_name, NIS_IBFIRST,
|
||||||
(xdrproc_t) xdr_ib_request,
|
(xdrproc_t) _xdr_ib_request,
|
||||||
(caddr_t) ibreq, (xdrproc_t) xdr_nis_result,
|
(caddr_t) ibreq, (xdrproc_t) _xdr_nis_result,
|
||||||
(caddr_t) res, 0, NULL)) != NIS_SUCCESS)
|
(caddr_t) res, 0, NULL)) != NIS_SUCCESS)
|
||||||
res->status = status;
|
NIS_RES_STATUS (res) = status;
|
||||||
|
|
||||||
nis_free_request (ibreq);
|
nis_free_request (ibreq);
|
||||||
|
|
||||||
@ -565,10 +588,18 @@ nis_next_entry (const_nis_name name, const netobj *cookie)
|
|||||||
nis_error status;
|
nis_error status;
|
||||||
|
|
||||||
res = calloc (1, sizeof (nis_result));
|
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)
|
if (__create_ib_request (name, ibreq, 0) == NULL)
|
||||||
{
|
{
|
||||||
res->status = NIS_BADNAME;
|
NIS_RES_STATUS (res) = NIS_BADNAME;
|
||||||
return res;
|
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);
|
ibreq->ibr_cookie.n_bytes = malloc (cookie->n_len);
|
||||||
if (ibreq->ibr_cookie.n_bytes == NULL)
|
if (ibreq->ibr_cookie.n_bytes == NULL)
|
||||||
{
|
{
|
||||||
res->status = NIS_NOMEMORY;
|
NIS_RES_STATUS (res) = NIS_NOMEMORY;
|
||||||
free (res);
|
nis_free_request (ibreq);
|
||||||
return NULL;
|
return res;
|
||||||
}
|
}
|
||||||
memcpy (ibreq->ibr_cookie.n_bytes, cookie->n_bytes, cookie->n_len);
|
memcpy (ibreq->ibr_cookie.n_bytes, cookie->n_bytes, cookie->n_len);
|
||||||
ibreq->ibr_cookie.n_len = cookie->n_len;
|
ibreq->ibr_cookie.n_len = cookie->n_len;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((status = __do_niscall (ibreq->ibr_name, NIS_IBNEXT,
|
if ((status = __do_niscall (ibreq->ibr_name, NIS_IBNEXT,
|
||||||
(xdrproc_t) xdr_ib_request,
|
(xdrproc_t) _xdr_ib_request,
|
||||||
(caddr_t) ibreq, (xdrproc_t) xdr_nis_result,
|
(caddr_t) ibreq, (xdrproc_t) _xdr_nis_result,
|
||||||
(caddr_t) res, 0, NULL)) != NIS_SUCCESS)
|
(caddr_t) res, 0, NULL)) != NIS_SUCCESS)
|
||||||
res->status = status;
|
NIS_RES_STATUS (res) = status;
|
||||||
|
|
||||||
nis_free_request (ibreq);
|
nis_free_request (ibreq);
|
||||||
|
|
||||||
|
@ -19,6 +19,8 @@
|
|||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <rpcsvc/nis.h>
|
#include <rpcsvc/nis.h>
|
||||||
|
|
||||||
|
#include "nis_xdr.h"
|
||||||
#include "nis_intern.h"
|
#include "nis_intern.h"
|
||||||
|
|
||||||
fd_result *
|
fd_result *
|
||||||
@ -34,8 +36,8 @@ __nis_finddirectory (directory_obj *dir, const_nis_name name)
|
|||||||
|
|
||||||
status = __do_niscall2 (dir->do_servers.do_servers_val,
|
status = __do_niscall2 (dir->do_servers.do_servers_val,
|
||||||
dir->do_servers.do_servers_len,
|
dir->do_servers.do_servers_len,
|
||||||
NIS_FINDDIRECTORY, (xdrproc_t) xdr_fd_args,
|
NIS_FINDDIRECTORY, (xdrproc_t) _xdr_fd_args,
|
||||||
(caddr_t) &fd_args, (xdrproc_t) xdr_fd_result,
|
(caddr_t) &fd_args, (xdrproc_t) _xdr_fd_result,
|
||||||
(caddr_t) fd_res, NO_AUTHINFO|USE_DGRAM, NULL, NULL);
|
(caddr_t) fd_res, NO_AUTHINFO|USE_DGRAM, NULL, NULL);
|
||||||
if (status != NIS_SUCCESS)
|
if (status != NIS_SUCCESS)
|
||||||
fd_res->status = status;
|
fd_res->status = status;
|
||||||
|
@ -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.
|
This file is part of the GNU C Library.
|
||||||
Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
|
Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
|
||||||
|
|
||||||
@ -41,7 +41,7 @@ nis_verifygroup (const_nis_name group)
|
|||||||
stpcpy (cp, cp2);
|
stpcpy (cp, cp2);
|
||||||
}
|
}
|
||||||
res = nis_lookup (buf, 0);
|
res = nis_lookup (buf, 0);
|
||||||
status = res->status;
|
status = NIS_RES_STATUS (res);
|
||||||
nis_freeresult (res);
|
nis_freeresult (res);
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
276
nis/nis_xdr.c
276
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.
|
This file is part of the GNU C Library.
|
||||||
Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
|
Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
|
||||||
|
|
||||||
@ -18,8 +18,14 @@
|
|||||||
Boston, MA 02111-1307, USA. */
|
Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
#include <rpcsvc/nis.h>
|
#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)
|
xdr_nis_attr (XDR *xdrs, nis_attr *objp)
|
||||||
{
|
{
|
||||||
if (!xdr_string (xdrs, &objp->zattr_ndx, ~0))
|
if (!xdr_string (xdrs, &objp->zattr_ndx, ~0))
|
||||||
@ -31,14 +37,14 @@ xdr_nis_attr (XDR *xdrs, nis_attr *objp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool_t
|
bool_t
|
||||||
xdr_nis_name (XDR *xdrs, nis_name *objp)
|
_xdr_nis_name (XDR *xdrs, nis_name *objp)
|
||||||
{
|
{
|
||||||
if (!xdr_string (xdrs, objp, ~0))
|
if (!xdr_string (xdrs, objp, ~0))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool_t
|
static bool_t
|
||||||
xdr_zotypes (XDR *xdrs, zotypes *objp)
|
xdr_zotypes (XDR *xdrs, zotypes *objp)
|
||||||
{
|
{
|
||||||
if (!xdr_enum (xdrs, (enum_t *) objp))
|
if (!xdr_enum (xdrs, (enum_t *) objp))
|
||||||
@ -46,7 +52,7 @@ xdr_zotypes (XDR *xdrs, zotypes *objp)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool_t
|
static bool_t
|
||||||
xdr_nstype (XDR *xdrs, nstype *objp)
|
xdr_nstype (XDR *xdrs, nstype *objp)
|
||||||
{
|
{
|
||||||
if (!xdr_enum (xdrs, (enum_t *) objp))
|
if (!xdr_enum (xdrs, (enum_t *) objp))
|
||||||
@ -54,7 +60,7 @@ xdr_nstype (XDR *xdrs, nstype *objp)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool_t
|
static bool_t
|
||||||
xdr_oar_mask (XDR *xdrs, oar_mask *objp)
|
xdr_oar_mask (XDR *xdrs, oar_mask *objp)
|
||||||
{
|
{
|
||||||
if (!xdr_u_long (xdrs, &objp->oa_rights))
|
if (!xdr_u_long (xdrs, &objp->oa_rights))
|
||||||
@ -64,7 +70,7 @@ xdr_oar_mask (XDR *xdrs, oar_mask *objp)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool_t
|
static bool_t
|
||||||
xdr_endpoint (XDR *xdrs, endpoint *objp)
|
xdr_endpoint (XDR *xdrs, endpoint *objp)
|
||||||
{
|
{
|
||||||
if (!xdr_string (xdrs, &objp->uaddr, ~0))
|
if (!xdr_string (xdrs, &objp->uaddr, ~0))
|
||||||
@ -77,9 +83,9 @@ xdr_endpoint (XDR *xdrs, endpoint *objp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool_t
|
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;
|
return FALSE;
|
||||||
if (!xdr_array (xdrs, (char **) &objp->ep.ep_val, (u_int *) &objp->ep.ep_len,
|
if (!xdr_array (xdrs, (char **) &objp->ep.ep_val, (u_int *) &objp->ep.ep_len,
|
||||||
~0, sizeof (endpoint), (xdrproc_t) xdr_endpoint))
|
~0, sizeof (endpoint), (xdrproc_t) xdr_endpoint))
|
||||||
@ -92,15 +98,15 @@ xdr_nis_server (XDR *xdrs, nis_server *objp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool_t
|
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;
|
return FALSE;
|
||||||
if (!xdr_nstype (xdrs, &objp->do_type))
|
if (!xdr_nstype (xdrs, &objp->do_type))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
if (!xdr_array (xdrs, (char **) &objp->do_servers.do_servers_val,
|
if (!xdr_array (xdrs, (char **) &objp->do_servers.do_servers_val,
|
||||||
(u_int *) & objp->do_servers.do_servers_len, ~0,
|
(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;
|
return FALSE;
|
||||||
|
|
||||||
if (!xdr_u_long (xdrs, &objp->do_ttl))
|
if (!xdr_u_long (xdrs, &objp->do_ttl))
|
||||||
@ -112,7 +118,7 @@ xdr_directory_obj (XDR *xdrs, directory_obj *objp)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool_t
|
static bool_t
|
||||||
xdr_entry_col (XDR *xdrs, entry_col *objp)
|
xdr_entry_col (XDR *xdrs, entry_col *objp)
|
||||||
{
|
{
|
||||||
if (!xdr_u_long (xdrs, &objp->ec_flags))
|
if (!xdr_u_long (xdrs, &objp->ec_flags))
|
||||||
@ -123,7 +129,7 @@ xdr_entry_col (XDR *xdrs, entry_col *objp)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool_t
|
static bool_t
|
||||||
xdr_entry_obj (XDR *xdrs, entry_obj *objp)
|
xdr_entry_obj (XDR *xdrs, entry_obj *objp)
|
||||||
{
|
{
|
||||||
if (!xdr_string (xdrs, &objp->en_type, ~0))
|
if (!xdr_string (xdrs, &objp->en_type, ~0))
|
||||||
@ -135,19 +141,19 @@ xdr_entry_obj (XDR *xdrs, entry_obj *objp)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool_t
|
static bool_t
|
||||||
xdr_group_obj (XDR *xdrs, group_obj *objp)
|
xdr_group_obj (XDR *xdrs, group_obj *objp)
|
||||||
{
|
{
|
||||||
if (!xdr_u_long (xdrs, &objp->gr_flags))
|
if (!xdr_u_long (xdrs, &objp->gr_flags))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
if (!xdr_array (xdrs, (char **) &objp->gr_members.gr_members_val,
|
if (!xdr_array (xdrs, (char **) &objp->gr_members.gr_members_val,
|
||||||
(u_int *) &objp->gr_members.gr_members_len, ~0,
|
(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 FALSE;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool_t
|
static bool_t
|
||||||
xdr_link_obj (XDR *xdrs, link_obj *objp)
|
xdr_link_obj (XDR *xdrs, link_obj *objp)
|
||||||
{
|
{
|
||||||
if (!xdr_zotypes (xdrs, &objp->li_rtype))
|
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,
|
(u_int *) &objp->li_attrs.li_attrs_len, ~0,
|
||||||
sizeof (nis_attr), (xdrproc_t) xdr_nis_attr))
|
sizeof (nis_attr), (xdrproc_t) xdr_nis_attr))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
if (!xdr_nis_name (xdrs, &objp->li_name))
|
if (!_xdr_nis_name (xdrs, &objp->li_name))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool_t
|
static bool_t
|
||||||
xdr_table_col (XDR *xdrs, table_col *objp)
|
xdr_table_col (XDR *xdrs, table_col *objp)
|
||||||
{
|
{
|
||||||
if (!xdr_string (xdrs, &objp->tc_name, 64))
|
if (!xdr_string (xdrs, &objp->tc_name, 64))
|
||||||
@ -173,7 +179,7 @@ xdr_table_col (XDR *xdrs, table_col *objp)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool_t
|
static bool_t
|
||||||
xdr_table_obj (XDR *xdrs, table_obj *objp)
|
xdr_table_obj (XDR *xdrs, table_obj *objp)
|
||||||
{
|
{
|
||||||
if (!xdr_string (xdrs, &objp->ta_type, 64))
|
if (!xdr_string (xdrs, &objp->ta_type, 64))
|
||||||
@ -191,7 +197,7 @@ xdr_table_obj (XDR *xdrs, table_obj *objp)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool_t
|
static bool_t
|
||||||
xdr_objdata (XDR *xdrs, objdata *objp)
|
xdr_objdata (XDR *xdrs, objdata *objp)
|
||||||
{
|
{
|
||||||
if (!xdr_zotypes (xdrs, &objp->zo_type))
|
if (!xdr_zotypes (xdrs, &objp->zo_type))
|
||||||
@ -199,7 +205,7 @@ xdr_objdata (XDR *xdrs, objdata *objp)
|
|||||||
switch (objp->zo_type)
|
switch (objp->zo_type)
|
||||||
{
|
{
|
||||||
case NIS_DIRECTORY_OBJ:
|
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;
|
return FALSE;
|
||||||
break;
|
break;
|
||||||
case NIS_GROUP_OBJ:
|
case NIS_GROUP_OBJ:
|
||||||
@ -233,7 +239,7 @@ xdr_objdata (XDR *xdrs, objdata *objp)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool_t
|
static bool_t
|
||||||
xdr_nis_oid (XDR *xdrs, nis_oid *objp)
|
xdr_nis_oid (XDR *xdrs, nis_oid *objp)
|
||||||
{
|
{
|
||||||
if (!xdr_u_long (xdrs, &objp->ctime))
|
if (!xdr_u_long (xdrs, &objp->ctime))
|
||||||
@ -244,17 +250,17 @@ xdr_nis_oid (XDR *xdrs, nis_oid *objp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool_t
|
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))
|
if (!xdr_nis_oid (xdrs, &objp->zo_oid))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
if (!xdr_nis_name (xdrs, &objp->zo_name))
|
if (!_xdr_nis_name (xdrs, &objp->zo_name))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
if (!xdr_nis_name (xdrs, &objp->zo_owner))
|
if (!_xdr_nis_name (xdrs, &objp->zo_owner))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
if (!xdr_nis_name (xdrs, &objp->zo_group))
|
if (!_xdr_nis_name (xdrs, &objp->zo_group))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
if (!xdr_nis_name (xdrs, &objp->zo_domain))
|
if (!_xdr_nis_name (xdrs, &objp->zo_domain))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
if (!xdr_u_long (xdrs, &objp->zo_access))
|
if (!xdr_u_long (xdrs, &objp->zo_access))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -266,7 +272,7 @@ xdr_nis_object (XDR *xdrs, nis_object *objp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool_t
|
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))
|
if (!xdr_enum (xdrs, (enum_t *) objp))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -274,17 +280,17 @@ xdr_nis_error (XDR *xdrs, nis_error *objp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool_t
|
bool_t
|
||||||
xdr_nis_result (XDR *xdrs, nis_result *objp)
|
_xdr_nis_result (XDR *xdrs, nis_result *objp)
|
||||||
{
|
{
|
||||||
register long *buf;
|
register long *buf;
|
||||||
|
|
||||||
if (xdrs->x_op == XDR_ENCODE)
|
if (xdrs->x_op == XDR_ENCODE)
|
||||||
{
|
{
|
||||||
if (!xdr_nis_error (xdrs, &objp->status))
|
if (!_xdr_nis_error (xdrs, &objp->status))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
if (!xdr_array (xdrs, (char **) &objp->objects.objects_val,
|
if (!xdr_array (xdrs, (char **) &objp->objects.objects_val,
|
||||||
(u_int *) &objp->objects.objects_len, ~0,
|
(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;
|
return FALSE;
|
||||||
if (!xdr_netobj (xdrs, &objp->cookie))
|
if (!xdr_netobj (xdrs, &objp->cookie))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -292,22 +298,13 @@ xdr_nis_result (XDR *xdrs, nis_result *objp)
|
|||||||
if (buf == NULL)
|
if (buf == NULL)
|
||||||
{
|
{
|
||||||
if (!xdr_u_long (xdrs, &objp->zticks))
|
if (!xdr_u_long (xdrs, &objp->zticks))
|
||||||
{
|
return FALSE;
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
if (!xdr_u_long (xdrs, &objp->dticks))
|
if (!xdr_u_long (xdrs, &objp->dticks))
|
||||||
{
|
return FALSE;
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
if (!xdr_u_long (xdrs, &objp->aticks))
|
if (!xdr_u_long (xdrs, &objp->aticks))
|
||||||
{
|
return FALSE;
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
if (!xdr_u_long (xdrs, &objp->cticks))
|
if (!xdr_u_long (xdrs, &objp->cticks))
|
||||||
{
|
return FALSE;
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
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->aticks);
|
||||||
IXDR_PUT_U_LONG (buf, objp->cticks);
|
IXDR_PUT_U_LONG (buf, objp->cticks);
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
else if (xdrs->x_op == XDR_DECODE)
|
else if (xdrs->x_op == XDR_DECODE)
|
||||||
{
|
{
|
||||||
if (!xdr_nis_error (xdrs, &objp->status))
|
if (!_xdr_nis_error (xdrs, &objp->status))
|
||||||
{
|
return FALSE;
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
if (!xdr_array (xdrs, (char **) &objp->objects.objects_val,
|
if (!xdr_array (xdrs, (char **) &objp->objects.objects_val,
|
||||||
(u_int *) &objp->objects.objects_len, ~0,
|
(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;
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
if (!xdr_netobj (xdrs, &objp->cookie))
|
if (!xdr_netobj (xdrs, &objp->cookie))
|
||||||
{
|
return FALSE;
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
buf = XDR_INLINE (xdrs, 4 * BYTES_PER_XDR_UNIT);
|
buf = XDR_INLINE (xdrs, 4 * BYTES_PER_XDR_UNIT);
|
||||||
if (buf == NULL)
|
if (buf == NULL)
|
||||||
{
|
{
|
||||||
if (!xdr_u_long (xdrs, &objp->zticks))
|
if (!xdr_u_long (xdrs, &objp->zticks))
|
||||||
{
|
return FALSE;
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
if (!xdr_u_long (xdrs, &objp->dticks))
|
if (!xdr_u_long (xdrs, &objp->dticks))
|
||||||
{
|
return FALSE;
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
if (!xdr_u_long (xdrs, &objp->aticks))
|
if (!xdr_u_long (xdrs, &objp->aticks))
|
||||||
{
|
return FALSE;
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
if (!xdr_u_long (xdrs, &objp->cticks))
|
if (!xdr_u_long (xdrs, &objp->cticks))
|
||||||
{
|
return FALSE;
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -366,55 +347,41 @@ xdr_nis_result (XDR *xdrs, nis_result *objp)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!xdr_nis_error (xdrs, &objp->status))
|
if (!_xdr_nis_error (xdrs, &objp->status))
|
||||||
{
|
return FALSE;
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
if (!xdr_array (xdrs, (char **) &objp->objects.objects_val,
|
if (!xdr_array (xdrs, (char **) &objp->objects.objects_val,
|
||||||
(u_int *) &objp->objects.objects_len, ~0,
|
(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;
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
if (!xdr_netobj (xdrs, &objp->cookie))
|
if (!xdr_netobj (xdrs, &objp->cookie))
|
||||||
{
|
return FALSE;
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
if (!xdr_u_long (xdrs, &objp->zticks))
|
if (!xdr_u_long (xdrs, &objp->zticks))
|
||||||
{
|
return FALSE;
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
if (!xdr_u_long (xdrs, &objp->dticks))
|
if (!xdr_u_long (xdrs, &objp->dticks))
|
||||||
{
|
return FALSE;
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
if (!xdr_u_long (xdrs, &objp->aticks))
|
if (!xdr_u_long (xdrs, &objp->aticks))
|
||||||
{
|
return FALSE;
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
if (!xdr_u_long (xdrs, &objp->cticks))
|
if (!xdr_u_long (xdrs, &objp->cticks))
|
||||||
{
|
return FALSE;
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool_t
|
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;
|
return FALSE;
|
||||||
if (!xdr_array (xdrs, (char **) &objp->ns_object.ns_object_val,
|
if (!xdr_array (xdrs, (char **) &objp->ns_object.ns_object_val,
|
||||||
(u_int *) &objp->ns_object.ns_object_len, 1,
|
(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 FALSE;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool_t
|
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;
|
return FALSE;
|
||||||
if (!xdr_array (xdrs, (char **) &objp->ibr_srch.ibr_srch_val,
|
if (!xdr_array (xdrs, (char **) &objp->ibr_srch.ibr_srch_val,
|
||||||
(u_int *) &objp->ibr_srch.ibr_srch_len, ~0,
|
(u_int *) &objp->ibr_srch.ibr_srch_len, ~0,
|
||||||
@ -424,11 +391,11 @@ xdr_ib_request (XDR *xdrs, ib_request *objp)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
if (!xdr_array (xdrs, (char **) &objp->ibr_obj.ibr_obj_val,
|
if (!xdr_array (xdrs, (char **) &objp->ibr_obj.ibr_obj_val,
|
||||||
(u_int *) &objp->ibr_obj.ibr_obj_len, 1,
|
(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;
|
return FALSE;
|
||||||
if (!xdr_array (xdrs, (char **) &objp->ibr_cbhost.ibr_cbhost_val,
|
if (!xdr_array (xdrs, (char **) &objp->ibr_cbhost.ibr_cbhost_val,
|
||||||
(u_int *) &objp->ibr_cbhost.ibr_cbhost_len, 1,
|
(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;
|
return FALSE;
|
||||||
if (!xdr_u_long (xdrs, &objp->ibr_bufsize))
|
if (!xdr_u_long (xdrs, &objp->ibr_bufsize))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -438,9 +405,9 @@ xdr_ib_request (XDR *xdrs, ib_request *objp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool_t
|
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;
|
return FALSE;
|
||||||
if (!xdr_u_long (xdrs, &objp->stamp))
|
if (!xdr_u_long (xdrs, &objp->stamp))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -448,57 +415,9 @@ xdr_ping_args (XDR *xdrs, ping_args *objp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool_t
|
bool_t
|
||||||
xdr_log_entry_t (XDR *xdrs, log_entry_t *objp)
|
_xdr_cp_result (XDR *xdrs, cp_result *objp)
|
||||||
{
|
{
|
||||||
if (!xdr_enum (xdrs, (enum_t *) objp))
|
if (!_xdr_nis_error (xdrs, &objp->cp_status))
|
||||||
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)
|
|
||||||
{
|
|
||||||
if (!xdr_nis_error (xdrs, &objp->cp_status))
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
if (!xdr_u_long (xdrs, &objp->cp_zticks))
|
if (!xdr_u_long (xdrs, &objp->cp_zticks))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -508,7 +427,7 @@ xdr_cp_result (XDR *xdrs, cp_result *objp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool_t
|
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))
|
if (!xdr_u_long (xdrs, &objp->tag_type))
|
||||||
{
|
{
|
||||||
@ -522,45 +441,31 @@ xdr_nis_tag (XDR *xdrs, nis_tag *objp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool_t
|
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,
|
if (!xdr_array (xdrs, (char **) &objp->tags.tags_val,
|
||||||
(u_int *) &objp->tags.tags_len, ~0, sizeof (nis_tag),
|
(u_int *) &objp->tags.tags_len, ~0, sizeof (nis_tag),
|
||||||
(xdrproc_t) xdr_nis_tag))
|
(xdrproc_t) _xdr_nis_tag))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool_t
|
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))
|
if (!_xdr_nis_name (xdrs, &objp->dir_name))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
if (!xdr_u_long (xdrs, &objp->da_time))
|
if (!_xdr_nis_name (xdrs, &objp->requester))
|
||||||
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))
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool_t
|
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;
|
return FALSE;
|
||||||
if (!xdr_nis_name (xdrs, &objp->requester))
|
if (!_xdr_nis_name (xdrs, &objp->source))
|
||||||
return FALSE;
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool_t
|
|
||||||
xdr_fd_result (XDR *xdrs, fd_result *objp)
|
|
||||||
{
|
|
||||||
if (!xdr_nis_error (xdrs, &objp->status))
|
|
||||||
return FALSE;
|
|
||||||
if (!xdr_nis_name (xdrs, &objp->source))
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
if (!xdr_bytes (xdrs, (char **) &objp->dir_data.dir_data_val,
|
if (!xdr_bytes (xdrs, (char **) &objp->dir_data.dir_data_val,
|
||||||
(u_int *) &objp->dir_data.dir_data_len, ~0))
|
(u_int *) &objp->dir_data.dir_data_len, ~0))
|
||||||
@ -570,3 +475,24 @@ xdr_fd_result (XDR *xdrs, fd_result *objp)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* The following functions have prototypes in nis_callback.h. So
|
||||||
|
we make them public */
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
45
nis/nis_xdr.h
Normal file
45
nis/nis_xdr.h
Normal file
@ -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
|
@ -81,10 +81,8 @@ struct nis_attr {
|
|||||||
} zattr_val;
|
} zattr_val;
|
||||||
};
|
};
|
||||||
typedef struct nis_attr nis_attr;
|
typedef struct nis_attr nis_attr;
|
||||||
extern bool_t xdr_nis_attr __P ((XDR *, nis_attr*));
|
|
||||||
|
|
||||||
typedef char *nis_name;
|
typedef char *nis_name;
|
||||||
extern bool_t xdr_nis_name __P ((XDR *, nis_name*));
|
|
||||||
|
|
||||||
enum zotypes {
|
enum zotypes {
|
||||||
BOGUS_OBJ = 0,
|
BOGUS_OBJ = 0,
|
||||||
@ -105,7 +103,6 @@ enum zotypes {
|
|||||||
NIS_PRIVATE_OBJ = 7
|
NIS_PRIVATE_OBJ = 7
|
||||||
};
|
};
|
||||||
typedef enum zotypes zotypes;
|
typedef enum zotypes zotypes;
|
||||||
extern bool_t xdr_zotypes __P ((XDR *, zotypes*));
|
|
||||||
|
|
||||||
enum nstype {
|
enum nstype {
|
||||||
UNKNOWN = 0,
|
UNKNOWN = 0,
|
||||||
@ -119,14 +116,12 @@ enum nstype {
|
|||||||
CDS = 8,
|
CDS = 8,
|
||||||
};
|
};
|
||||||
typedef enum nstype nstype;
|
typedef enum nstype nstype;
|
||||||
extern bool_t xdr_nstype __P ((XDR *, nstype*));
|
|
||||||
|
|
||||||
struct oar_mask {
|
struct oar_mask {
|
||||||
u_long oa_rights;
|
u_long oa_rights;
|
||||||
zotypes oa_otype;
|
zotypes oa_otype;
|
||||||
};
|
};
|
||||||
typedef struct oar_mask oar_mask;
|
typedef struct oar_mask oar_mask;
|
||||||
extern bool_t xdr_oar_mask __P ((XDR *, oar_mask*));
|
|
||||||
|
|
||||||
struct endpoint {
|
struct endpoint {
|
||||||
char *uaddr;
|
char *uaddr;
|
||||||
@ -134,7 +129,6 @@ struct endpoint {
|
|||||||
char *proto;
|
char *proto;
|
||||||
};
|
};
|
||||||
typedef struct endpoint endpoint;
|
typedef struct endpoint endpoint;
|
||||||
extern bool_t xdr_endpoint __P ((XDR *, endpoint*));
|
|
||||||
|
|
||||||
struct nis_server {
|
struct nis_server {
|
||||||
nis_name name;
|
nis_name name;
|
||||||
@ -146,7 +140,6 @@ struct nis_server {
|
|||||||
netobj pkey;
|
netobj pkey;
|
||||||
};
|
};
|
||||||
typedef struct nis_server nis_server;
|
typedef struct nis_server nis_server;
|
||||||
extern bool_t xdr_nis_server __P ((XDR *, nis_server*));
|
|
||||||
|
|
||||||
struct directory_obj {
|
struct directory_obj {
|
||||||
nis_name do_name;
|
nis_name do_name;
|
||||||
@ -162,7 +155,6 @@ struct directory_obj {
|
|||||||
} do_armask;
|
} do_armask;
|
||||||
};
|
};
|
||||||
typedef struct directory_obj directory_obj;
|
typedef struct directory_obj directory_obj;
|
||||||
extern bool_t xdr_directory_obj __P ((XDR *, directory_obj*));
|
|
||||||
|
|
||||||
#define EN_BINARY 1
|
#define EN_BINARY 1
|
||||||
#define EN_CRYPT 2
|
#define EN_CRYPT 2
|
||||||
@ -178,7 +170,6 @@ struct entry_col {
|
|||||||
} ec_value;
|
} ec_value;
|
||||||
};
|
};
|
||||||
typedef struct entry_col entry_col;
|
typedef struct entry_col entry_col;
|
||||||
extern bool_t xdr_entry_col __P ((XDR *, entry_col*));
|
|
||||||
|
|
||||||
struct entry_obj {
|
struct entry_obj {
|
||||||
char *en_type;
|
char *en_type;
|
||||||
@ -188,7 +179,6 @@ struct entry_obj {
|
|||||||
} en_cols;
|
} en_cols;
|
||||||
};
|
};
|
||||||
typedef struct entry_obj entry_obj;
|
typedef struct entry_obj entry_obj;
|
||||||
extern bool_t xdr_entry_obj __P ((XDR *, entry_obj*));
|
|
||||||
|
|
||||||
struct group_obj {
|
struct group_obj {
|
||||||
u_long gr_flags;
|
u_long gr_flags;
|
||||||
@ -198,7 +188,6 @@ struct group_obj {
|
|||||||
} gr_members;
|
} gr_members;
|
||||||
};
|
};
|
||||||
typedef struct group_obj group_obj;
|
typedef struct group_obj group_obj;
|
||||||
extern bool_t xdr_group_obj __P ((XDR *, group_obj*));
|
|
||||||
|
|
||||||
struct link_obj {
|
struct link_obj {
|
||||||
zotypes li_rtype;
|
zotypes li_rtype;
|
||||||
@ -209,7 +198,6 @@ struct link_obj {
|
|||||||
nis_name li_name;
|
nis_name li_name;
|
||||||
};
|
};
|
||||||
typedef struct link_obj link_obj;
|
typedef struct link_obj link_obj;
|
||||||
extern bool_t xdr_link_obj __P ((XDR *, link_obj*));
|
|
||||||
|
|
||||||
#define TA_BINARY 1
|
#define TA_BINARY 1
|
||||||
#define TA_CRYPT 2
|
#define TA_CRYPT 2
|
||||||
@ -225,7 +213,6 @@ struct table_col {
|
|||||||
u_long tc_rights;
|
u_long tc_rights;
|
||||||
};
|
};
|
||||||
typedef struct table_col table_col;
|
typedef struct table_col table_col;
|
||||||
extern bool_t xdr_table_col __P ((XDR *, table_col*));
|
|
||||||
|
|
||||||
struct table_obj {
|
struct table_obj {
|
||||||
char *ta_type;
|
char *ta_type;
|
||||||
@ -238,7 +225,6 @@ struct table_obj {
|
|||||||
char *ta_path;
|
char *ta_path;
|
||||||
};
|
};
|
||||||
typedef struct table_obj table_obj;
|
typedef struct table_obj table_obj;
|
||||||
extern bool_t xdr_table_obj __P ((XDR *, table_obj*));
|
|
||||||
|
|
||||||
struct objdata {
|
struct objdata {
|
||||||
zotypes zo_type;
|
zotypes zo_type;
|
||||||
@ -255,14 +241,12 @@ struct objdata {
|
|||||||
} objdata_u;
|
} objdata_u;
|
||||||
};
|
};
|
||||||
typedef struct objdata objdata;
|
typedef struct objdata objdata;
|
||||||
extern bool_t xdr_objdata __P ((XDR *, objdata*));
|
|
||||||
|
|
||||||
struct nis_oid {
|
struct nis_oid {
|
||||||
u_long ctime;
|
u_long ctime;
|
||||||
u_long mtime;
|
u_long mtime;
|
||||||
};
|
};
|
||||||
typedef struct nis_oid nis_oid;
|
typedef struct nis_oid nis_oid;
|
||||||
extern bool_t xdr_nis_oid __P ((XDR *, nis_oid*));
|
|
||||||
|
|
||||||
struct nis_object {
|
struct nis_object {
|
||||||
nis_oid zo_oid;
|
nis_oid zo_oid;
|
||||||
@ -275,7 +259,6 @@ struct nis_object {
|
|||||||
objdata zo_data;
|
objdata zo_data;
|
||||||
};
|
};
|
||||||
typedef struct nis_object nis_object;
|
typedef struct nis_object nis_object;
|
||||||
extern bool_t xdr_nis_object __P ((XDR *, nis_object*));
|
|
||||||
|
|
||||||
#endif /* if __nis_object_h */
|
#endif /* if __nis_object_h */
|
||||||
|
|
||||||
@ -330,7 +313,6 @@ enum nis_error {
|
|||||||
NIS_DUMPLATER = 47,
|
NIS_DUMPLATER = 47,
|
||||||
};
|
};
|
||||||
typedef enum nis_error nis_error;
|
typedef enum nis_error nis_error;
|
||||||
extern bool_t xdr_nis_error __P ((XDR *, nis_error*));
|
|
||||||
|
|
||||||
struct nis_result {
|
struct nis_result {
|
||||||
nis_error status;
|
nis_error status;
|
||||||
@ -345,7 +327,6 @@ struct nis_result {
|
|||||||
u_long cticks;
|
u_long cticks;
|
||||||
};
|
};
|
||||||
typedef struct nis_result nis_result;
|
typedef struct nis_result nis_result;
|
||||||
extern bool_t xdr_nis_result __P ((XDR *, nis_result*));
|
|
||||||
|
|
||||||
struct ns_request {
|
struct ns_request {
|
||||||
nis_name ns_name;
|
nis_name ns_name;
|
||||||
@ -355,7 +336,6 @@ struct ns_request {
|
|||||||
} ns_object;
|
} ns_object;
|
||||||
};
|
};
|
||||||
typedef struct ns_request ns_request;
|
typedef struct ns_request ns_request;
|
||||||
extern bool_t xdr_ns_request __P ((XDR *, ns_request*));
|
|
||||||
|
|
||||||
struct ib_request {
|
struct ib_request {
|
||||||
nis_name ibr_name;
|
nis_name ibr_name;
|
||||||
@ -376,14 +356,12 @@ struct ib_request {
|
|||||||
netobj ibr_cookie;
|
netobj ibr_cookie;
|
||||||
};
|
};
|
||||||
typedef struct ib_request ib_request;
|
typedef struct ib_request ib_request;
|
||||||
extern bool_t xdr_ib_request __P ((XDR *, ib_request*));
|
|
||||||
|
|
||||||
struct ping_args {
|
struct ping_args {
|
||||||
nis_name dir;
|
nis_name dir;
|
||||||
u_long stamp;
|
u_long stamp;
|
||||||
};
|
};
|
||||||
typedef struct ping_args ping_args;
|
typedef struct ping_args ping_args;
|
||||||
extern bool_t xdr_ping_args __P ((XDR *, ping_args*));
|
|
||||||
|
|
||||||
enum log_entry_t {
|
enum log_entry_t {
|
||||||
LOG_NOP = 0,
|
LOG_NOP = 0,
|
||||||
@ -397,7 +375,6 @@ enum log_entry_t {
|
|||||||
UPD_STAMP = 8,
|
UPD_STAMP = 8,
|
||||||
};
|
};
|
||||||
typedef enum log_entry_t log_entry_t;
|
typedef enum log_entry_t log_entry_t;
|
||||||
extern bool_t xdr_log_entry_t __P ((XDR *, log_entry_t*));
|
|
||||||
|
|
||||||
struct log_entry {
|
struct log_entry {
|
||||||
u_long le_time;
|
u_long le_time;
|
||||||
@ -411,7 +388,6 @@ struct log_entry {
|
|||||||
nis_object le_object;
|
nis_object le_object;
|
||||||
};
|
};
|
||||||
typedef struct log_entry log_entry;
|
typedef struct log_entry log_entry;
|
||||||
extern bool_t xdr_log_entry __P ((XDR *, log_entry*));
|
|
||||||
|
|
||||||
struct log_result {
|
struct log_result {
|
||||||
nis_error lr_status;
|
nis_error lr_status;
|
||||||
@ -422,7 +398,6 @@ struct log_result {
|
|||||||
} lr_entries;
|
} lr_entries;
|
||||||
};
|
};
|
||||||
typedef struct log_result log_result;
|
typedef struct log_result log_result;
|
||||||
extern bool_t xdr_log_result __P ((XDR *, log_result*));
|
|
||||||
|
|
||||||
struct cp_result {
|
struct cp_result {
|
||||||
nis_error cp_status;
|
nis_error cp_status;
|
||||||
@ -430,14 +405,12 @@ struct cp_result {
|
|||||||
u_long cp_dticks;
|
u_long cp_dticks;
|
||||||
};
|
};
|
||||||
typedef struct cp_result cp_result;
|
typedef struct cp_result cp_result;
|
||||||
extern bool_t xdr_cp_result __P ((XDR *, cp_result*));
|
|
||||||
|
|
||||||
struct nis_tag {
|
struct nis_tag {
|
||||||
u_long tag_type;
|
u_long tag_type;
|
||||||
char *tag_val;
|
char *tag_val;
|
||||||
};
|
};
|
||||||
typedef struct nis_tag nis_tag;
|
typedef struct nis_tag nis_tag;
|
||||||
extern bool_t xdr_nis_tag __P ((XDR *, nis_tag*));
|
|
||||||
|
|
||||||
struct nis_taglist {
|
struct nis_taglist {
|
||||||
struct {
|
struct {
|
||||||
@ -446,7 +419,6 @@ struct nis_taglist {
|
|||||||
} tags;
|
} tags;
|
||||||
};
|
};
|
||||||
typedef struct nis_taglist nis_taglist;
|
typedef struct nis_taglist nis_taglist;
|
||||||
extern bool_t xdr_nis_taglist __P ((XDR *, nis_taglist*));
|
|
||||||
|
|
||||||
struct dump_args {
|
struct dump_args {
|
||||||
nis_name da_dir;
|
nis_name da_dir;
|
||||||
@ -457,14 +429,12 @@ struct dump_args {
|
|||||||
} da_cbhost;
|
} da_cbhost;
|
||||||
};
|
};
|
||||||
typedef struct dump_args dump_args;
|
typedef struct dump_args dump_args;
|
||||||
extern bool_t xdr_dump_args __P ((XDR *, dump_args*));
|
|
||||||
|
|
||||||
struct fd_args {
|
struct fd_args {
|
||||||
nis_name dir_name;
|
nis_name dir_name;
|
||||||
nis_name requester;
|
nis_name requester;
|
||||||
};
|
};
|
||||||
typedef struct fd_args fd_args;
|
typedef struct fd_args fd_args;
|
||||||
extern bool_t xdr_fd_args __P ((XDR *, fd_args*));
|
|
||||||
|
|
||||||
struct fd_result {
|
struct fd_result {
|
||||||
nis_error status;
|
nis_error status;
|
||||||
@ -479,7 +449,6 @@ struct fd_result {
|
|||||||
} signature;
|
} signature;
|
||||||
};
|
};
|
||||||
typedef struct fd_result fd_result;
|
typedef struct fd_result fd_result;
|
||||||
extern bool_t xdr_fd_result __P ((XDR *, fd_result*));
|
|
||||||
|
|
||||||
/* Generic client creating flags */
|
/* Generic client creating flags */
|
||||||
#define ZMH_VC 1
|
#define ZMH_VC 1
|
||||||
|
71
nis/rpcsvc/nis_callback.h
Normal file
71
nis/rpcsvc/nis_callback.h
Normal file
@ -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 */
|
10
sunrpc/svc.c
10
sunrpc/svc.c
@ -374,8 +374,7 @@ svcerr_progvers (xprt, low_vers, high_vers)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
svc_getreq (rdfds)
|
svc_getreq (int rdfds)
|
||||||
int rdfds;
|
|
||||||
{
|
{
|
||||||
#ifdef FD_SETSIZE
|
#ifdef FD_SETSIZE
|
||||||
fd_set readfds;
|
fd_set readfds;
|
||||||
@ -435,6 +434,10 @@ svc_getreqset (readfds)
|
|||||||
/* sock has input waiting */
|
/* sock has input waiting */
|
||||||
xprt = xports[sock];
|
xprt = xports[sock];
|
||||||
#endif /* def FD_SETSIZE */
|
#endif /* def FD_SETSIZE */
|
||||||
|
if (xprt == NULL)
|
||||||
|
/* But do we control sock? */
|
||||||
|
continue;
|
||||||
|
|
||||||
/* now receive msgs from xprtprt (support batch calls) */
|
/* now receive msgs from xprtprt (support batch calls) */
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
@ -481,8 +484,7 @@ svc_getreqset (readfds)
|
|||||||
* is not served ...
|
* is not served ...
|
||||||
*/
|
*/
|
||||||
if (prog_found)
|
if (prog_found)
|
||||||
svcerr_progvers (xprt,
|
svcerr_progvers (xprt, low_vers, high_vers);
|
||||||
low_vers, high_vers);
|
|
||||||
else
|
else
|
||||||
svcerr_noprog (xprt);
|
svcerr_noprog (xprt);
|
||||||
/* Fall through to ... */
|
/* Fall through to ... */
|
||||||
|
Loading…
Reference in New Issue
Block a user