diff options
Diffstat (limited to 'REORG.TODO/nis/rpcsvc')
-rw-r--r-- | REORG.TODO/nis/rpcsvc/nis.h | 616 | ||||
-rw-r--r-- | REORG.TODO/nis/rpcsvc/nis.x | 474 | ||||
-rw-r--r-- | REORG.TODO/nis/rpcsvc/nis_callback.h | 72 | ||||
-rw-r--r-- | REORG.TODO/nis/rpcsvc/nis_callback.x | 63 | ||||
-rw-r--r-- | REORG.TODO/nis/rpcsvc/nis_object.x | 328 | ||||
-rw-r--r-- | REORG.TODO/nis/rpcsvc/nis_tags.h | 129 | ||||
-rw-r--r-- | REORG.TODO/nis/rpcsvc/nislib.h | 286 | ||||
-rw-r--r-- | REORG.TODO/nis/rpcsvc/yp.h | 339 | ||||
-rw-r--r-- | REORG.TODO/nis/rpcsvc/yp.x | 311 | ||||
-rw-r--r-- | REORG.TODO/nis/rpcsvc/yp_prot.h | 366 | ||||
-rw-r--r-- | REORG.TODO/nis/rpcsvc/ypclnt.h | 88 | ||||
-rw-r--r-- | REORG.TODO/nis/rpcsvc/ypupd.h | 88 |
12 files changed, 3160 insertions, 0 deletions
diff --git a/REORG.TODO/nis/rpcsvc/nis.h b/REORG.TODO/nis/rpcsvc/nis.h new file mode 100644 index 0000000000..933c4d9daf --- /dev/null +++ b/REORG.TODO/nis/rpcsvc/nis.h @@ -0,0 +1,616 @@ +/* + * Copyright (c) 2010, Oracle America, Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials + * provided with the distribution. + * * Neither the name of the "Oracle America, Inc." nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _RPCSVC_NIS_H +#define _RPCSVC_NIS_H 1 + +#include <features.h> +#include <rpc/rpc.h> +#include <rpcsvc/nis_tags.h> + +__BEGIN_DECLS + +/* + * nis.h + * + * This file is the main include file for NIS clients. It contains + * both the client library function defines and the various data + * structures used by the NIS service. It includes the file nis_tags.h + * which defines the tag values. This allows the tags to change without + * having to change the nis.x file. + * + * NOTE : THIS FILE IS NOT GENERATED WITH RPCGEN ! SO YOU HAVE TO + * ADD ALL THE CHANGES ON nis_*.x FILES HERE AGAIN ! + * + * I have removed all the Solaris internal structs and variables, + * because they are not supported, Sun changed them between various + * releases and they shouldn't be used in user programs. + * <kukuk@suse.de> + */ + + +#ifndef __nis_object_h +#define __nis_object_h + +#define NIS_MAXSTRINGLEN 255 +#define NIS_MAXNAMELEN 1024 +#define NIS_MAXATTRNAME 32 +#define NIS_MAXATTRVAL 2048 +#define NIS_MAXCOLUMNS 64 +#define NIS_MAXATTR 16 +#define NIS_MAXPATH 1024 +#define NIS_MAXREPLICAS 128 +#define NIS_MAXLINKS 16 +#define NIS_PK_NONE 0 +#define NIS_PK_DH 1 +#define NIS_PK_RSA 2 +#define NIS_PK_KERB 3 +#define NIS_PK_DHEXT 4 + +struct nis_attr { + char *zattr_ndx; + struct { + u_int zattr_val_len; + char *zattr_val_val; + } zattr_val; +}; +typedef struct nis_attr nis_attr; + +typedef char *nis_name; + +enum zotypes { + BOGUS_OBJ = 0, + NO_OBJ = 1, + DIRECTORY_OBJ = 2, + GROUP_OBJ = 3, + TABLE_OBJ = 4, + ENTRY_OBJ = 5, + LINK_OBJ = 6, + PRIVATE_OBJ = 7, + NIS_BOGUS_OBJ = 0, + NIS_NO_OBJ = 1, + NIS_DIRECTORY_OBJ = 2, + NIS_GROUP_OBJ = 3, + NIS_TABLE_OBJ = 4, + NIS_ENTRY_OBJ = 5, + NIS_LINK_OBJ = 6, + NIS_PRIVATE_OBJ = 7 +}; +typedef enum zotypes zotypes; + +enum nstype { + UNKNOWN = 0, + NIS = 1, + SUNYP = 2, + IVY = 3, + DNS = 4, + X500 = 5, + DNANS = 6, + XCHS = 7, + CDS = 8, +}; +typedef enum nstype nstype; + +struct oar_mask { + uint32_t oa_rights; + zotypes oa_otype; +}; +typedef struct oar_mask oar_mask; + +struct endpoint { + char *uaddr; + char *family; + char *proto; +}; +typedef struct endpoint endpoint; + +struct nis_server { + nis_name name; + struct { + u_int ep_len; + endpoint *ep_val; + } ep; + uint32_t key_type; + netobj pkey; +}; +typedef struct nis_server nis_server; + +struct directory_obj { + nis_name do_name; + nstype do_type; + struct { + u_int do_servers_len; + nis_server *do_servers_val; + } do_servers; + uint32_t do_ttl; + struct { + u_int do_armask_len; + oar_mask *do_armask_val; + } do_armask; +}; +typedef struct directory_obj directory_obj; + +#define EN_BINARY 1 +#define EN_CRYPT 2 +#define EN_XDR 4 +#define EN_MODIFIED 8 +#define EN_ASN1 64 + +struct entry_col { + uint32_t ec_flags; + struct { + u_int ec_value_len; + char *ec_value_val; + } ec_value; +}; +typedef struct entry_col entry_col; + +struct entry_obj { + char *en_type; + struct { + u_int en_cols_len; + entry_col *en_cols_val; + } en_cols; +}; +typedef struct entry_obj entry_obj; + +struct group_obj { + uint32_t gr_flags; + struct { + u_int gr_members_len; + nis_name *gr_members_val; + } gr_members; +}; +typedef struct group_obj group_obj; + +struct link_obj { + zotypes li_rtype; + struct { + u_int li_attrs_len; + nis_attr *li_attrs_val; + } li_attrs; + nis_name li_name; +}; +typedef struct link_obj link_obj; + +#define TA_BINARY 1 +#define TA_CRYPT 2 +#define TA_XDR 4 +#define TA_SEARCHABLE 8 +#define TA_CASE 16 +#define TA_MODIFIED 32 +#define TA_ASN1 64 + +struct table_col { + char *tc_name; + uint32_t tc_flags; + uint32_t tc_rights; +}; +typedef struct table_col table_col; + +struct table_obj { + char *ta_type; + int ta_maxcol; + u_char ta_sep; + struct { + u_int ta_cols_len; + table_col *ta_cols_val; + } ta_cols; + char *ta_path; +}; +typedef struct table_obj table_obj; + +struct objdata { + zotypes zo_type; + union { + struct directory_obj di_data; + struct group_obj gr_data; + struct table_obj ta_data; + struct entry_obj en_data; + struct link_obj li_data; + struct { + u_int po_data_len; + char *po_data_val; + } po_data; + } objdata_u; +}; +typedef struct objdata objdata; + +struct nis_oid { + uint32_t ctime; + uint32_t mtime; +}; +typedef struct nis_oid nis_oid; + +struct nis_object { + nis_oid zo_oid; + nis_name zo_name; + nis_name zo_owner; + nis_name zo_group; + nis_name zo_domain; + uint32_t zo_access; + uint32_t zo_ttl; + objdata zo_data; +}; +typedef struct nis_object nis_object; + +#endif /* if __nis_object_h */ + +enum nis_error { + NIS_SUCCESS = 0, + NIS_S_SUCCESS = 1, + NIS_NOTFOUND = 2, + NIS_S_NOTFOUND = 3, + NIS_CACHEEXPIRED = 4, + NIS_NAMEUNREACHABLE = 5, + NIS_UNKNOWNOBJ = 6, + NIS_TRYAGAIN = 7, + NIS_SYSTEMERROR = 8, + NIS_CHAINBROKEN = 9, + NIS_PERMISSION = 10, + NIS_NOTOWNER = 11, + NIS_NOT_ME = 12, + NIS_NOMEMORY = 13, + NIS_NAMEEXISTS = 14, + NIS_NOTMASTER = 15, + NIS_INVALIDOBJ = 16, + NIS_BADNAME = 17, + NIS_NOCALLBACK = 18, + NIS_CBRESULTS = 19, + NIS_NOSUCHNAME = 20, + NIS_NOTUNIQUE = 21, + NIS_IBMODERROR = 22, + NIS_NOSUCHTABLE = 23, + NIS_TYPEMISMATCH = 24, + NIS_LINKNAMEERROR = 25, + NIS_PARTIAL = 26, + NIS_TOOMANYATTRS = 27, + NIS_RPCERROR = 28, + NIS_BADATTRIBUTE = 29, + NIS_NOTSEARCHABLE = 30, + NIS_CBERROR = 31, + NIS_FOREIGNNS = 32, + NIS_BADOBJECT = 33, + NIS_NOTSAMEOBJ = 34, + NIS_MODFAIL = 35, + NIS_BADREQUEST = 36, + NIS_NOTEMPTY = 37, + NIS_COLDSTART_ERR = 38, + NIS_RESYNC = 39, + NIS_FAIL = 40, + NIS_UNAVAIL = 41, + NIS_RES2BIG = 42, + NIS_SRVAUTH = 43, + NIS_CLNTAUTH = 44, + NIS_NOFILESPACE = 45, + NIS_NOPROC = 46, + NIS_DUMPLATER = 47, +}; +typedef enum nis_error nis_error; + +struct nis_result { + nis_error status; + struct { + u_int objects_len; + nis_object *objects_val; + } objects; + netobj cookie; + uint32_t zticks; + uint32_t dticks; + uint32_t aticks; + uint32_t cticks; +}; +typedef struct nis_result nis_result; + +struct ns_request { + nis_name ns_name; + struct { + u_int ns_object_len; + nis_object *ns_object_val; + } ns_object; +}; +typedef struct ns_request ns_request; + +struct ib_request { + nis_name ibr_name; + struct { + u_int ibr_srch_len; + nis_attr *ibr_srch_val; + } ibr_srch; + uint32_t ibr_flags; + struct { + u_int ibr_obj_len; + nis_object *ibr_obj_val; + } ibr_obj; + struct { + u_int ibr_cbhost_len; + nis_server *ibr_cbhost_val; + } ibr_cbhost; + u_int ibr_bufsize; + netobj ibr_cookie; +}; +typedef struct ib_request ib_request; + +struct ping_args { + nis_name dir; + uint32_t stamp; +}; +typedef struct ping_args ping_args; + +enum log_entry_t { + LOG_NOP = 0, + ADD_NAME = 1, + REM_NAME = 2, + MOD_NAME_OLD = 3, + MOD_NAME_NEW = 4, + ADD_IBASE = 5, + REM_IBASE = 6, + MOD_IBASE = 7, + UPD_STAMP = 8, +}; +typedef enum log_entry_t log_entry_t; + +struct log_entry { + uint32_t le_time; + log_entry_t le_type; + nis_name le_princp; + nis_name le_name; + struct { + u_int le_attrs_len; + nis_attr *le_attrs_val; + } le_attrs; + nis_object le_object; +}; +typedef struct log_entry log_entry; + +struct log_result { + nis_error lr_status; + netobj lr_cookie; + struct { + u_int lr_entries_len; + log_entry *lr_entries_val; + } lr_entries; +}; +typedef struct log_result log_result; + +struct cp_result { + nis_error cp_status; + uint32_t cp_zticks; + uint32_t cp_dticks; +}; +typedef struct cp_result cp_result; + +struct nis_tag { + uint32_t tag_type; + char *tag_val; +}; +typedef struct nis_tag nis_tag; + +struct nis_taglist { + struct { + u_int tags_len; + nis_tag *tags_val; + } tags; +}; +typedef struct nis_taglist nis_taglist; + +struct dump_args { + nis_name da_dir; + uint32_t da_time; + struct { + u_int da_cbhost_len; + nis_server *da_cbhost_val; + } da_cbhost; +}; +typedef struct dump_args dump_args; + +struct fd_args { + nis_name dir_name; + nis_name requester; +}; +typedef struct fd_args fd_args; + +struct fd_result { + nis_error status; + nis_name source; + struct { + u_int dir_data_len; + char *dir_data_val; + } dir_data; + struct { + u_int signature_len; + char *signature_val; + } signature; +}; +typedef struct fd_result fd_result; + +/* Generic client creating flags */ +#define ZMH_VC 1 +#define ZMH_DG 2 +#define ZMH_AUTH 4 + +/* Testing Access rights for objects */ + +#define NIS_READ_ACC 1 +#define NIS_MODIFY_ACC 2 +#define NIS_CREATE_ACC 4 +#define NIS_DESTROY_ACC 8 +/* Test macros. a == access rights, m == desired rights. */ +#define NIS_WORLD(a, m) (((a) & (m)) != 0) +#define NIS_GROUP(a, m) (((a) & ((m) << 8)) != 0) +#define NIS_OWNER(a, m) (((a) & ((m) << 16)) != 0) +#define NIS_NOBODY(a, m) (((a) & ((m) << 24)) != 0) +/* + * EOL Alert - The following non-prefixed test macros are + * here for backward compatibility, and will be not be present + * in future releases - use the NIS_*() macros above. + */ +#define WORLD(a, m) (((a) & (m)) != 0) +#define GROUP(a, m) (((a) & ((m) << 8)) != 0) +#define OWNER(a, m) (((a) & ((m) << 16)) != 0) +#define NOBODY(a, m) (((a) & ((m) << 24)) != 0) + +#define OATYPE(d, n) (((d)->do_armask.do_armask_val+n)->oa_otype) +#define OARIGHTS(d, n) (((d)->do_armask.do_armask_val+n)->oa_rights) +#define WORLD_DEFAULT (NIS_READ_ACC) +#define GROUP_DEFAULT (NIS_READ_ACC << 8) +#define OWNER_DEFAULT ((NIS_READ_ACC + NIS_MODIFY_ACC + NIS_CREATE_ACC +\ + NIS_DESTROY_ACC) << 16) +#define DEFAULT_RIGHTS (WORLD_DEFAULT | GROUP_DEFAULT | OWNER_DEFAULT) + +/* Result manipulation defines ... */ +#define NIS_RES_NUMOBJ(x) ((x)->objects.objects_len) +#define NIS_RES_OBJECT(x) ((x)->objects.objects_val) +#define NIS_RES_COOKIE(x) ((x)->cookie) +#define NIS_RES_STATUS(x) ((x)->status) + +/* These defines make getting at the variant part of the object easier. */ +#define TA_data zo_data.objdata_u.ta_data +#define EN_data zo_data.objdata_u.en_data +#define DI_data zo_data.objdata_u.di_data +#define LI_data zo_data.objdata_u.li_data +#define GR_data zo_data.objdata_u.gr_data + +#define __type_of(o) ((o)->zo_data.zo_type) + +/* Declarations for the internal subroutines in nislib.c */ +enum name_pos {SAME_NAME, HIGHER_NAME, LOWER_NAME, NOT_SEQUENTIAL, BAD_NAME}; +typedef enum name_pos name_pos; + +/* + * Defines for getting at column data in entry objects. Because RPCGEN + * generates some rather wordy structures, we create some defines that + * collapse the needed keystrokes to access a particular value using + * these definitions they take an nis_object *, and an int and return + * a u_char * for Value, and an int for length. + */ +#define ENTRY_VAL(obj, col) (obj)->EN_data.en_cols.en_cols_val[col].ec_value.ec_value_val +#define ENTRY_LEN(obj, col) (obj)->EN_data.en_cols.en_cols_val[col].ec_value.ec_value_len + + +/* Prototypes, and extern declarations for the NIS library functions. */ +#include <rpcsvc/nislib.h> +#endif + +/* + * nis_3.h + * + * This file contains definitions that are only of interest to the actual + * service daemon and client stubs. Normal users of NIS will not include + * this file. + * + * NOTE : This include file is automatically created by a combination + * of rpcgen and sed. DO NOT EDIT IT, change the nis.x file instead + * and then remake this file. + */ +#ifndef __nis_3_h +#define __nis_3_h + +#define NIS_PROG 100300 +#define NIS_VERSION 3 + +#define NIS_LOOKUP 1 +extern nis_result * nis_lookup_3 (ns_request *, CLIENT *) __THROW; +extern nis_result * nis_lookup_3_svc (ns_request *, struct svc_req *) __THROW; +#define NIS_ADD 2 +extern nis_result * nis_add_3 (ns_request *, CLIENT *) __THROW; +extern nis_result * nis_add_3_svc (ns_request *, struct svc_req *) __THROW; +#define NIS_MODIFY 3 +extern nis_result * nis_modify_3 (ns_request *, CLIENT *) __THROW; +extern nis_result * nis_modify_3_svc (ns_request *, struct svc_req *) __THROW; +#define NIS_REMOVE 4 +extern nis_result * nis_remove_3 (ns_request *, CLIENT *) __THROW; +extern nis_result * nis_remove_3_svc (ns_request *, struct svc_req *) __THROW; +#define NIS_IBLIST 5 +extern nis_result * nis_iblist_3 (ib_request *, CLIENT *) __THROW; +extern nis_result * nis_iblist_3_svc (ib_request *, struct svc_req *) __THROW; +#define NIS_IBADD 6 +extern nis_result * nis_ibadd_3 (ib_request *, CLIENT *) __THROW; +extern nis_result * nis_ibadd_3_svc (ib_request *, struct svc_req *) __THROW; +#define NIS_IBMODIFY 7 +extern nis_result * nis_ibmodify_3 (ib_request *, CLIENT *) __THROW; +extern nis_result * nis_ibmodify_3_svc (ib_request *, struct svc_req *) + __THROW; +#define NIS_IBREMOVE 8 +extern nis_result * nis_ibremove_3 (ib_request *, CLIENT *) __THROW; +extern nis_result * nis_ibremove_3_svc (ib_request *, struct svc_req *) + __THROW; +#define NIS_IBFIRST 9 +extern nis_result * nis_ibfirst_3 (ib_request *, CLIENT *) __THROW; +extern nis_result * nis_ibfirst_3_svc (ib_request *, struct svc_req *) + __THROW; +#define NIS_IBNEXT 10 +extern nis_result * nis_ibnext_3 (ib_request *, CLIENT *) __THROW; +extern nis_result * nis_ibnext_3_svc (ib_request *, struct svc_req *) __THROW; +#define NIS_FINDDIRECTORY 12 +extern fd_result * nis_finddirectory_3 (fd_args *, CLIENT *) __THROW; +extern fd_result * nis_finddirectory_3_svc (fd_args *, + struct svc_req *) __THROW; +#define NIS_STATUS 14 +extern nis_taglist * nis_status_3 (nis_taglist *, CLIENT *) __THROW; +extern nis_taglist * nis_status_3_svc (nis_taglist *, struct svc_req *) + __THROW; +#define NIS_DUMPLOG 15 +extern log_result * nis_dumplog_3 (dump_args *, CLIENT *) __THROW; +extern log_result * nis_dumplog_3_svc (dump_args *, struct svc_req *) __THROW; +#define NIS_DUMP 16 +extern log_result * nis_dump_3 (dump_args *, CLIENT *) __THROW; +extern log_result * nis_dump_3_svc (dump_args *, struct svc_req *) __THROW; +#define NIS_CALLBACK 17 +extern bool_t * nis_callback_3 (netobj *, CLIENT *) __THROW; +extern bool_t * nis_callback_3_svc (netobj *, struct svc_req *) __THROW; +#define NIS_CPTIME 18 +extern uint32_t * nis_cptime_3 (nis_name *, CLIENT *) __THROW; +extern uint32_t * nis_cptime_3_svc (nis_name *, struct svc_req *) __THROW; +#define NIS_CHECKPOINT 19 +extern cp_result * nis_checkpoint_3 (nis_name *, CLIENT *) __THROW; +extern cp_result * nis_checkpoint_3_svc (nis_name *, struct svc_req *) + __THROW; +#define NIS_PING 20 +extern void * nis_ping_3 (ping_args *, CLIENT *) __THROW; +extern void * nis_ping_3_svc (ping_args *, struct svc_req *) __THROW; +#define NIS_SERVSTATE 21 +extern nis_taglist * nis_servstate_3 (nis_taglist *, CLIENT *) __THROW; +extern nis_taglist * nis_servstate_3_svc (nis_taglist *, + struct svc_req *) __THROW; +#define NIS_MKDIR 22 +extern nis_error * nis_mkdir_3 (nis_name *, CLIENT *) __THROW; +extern nis_error * nis_mkdir_3_svc (nis_name *, struct svc_req *) __THROW; +#define NIS_RMDIR 23 +extern nis_error * nis_rmdir_3 (nis_name *, CLIENT *) __THROW; +extern nis_error * nis_rmdir_3_svc (nis_name *, struct svc_req *) __THROW; +#define NIS_UPDKEYS 24 +extern nis_error * nis_updkeys_3 (nis_name *, CLIENT *) __THROW; +extern nis_error * nis_updkeys_3_svc (nis_name *, struct svc_req *) __THROW; + +__END_DECLS + +#endif /* ! _RPCSVC_NIS_H */ diff --git a/REORG.TODO/nis/rpcsvc/nis.x b/REORG.TODO/nis/rpcsvc/nis.x new file mode 100644 index 0000000000..e318af29a6 --- /dev/null +++ b/REORG.TODO/nis/rpcsvc/nis.x @@ -0,0 +1,474 @@ +%/* +% * Copyright (c) 2010, Oracle America, Inc. +% * +% * Redistribution and use in source and binary forms, with or without +% * modification, are permitted provided that the following conditions are +% * met: +% * +% * * Redistributions of source code must retain the above copyright +% * notice, this list of conditions and the following disclaimer. +% * * Redistributions in binary form must reproduce the above +% * copyright notice, this list of conditions and the following +% * disclaimer in the documentation and/or other materials +% * provided with the distribution. +% * * Neither the name of the "Oracle America, Inc." nor the names of its +% * contributors may be used to endorse or promote products derived +% * from this software without specific prior written permission. +% * +% * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +% * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +% * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +% * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +% * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, +% * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +% * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +% * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +% * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +% * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +% * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +% * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +% */ + +#ifdef RPC_HDR +%/* +% * nis.h +% * +% * This file is the main include file for NIS clients. It contains +% * both the client library function defines and the various data +% * structures used by the NIS service. It includes the file nis_tags.h +% * which defines the tag values. This allows the tags to change without +% * having to change the nis.x file. +% * +% * NOTE : DO NOT EDIT THIS FILE! It is automatically generated when +% * rpcgen is run on the nis.x file. Note that there is a +% * simple sed script to remove some unneeded lines. (See the +% * Makefile target nis.h) +% * +% */ +%#include <rpcsvc/nis_tags.h> +#endif + +/* This gets stuffed into the source files. */ +#if RPC_HDR +%#include <rpc/xdr.h> +#endif + +/* Include the RPC Language description of NIS objects */ +#include "nis_object.x" + +/* Errors that can be returned by the service */ +enum nis_error { + NIS_SUCCESS = 0, /* A-ok, let's rock n roll */ + NIS_S_SUCCESS = 1, /* Name found (maybe) */ + NIS_NOTFOUND = 2, /* Name definitely not found */ + NIS_S_NOTFOUND = 3, /* Name maybe not found */ + NIS_CACHEEXPIRED = 4, /* Name exists but cache out of date */ + NIS_NAMEUNREACHABLE = 5, /* Can't get there from here */ + NIS_UNKNOWNOBJ = 6, /* Object type is bogus */ + NIS_TRYAGAIN = 7, /* I'm busy, call back */ + NIS_SYSTEMERROR = 8, /* Generic system error */ + NIS_CHAINBROKEN = 9, /* First/Next warning */ + NIS_PERMISSION = 10, /* Not enough permission to access */ + NIS_NOTOWNER = 11, /* You don't own it, sorry */ + NIS_NOT_ME = 12, /* I don't serve this name */ + NIS_NOMEMORY = 13, /* Outta VM! Help! */ + NIS_NAMEEXISTS = 14, /* Can't create over another name */ + NIS_NOTMASTER = 15, /* I'm justa secondaray, don't ask me */ + NIS_INVALIDOBJ = 16, /* Object is broken somehow */ + NIS_BADNAME = 17, /* Unparsable name */ + NIS_NOCALLBACK = 18, /* Couldn't talk to call back proc */ + NIS_CBRESULTS = 19, /* Results being called back to you */ + NIS_NOSUCHNAME = 20, /* Name unknown */ + NIS_NOTUNIQUE = 21, /* Value is not uniques (entry) */ + NIS_IBMODERROR = 22, /* Inf. Base. Modify error. */ + NIS_NOSUCHTABLE = 23, /* Name for table was wrong */ + NIS_TYPEMISMATCH = 24, /* Entry and table type mismatch */ + NIS_LINKNAMEERROR = 25, /* Link points to bogus name */ + NIS_PARTIAL = 26, /* Partial success, found table */ + NIS_TOOMANYATTRS = 27, /* Too many attributes */ + NIS_RPCERROR = 28, /* RPC error encountered */ + NIS_BADATTRIBUTE = 29, /* Bad or invalid attribute */ + NIS_NOTSEARCHABLE = 30, /* Non-searchable object searched */ + NIS_CBERROR = 31, /* Error during callback (svc crash) */ + NIS_FOREIGNNS = 32, /* Foreign Namespace */ + NIS_BADOBJECT = 33, /* Malformed object structure */ + NIS_NOTSAMEOBJ = 34, /* Object swapped during deletion */ + NIS_MODFAIL = 35, /* Failure during a Modify. */ + NIS_BADREQUEST = 36, /* Illegal query for table */ + NIS_NOTEMPTY = 37, /* Attempt to remove a non-empty tbl */ + NIS_COLDSTART_ERR = 38, /* Error accesing the cold start file */ + NIS_RESYNC = 39, /* Transaction log too far out of date */ + NIS_FAIL = 40, /* NIS operation failed. */ + NIS_UNAVAIL = 41, /* NIS+ service is unavailable (client) */ + NIS_RES2BIG = 42, /* NIS+ result too big for datagram */ + NIS_SRVAUTH = 43, /* NIS+ server wasn't authenticated. */ + NIS_CLNTAUTH = 44, /* NIS+ Client wasn't authenticated. */ + NIS_NOFILESPACE = 45, /* NIS+ server ran out of disk space */ + NIS_NOPROC = 46, /* NIS+ server couldn't create new proc */ + NIS_DUMPLATER = 47 /* NIS+ server already has dump child */ +}; + + +/* + * Structure definitions for the parameters and results of the actual + * NIS RPC calls. + * + * This is the standard result (in the protocol) of most of the nis + * requests. + */ + +struct nis_result { + nis_error status; /* Status of the response */ + nis_object objects<>; /* objects found */ + netobj cookie; /* Cookie Data */ + uint32_t zticks; /* server ticks */ + uint32_t dticks; /* DBM ticks. */ + uint32_t aticks; /* Cache (accel) ticks */ + uint32_t cticks; /* Client ticks */ +}; + +/* + * A Name Service request + * This request is used to access the name space, ns_name is the name + * of the object within the namespace and the object is it's value, for + * add/modify, a copy of the original for remove. + */ + +struct ns_request { + nis_name ns_name; /* Name in the NIS name space */ + nis_object ns_object<1>; /* Optional Object (add/remove) */ +}; + +/* + * An information base request + * This request includes the NIS name of the table we wish to search, the + * search criteria in the form of attribute/value pairs and an optional + * callback program number. If the callback program number is provided + * the server will send back objects one at a time, otherwise it will + * return them all in the response. + */ + +struct ib_request { + nis_name ibr_name; /* The name of the Table */ + nis_attr ibr_srch<>; /* The search critereia */ + uint32_t ibr_flags; /* Optional flags */ + nis_object ibr_obj<1>; /* optional object (add/modify) */ + nis_server ibr_cbhost<1>; /* Optional callback info */ + u_int ibr_bufsize; /* Optional first/next bufsize */ + netobj ibr_cookie; /* The first/next cookie */ +}; + +/* + * This argument to the PING call notifies the replicas that something in + * a directory has changed and this is it's timestamp. The replica will use + * the timestamp to determine if its resync operation was successful. + */ +struct ping_args { + nis_name dir; /* Directory that had the change */ + uint32_t stamp; /* timestamp of the transaction */ +}; + +/* + * These are the type of entries that are stored in the transaction log, + * note that modifications will appear as two entries, for names, they have + * a "OLD" entry followed by a "NEW" entry. For entries in tables, there + * is a remove followed by an add. It is done this way so that we can read + * the log backwards to back out transactions and forwards to propogate + * updated. + */ +enum log_entry_t { + LOG_NOP = 0, + ADD_NAME = 1, /* Name Added to name space */ + REM_NAME = 2, /* Name removed from name space */ + MOD_NAME_OLD = 3, /* Name was modified in the name space */ + MOD_NAME_NEW = 4, /* Name was modified in the name space */ + ADD_IBASE = 5, /* Entry added to information base */ + REM_IBASE = 6, /* Entry removed from information base */ + MOD_IBASE = 7, /* Entry was modified in information base */ + UPD_STAMP = 8 /* Update timestamp (used as fenceposts) */ +}; + +/* + * This result is returned from the name service when it is requested to + * dump logged entries from its transaction log. Information base updates + * will have the name of the information base in the le_name field and + * a canonical set of attribute/value pairs to fully specify the entry's + * 'name'. + */ +struct log_entry { + uint32_t le_time; /* Time in seconds */ + log_entry_t le_type; /* Type of log entry */ + nis_name le_princp; /* Principal making the change */ + nis_name le_name; /* Name of table/dir involved */ + nis_attr le_attrs<>; /* List of AV pairs. */ + nis_object le_object; /* Actual object value */ +}; + +struct log_result { + nis_error lr_status; /* The status itself */ + netobj lr_cookie; /* Used by the dump callback */ + log_entry lr_entries<>; /* zero or more entries */ +}; + +struct cp_result { + nis_error cp_status; /* Status of the checkpoint */ + uint32_t cp_zticks; /* Service 'ticks' */ + uint32_t cp_dticks; /* Database 'ticks' */ +}; + +/* + * This structure defines a generic NIS tag list. The taglist contains + * zero or tags, each of which is a type and a value. (u_int). + * These are used to report statistics (see tag definitions below) + * and to set or reset state variables. + */ +struct nis_tag { + uint32_t tag_type; /* Statistic tag (may vary) */ + string tag_val<>; /* Statistic value may also vary */ +}; + +struct nis_taglist { + nis_tag tags<>; /* List of tags */ +}; + +struct dump_args { + nis_name da_dir; /* Directory to dump */ + uint32_t da_time; /* From this timestamp */ + nis_server da_cbhost<1>; /* Callback to use. */ +}; + +struct fd_args { + nis_name dir_name; /* The directory we're looking for */ + nis_name requester; /* Host principal name for signature */ +}; + +struct fd_result { + nis_error status; /* Status returned by function */ + nis_name source; /* Source of this answer */ + opaque dir_data<>; /* Directory Data (XDR'ed) */ + opaque signature<>; /* Signature of the source */ +}; + +%/* +% * Structures used for server binding. +% */ +struct nis_bound_endpoint { + endpoint ep; + int generation; + int rank; + uint32_t flags; + int hostnum; + int epnum; + nis_name uaddr; + endpoint cbep; +}; +typedef struct nis_bound_endpoint nis_bound_endpoint; + +struct nis_bound_directory { + int generation; + int min_rank; /* minimum rank of bound endpoints */ + int optimal_rank; /* best possible rank of all endpoints */ + directory_obj dobj; + nis_bound_endpoint BEP<>; +}; +typedef struct nis_bound_directory nis_bound_directory; +%#define bep_len BEP.BEP_len +%#define bep_val BEP.BEP_val + +struct nis_active_endpoint { + endpoint ep; + nis_name hostname; + int rank; + int uaddr_generation; + nis_name uaddr; + int cbep_generation; + endpoint cbep; +}; +typedef struct nis_active_endpoint nis_active_endpoint; + +%/* defines for nis_bound_endpoint.flags */ +%#define NIS_BOUND 0x1 +%#define NIS_TRANSIENT_ERRORS 0x2 + +program NIS_PROG { + + /* RPC Language description of the NIS+ protocol */ + version NIS_VERSION { + /* The name service functions */ + nis_result NIS_LOOKUP(ns_request) = 1; + nis_result NIS_ADD(ns_request) = 2; + nis_result NIS_MODIFY(ns_request) = 3; + nis_result NIS_REMOVE(ns_request) = 4; + + /* The information base functions */ + nis_result NIS_IBLIST(ib_request) = 5; + nis_result NIS_IBADD(ib_request) = 6; + nis_result NIS_IBMODIFY(ib_request) = 7; + nis_result NIS_IBREMOVE(ib_request) = 8; + nis_result NIS_IBFIRST(ib_request) = 9; + nis_result NIS_IBNEXT(ib_request) = 10; + + /* NIS Administrative functions */ + fd_result NIS_FINDDIRECTORY(fd_args) = 12; + + /* If fetch and optionally reset statistics */ + nis_taglist NIS_STATUS(nis_taglist) = 14; + + /* Dump changes to directory since time in da_time */ + log_result NIS_DUMPLOG(dump_args) = 15; + + /* Dump contents of directory named */ + log_result NIS_DUMP(dump_args) = 16; + + /* Check status of callback thread */ + bool NIS_CALLBACK(netobj) = 17; + + /* Return last update time for named dir */ + uint32_t NIS_CPTIME(nis_name) = 18; + + /* Checkpoint directory or table named */ + cp_result NIS_CHECKPOINT(nis_name) = 19; + + /* Send 'status changed' ping to replicates */ + void NIS_PING(ping_args) = 20; + + /* Modify server behaviour (such as debugging) */ + nis_taglist NIS_SERVSTATE(nis_taglist) = 21; + + /* Create a Directory */ + nis_error NIS_MKDIR(nis_name) = 22; + + /* Remove a Directory */ + nis_error NIS_RMDIR(nis_name) = 23; + + /* Update public keys of a directory object */ + nis_error NIS_UPDKEYS(nis_name) = 24; + } = 3; +} = 100300; + +/* + * Included below are the defines that become part of nis.h, + * they are technically not part of the protocol, but do define + * key aspects of the implementation and are therefore useful + * in building a conforming server or client. + */ +#if RPC_HDR +%/* +% * Generic "hash" datastructures, used by all types of hashed data. +% */ +%struct nis_hash_data { +% nis_name name; /* NIS name of hashed item */ +% int keychain; /* It's hash key (for pop) */ +% struct nis_hash_data *next; /* Hash collision pointer */ +% struct nis_hash_data *prv_item; /* A serial, doubly linked list */ +% struct nis_hash_data *nxt_item; /* of items in the hash table */ +%}; +%typedef struct nis_hash_data NIS_HASH_ITEM; +% +%struct nis_hash_table { +% NIS_HASH_ITEM *keys[64]; /* A hash table of items */ +% NIS_HASH_ITEM *first; /* The first "item" in serial list */ +%}; +%typedef struct nis_hash_table NIS_HASH_TABLE; +% +%/* Structure for storing dynamically allocated static data */ +%struct nis_sdata { +% void *buf; /* Memory allocation pointer */ +% u_int size; /* Buffer size */ +%}; +% +%/* Generic client creating flags */ +%#define ZMH_VC 1 +%#define ZMH_DG 2 +%#define ZMH_AUTH 4 +% +%/* Testing Access rights for objects */ +% +%#define NIS_READ_ACC 1 +%#define NIS_MODIFY_ACC 2 +%#define NIS_CREATE_ACC 4 +%#define NIS_DESTROY_ACC 8 +%/* Test macros. a == access rights, m == desired rights. */ +%#define NIS_WORLD(a, m) (((a) & (m)) != 0) +%#define NIS_GROUP(a, m) (((a) & ((m) << 8)) != 0) +%#define NIS_OWNER(a, m) (((a) & ((m) << 16)) != 0) +%#define NIS_NOBODY(a, m) (((a) & ((m) << 24)) != 0) +%/* +% * EOL Alert - The following non-prefixed test macros are +% * here for backward compatability, and will be not be present +% * in future releases - use the NIS_*() macros above. +% */ +%#define WORLD(a, m) (((a) & (m)) != 0) +%#define GROUP(a, m) (((a) & ((m) << 8)) != 0) +%#define OWNER(a, m) (((a) & ((m) << 16)) != 0) +%#define NOBODY(a, m) (((a) & ((m) << 24)) != 0) +% +%#define OATYPE(d, n) (((d)->do_armask.do_armask_val+n)->oa_otype) +%#define OARIGHTS(d, n) (((d)->do_armask.do_armask_val+n)->oa_rights) +%#define WORLD_DEFAULT (NIS_READ_ACC) +%#define GROUP_DEFAULT (NIS_READ_ACC << 8) +%#define OWNER_DEFAULT ((NIS_READ_ACC +\ + NIS_MODIFY_ACC +\ + NIS_CREATE_ACC +\ + NIS_DESTROY_ACC) << 16) +%#define DEFAULT_RIGHTS (WORLD_DEFAULT | GROUP_DEFAULT | OWNER_DEFAULT) +% +%/* Result manipulation defines ... */ +%#define NIS_RES_NUMOBJ(x) ((x)->objects.objects_len) +%#define NIS_RES_OBJECT(x) ((x)->objects.objects_val) +%#define NIS_RES_COOKIE(x) ((x)->cookie) +%#define NIS_RES_STATUS(x) ((x)->status) +% +%/* These defines make getting at the variant part of the object easier. */ +%#define TA_data zo_data.objdata_u.ta_data +%#define EN_data zo_data.objdata_u.en_data +%#define DI_data zo_data.objdata_u.di_data +%#define LI_data zo_data.objdata_u.li_data +%#define GR_data zo_data.objdata_u.gr_data +% +%#define __type_of(o) ((o)->zo_data.zo_type) +% +%/* Declarations for the internal subroutines in nislib.c */ +%enum name_pos {SAME_NAME, HIGHER_NAME, LOWER_NAME, NOT_SEQUENTIAL, BAD_NAME}; +%typedef enum name_pos name_pos; +% +%/* +% * Defines for getting at column data in entry objects. Because RPCGEN +% * generates some rather wordy structures, we create some defines that +% * collapse the needed keystrokes to access a particular value using +% * these definitions they take an nis_object *, and an int and return +% * a u_char * for Value, and an int for length. +% */ +%#define ENTRY_VAL(obj, col) \ +% (obj)->EN_data.en_cols.en_cols_val[col].ec_value.ec_value_val +%#define ENTRY_LEN(obj, col) \ +% (obj)->EN_data.en_cols.en_cols_val[col].ec_value.ec_value_len +% +% +% +%#ifdef __cplusplus +%} +%#endif +% +%/* Prototypes, and extern declarations for the NIS library functions. */ +%#include <rpcsvc/nislib.h> +%#endif /* __NIS_RPCGEN_H */ +%/* EDIT_START */ +% +%/* +% * nis_3.h +% * +% * This file contains definitions that are only of interest to the actual +% * service daemon and client stubs. Normal users of NIS will not include +% * this file. +% * +% * NOTE : This include file is automatically created by a combination +% * of rpcgen and sed. DO NOT EDIT IT, change the nis.x file instead +% * and then remake this file. +% */ +%#ifndef __nis_3_h +%#define __nis_3_h +%#ifdef __cplusplus +%extern "C" { +%#endif +#endif diff --git a/REORG.TODO/nis/rpcsvc/nis_callback.h b/REORG.TODO/nis/rpcsvc/nis_callback.h new file mode 100644 index 0000000000..6f05728e2a --- /dev/null +++ b/REORG.TODO/nis/rpcsvc/nis_callback.h @@ -0,0 +1,72 @@ +/* + * Copyright (c) 2010, Oracle America, Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials + * provided with the distribution. + * * Neither the name of the "Oracle America, Inc." nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#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 100302 +#define CB_VERS 1 + +#define CBPROC_RECEIVE 1 +extern bool_t * cbproc_receive_1 (cback_data *, CLIENT *) __THROW; +extern bool_t * cbproc_receive_1_svc (cback_data *, struct svc_req *) __THROW; + +#define CBPROC_FINISH 2 +extern void * cbproc_finish_1 (void *, CLIENT *) __THROW; +extern void * cbproc_finish_1_svc (void *, struct svc_req *) __THROW; + +#define CBPROC_ERROR 3 +extern void * cbproc_error_1 (nis_error *, CLIENT *) __THROW; +extern void * cbproc_error_1_svc (nis_error *, struct svc_req *) __THROW; +extern int cb_prog_1_freeresult (SVCXPRT *, xdrproc_t, caddr_t) __THROW; + +/* the xdr functions */ + +extern bool_t xdr_obj_p (XDR *, obj_p*) __THROW; +extern bool_t xdr_cback_data (XDR *, cback_data*) __THROW; + +__END_DECLS + +#endif /* !_RPCVSC_NIS_CALLBACK_H */ diff --git a/REORG.TODO/nis/rpcsvc/nis_callback.x b/REORG.TODO/nis/rpcsvc/nis_callback.x new file mode 100644 index 0000000000..0fdca9eeec --- /dev/null +++ b/REORG.TODO/nis/rpcsvc/nis_callback.x @@ -0,0 +1,63 @@ +%/* +% * Copyright (c) 2010, Oracle America, Inc. +% * +% * Redistribution and use in source and binary forms, with or without +% * modification, are permitted provided that the following conditions are +% * met: +% * +% * * Redistributions of source code must retain the above copyright +% * notice, this list of conditions and the following disclaimer. +% * * Redistributions in binary form must reproduce the above +% * copyright notice, this list of conditions and the following +% * disclaimer in the documentation and/or other materials +% * provided with the distribution. +% * * Neither the name of the "Oracle America, Inc." nor the names of its +% * contributors may be used to endorse or promote products derived +% * from this software without specific prior written permission. +% * +% * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +% * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +% * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +% * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +% * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, +% * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +% * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +% * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +% * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +% * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +% * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +% * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +% */ + +/* + * nis_callback.x + */ + +%#pragma ident "@(#)nis_callback.x 1.7 94/05/03" + +/* + * "@(#)zns_cback.x 1.2 90/09/10" + * + * RPCL description of the Callback Service. + */ + +#ifdef RPC_HDR +%#include <rpcsvc/nis.h> +#endif +#ifdef RPC_XDR +%#include "nis_clnt.h" +#endif + +typedef nis_object *obj_p; + +struct cback_data { + obj_p entries<>; /* List of objects */ +}; + +program CB_PROG { + version CB_VERS { + bool CBPROC_RECEIVE(cback_data) = 1; + void CBPROC_FINISH(void) = 2; + void CBPROC_ERROR(nis_error) = 3; + } = 1; +} = 100302; diff --git a/REORG.TODO/nis/rpcsvc/nis_object.x b/REORG.TODO/nis/rpcsvc/nis_object.x new file mode 100644 index 0000000000..774b38fa9c --- /dev/null +++ b/REORG.TODO/nis/rpcsvc/nis_object.x @@ -0,0 +1,328 @@ +/* + * nis_object.x + * + * Copyright (c) 2010, Oracle America, Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials + * provided with the distribution. + * * Neither the name of the "Oracle America, Inc." nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +%#pragma ident "@(#)nis_object.x 1.12 97/11/19" + +#if RPC_HDR +% +%#ifndef __nis_object_h +%#define __nis_object_h +% +#endif +/* + * This file defines the format for a NIS object in RPC language. + * It is included by the main .x file and the database access protocol + * file. It is common because both of them need to deal with the same + * type of object. Generating the actual code though is a bit messy because + * the nis.x file and the nis_dba.x file will generate xdr routines to + * encode/decode objects when only one set is needed. Such is life when + * one is using rpcgen. + * + * Note, the protocol doesn't specify any limits on such things as + * maximum name length, number of attributes, etc. These are enforced + * by the database backend. When you hit them you will no. Also see + * the db_getlimits() function for fetching the limit values. + * + */ + +/* Some manifest constants, chosen to maximize flexibility without + * plugging the wire full of data. + */ +const NIS_MAXSTRINGLEN = 255; +const NIS_MAXNAMELEN = 1024; +const NIS_MAXATTRNAME = 32; +const NIS_MAXATTRVAL = 2048; +const NIS_MAXCOLUMNS = 64; +const NIS_MAXATTR = 16; +const NIS_MAXPATH = 1024; +const NIS_MAXREPLICAS = 128; +const NIS_MAXLINKS = 16; + +const NIS_PK_NONE = 0; /* no public key (unix/sys auth) */ +const NIS_PK_DH = 1; /* Public key is Diffie-Hellman type */ +const NIS_PK_RSA = 2; /* Public key if RSA type */ +const NIS_PK_KERB = 3; /* Use kerberos style authentication */ +const NIS_PK_DHEXT = 4; /* Extended Diffie-Hellman for RPC-GSS */ + +/* + * The fundamental name type of NIS. The name may consist of two parts, + * the first being the fully qualified name, and the second being an + * optional set of attribute/value pairs. + */ +struct nis_attr { + string zattr_ndx<>; /* name of the index */ + opaque zattr_val<>; /* Value for the attribute. */ +}; + +typedef string nis_name<>; /* The NIS name itself. */ + +/* NIS object types are defined by the following enumeration. The numbers + * they use are based on the following scheme : + * 0 - 1023 are reserved for Sun, + * 1024 - 2047 are defined to be private to a particular tree. + * 2048 - 4095 are defined to be user defined. + * 4096 - ... are reserved for future use. + * + * EOL Alert - The non-prefixed names are present for backward + * compatability only, and will not exist in future releases. Use + * the NIS_* names for future compatability. + */ + +enum zotypes { + + BOGUS_OBJ = 0, /* Uninitialized object structure */ + NO_OBJ = 1, /* NULL object (no data) */ + DIRECTORY_OBJ = 2, /* Directory object describing domain */ + GROUP_OBJ = 3, /* Group object (a list of names) */ + TABLE_OBJ = 4, /* Table object (a database schema) */ + ENTRY_OBJ = 5, /* Entry object (a database record) */ + LINK_OBJ = 6, /* A name link. */ + PRIVATE_OBJ = 7, /* Private object (all opaque data) */ + + NIS_BOGUS_OBJ = 0, /* Uninitialized object structure */ + NIS_NO_OBJ = 1, /* NULL object (no data) */ + NIS_DIRECTORY_OBJ = 2, /* Directory object describing domain */ + NIS_GROUP_OBJ = 3, /* Group object (a list of names) */ + NIS_TABLE_OBJ = 4, /* Table object (a database schema) */ + NIS_ENTRY_OBJ = 5, /* Entry object (a database record) */ + NIS_LINK_OBJ = 6, /* A name link. */ + NIS_PRIVATE_OBJ = 7 /* Private object (all opaque data) */ +}; + +/* + * The types of Name services NIS knows about. They are enumerated + * here. The Binder code will use this type to determine if it has + * a set of library routines that will access the indicated name service. + */ +enum nstype { + UNKNOWN = 0, + NIS = 1, /* Nis Plus Service */ + SUNYP = 2, /* Old NIS Service */ + IVY = 3, /* Nis Plus Plus Service */ + DNS = 4, /* Domain Name Service */ + X500 = 5, /* ISO/CCCIT X.500 Service */ + DNANS = 6, /* Digital DECNet Name Service */ + XCHS = 7, /* Xerox ClearingHouse Service */ + CDS= 8 +}; + +/* + * DIRECTORY - The name service object. These objects identify other name + * servers that are serving some portion of the name space. Each has a + * type associated with it. The resolver library will note whether or not + * is has the needed routines to access that type of service. + * The oarmask structure defines an access rights mask on a per object + * type basis for the name spaces. The only bits currently used are + * create and destroy. By enabling or disabling these access rights for + * a specific object type for a one of the accessor entities (owner, + * group, world) the administrator can control what types of objects + * may be freely added to the name space and which require the + * administrator's approval. + */ +struct oar_mask { + uint32_t oa_rights; /* Access rights mask */ + zotypes oa_otype; /* Object type */ +}; + +struct endpoint { + string uaddr<>; + string family<>; /* Transport family (INET, OSI, etc) */ + string proto<>; /* Protocol (TCP, UDP, CLNP, etc) */ +}; + +/* + * Note: pkey is a netobj which is limited to 1024 bytes which limits the + * keysize to 8192 bits. This is consider to be a reasonable limit for + * the expected lifetime of this service. + */ +struct nis_server { + nis_name name; /* Principal name of the server */ + endpoint ep<>; /* Universal addr(s) for server */ + uint32_t key_type; /* Public key type */ + netobj pkey; /* server's public key */ +}; + +struct directory_obj { + nis_name do_name; /* Name of the directory being served */ + nstype do_type; /* one of NIS, DNS, IVY, YP, or X.500 */ + nis_server do_servers<>; /* <0> == Primary name server */ + uint32_t do_ttl; /* Time To Live (for caches) */ + oar_mask do_armask<>; /* Create/Destroy rights by object type */ +}; + +/* + * ENTRY - This is one row of data from an information base. + * The type value is used by the client library to convert the entry to + * it's internal structure representation. The Table name is a back pointer + * to the table where the entry is stored. This allows the client library + * to determine where to send a request if the client wishes to change this + * entry but got to it through a LINK rather than directly. + * If the entry is a "standalone" entry then this field is void. + */ +const EN_BINARY = 1; /* Indicates value is binary data */ +const EN_CRYPT = 2; /* Indicates the value is encrypted */ +const EN_XDR = 4; /* Indicates the value is XDR encoded */ +const EN_MODIFIED = 8; /* Indicates entry is modified. */ +const EN_ASN1 = 64; /* Means contents use ASN.1 encoding */ + +struct entry_col { + uint32_t ec_flags; /* Flags for this value */ + opaque ec_value<>; /* It's textual value */ +}; + +struct entry_obj { + string en_type<>; /* Type of entry such as "passwd" */ + entry_col en_cols<>; /* Value for the entry */ +}; + +/* + * GROUP - The group object contains a list of NIS principal names. Groups + * are used to authorize principals. Each object has a set of access rights + * for members of its group. Principal names in groups are in the form + * name.directory and recursive groups are expressed as @groupname.directory + */ +struct group_obj { + uint32_t gr_flags; /* Flags controlling group */ + nis_name gr_members<>; /* List of names in group */ +}; + +/* + * LINK - This is the LINK object. It is quite similar to a symbolic link + * in the UNIX filesystem. The attributes in the main object structure are + * relative to the LINK data and not what it points to (like the file system) + * "modify" privleges here indicate the right to modify what the link points + * at and not to modify that actual object pointed to by the link. + */ +struct link_obj { + zotypes li_rtype; /* Real type of the object */ + nis_attr li_attrs<>; /* Attribute/Values for tables */ + nis_name li_name; /* The object's real NIS name */ +}; + +/* + * TABLE - This is the table object. It implements a simple + * data base that applications and use for configuration or + * administration purposes. The role of the table is to group together + * a set of related entries. Tables are the simple database component + * of NIS. Like many databases, tables are logically divided into columns + * and rows. The columns are labeled with indexes and each ENTRY makes + * up a row. Rows may be addressed within the table by selecting one + * or more indexes, and values for those indexes. Each row which has + * a value for the given index that matches the desired value is returned. + * Within the definition of each column there is a flags variable, this + * variable contains flags which determine whether or not the column is + * searchable, contains binary data, and access rights for the entry objects + * column value. + */ + +const TA_BINARY = 1; /* Means table data is binary */ +const TA_CRYPT = 2; /* Means value should be encrypted */ +const TA_XDR = 4; /* Means value is XDR encoded */ +const TA_SEARCHABLE = 8; /* Means this column is searchable */ +const TA_CASE = 16; /* Means this column is Case Sensitive */ +const TA_MODIFIED = 32; /* Means this columns attrs are modified*/ +const TA_ASN1 = 64; /* Means contents use ASN.1 encoding */ + +struct table_col { + string tc_name<64>; /* Column Name */ + uint32_t tc_flags; /* control flags */ + uint32_t tc_rights; /* Access rights mask */ +}; + +struct table_obj { + string ta_type<64>; /* Table type such as "passwd" */ + int ta_maxcol; /* Total number of columns */ + u_char ta_sep; /* Separator character */ + table_col ta_cols<>; /* The number of table indexes */ + string ta_path<>; /* A search path for this table */ +}; + +/* + * This union joins together all of the currently known objects. + */ +union objdata switch (zotypes zo_type) { + case NIS_DIRECTORY_OBJ : + struct directory_obj di_data; + case NIS_GROUP_OBJ : + struct group_obj gr_data; + case NIS_TABLE_OBJ : + struct table_obj ta_data; + case NIS_ENTRY_OBJ: + struct entry_obj en_data; + case NIS_LINK_OBJ : + struct link_obj li_data; + case NIS_PRIVATE_OBJ : + opaque po_data<>; + case NIS_NO_OBJ : + void; + case NIS_BOGUS_OBJ : + void; + default : + void; +}; + +/* + * This is the basic NIS object data type. It consists of a generic part + * which all objects contain, and a specialized part which varies depending + * on the type of the object. All of the specialized sections have been + * described above. You might have wondered why they all start with an + * integer size, followed by the useful data. The answer is, when the + * server doesn't recognize the type returned it treats it as opaque data. + * And the definition for opaque data is {int size; char *data;}. In this + * way, servers and utility routines that do not understand a given type + * may still pass it around. One has to be careful in setting + * this variable accurately, it must take into account such things as + * XDR padding of structures etc. The best way to set it is to note one's + * position in the XDR encoding stream, encode the structure, look at the + * new position and calculate the size. + */ +struct nis_oid { + uint32_t ctime; /* Time of objects creation */ + uint32_t mtime; /* Time of objects modification */ +}; + +struct nis_object { + nis_oid zo_oid; /* object identity verifier. */ + nis_name zo_name; /* The NIS name for this object */ + nis_name zo_owner; /* NIS name of object owner. */ + nis_name zo_group; /* NIS name of access group. */ + nis_name zo_domain; /* The administrator for the object */ + uint32_t zo_access; /* Access rights (owner, group, world) */ + uint32_t zo_ttl; /* Object's time to live in seconds. */ + objdata zo_data; /* Data structure for this type */ +}; +#if RPC_HDR +% +%#endif /* if __nis_object_h */ +% +#endif diff --git a/REORG.TODO/nis/rpcsvc/nis_tags.h b/REORG.TODO/nis/rpcsvc/nis_tags.h new file mode 100644 index 0000000000..c2dc7fd269 --- /dev/null +++ b/REORG.TODO/nis/rpcsvc/nis_tags.h @@ -0,0 +1,129 @@ +/* + * Copyright (c) 2010, Oracle America, Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials + * provided with the distribution. + * * Neither the name of the "Oracle America, Inc." nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * nis_tags.h + * + * This file contains the tags and statistics definitions. It is + * automatically included by nis.h + */ + +#ifndef _RPCSVC_NIS_TAGS_H +#define _RPCSVC_NIS_TAGS_H + +#if 0 +#pragma ident "@(#)nis_tags.h 1.16 96/10/25" +#endif +/* from file: zns_tags.h 1.7 */ + +#ifdef __cplusplus +extern "C" { +#endif + + +#define NIS_DIR "data" + +/* Lookup and List function flags */ +#define FOLLOW_LINKS (1<<0) /* Follow link objects */ +#define FOLLOW_PATH (1<<1) /* Follow the path in a table */ +#define HARD_LOOKUP (1<<2) /* Block until successful */ +#define ALL_RESULTS (1<<3) /* Retrieve all results */ +#define NO_CACHE (1<<4) /* Do not return 'cached' results */ +#define MASTER_ONLY (1<<5) /* Get value only from master server */ +#define EXPAND_NAME (1<<6) /* Expand partitially qualified names */ + +/* Semantic modification for table operations flags */ +#define RETURN_RESULT (1<<7) /* Return resulting object to client */ +#define ADD_OVERWRITE (1<<8) /* Allow overwrites on ADD */ +#define REM_MULTIPLE (1<<9) /* Allow wildcard deletes */ +#define MOD_SAMEOBJ (1<<10) /* Check modified object before write */ +#define ADD_RESERVED (1<<11) /* Spare ADD semantic */ +#define REM_RESERVED (1<<12) /* Spare REM semantic */ +#define MOD_EXCLUSIVE (1<<13) /* Modify no overwrite on modified keys */ + +/* Lookup and List function flags (continued) */ +#define SOFT_LOOKUP (1<<14) /* The "old default" return on failure */ + +/* Transport specific modifications to the operation */ +#define USE_DGRAM (1<<16) /* Use a datagram transport */ +#define NO_AUTHINFO (1<<17) /* Don't bother attaching auth info */ + +/* + * Declarations for "standard" NIS+ tags + * State variable tags have values 0 - 2047 + * Statistic tags have values 2048 - 65535 + * User Tags have values >2^16 + */ +#define TAG_DEBUG 1 /* set debug level */ +#define TAG_STATS 2 /* Enable/disable statistics */ +#define TAG_GCACHE 3 /* Flush the Group Cache */ +#define TAG_GCACHE_ALL TAG_GCACHE +#define TAG_DCACHE 4 /* Flush the directory cache */ +#define TAG_DCACHE_ONE TAG_DCACHE +#define TAG_OCACHE 5 /* Flush the Object Cache */ +#define TAG_SECURE 6 /* Set the security level */ +#define TAG_TCACHE_ONE 7 /* Flush the table cache */ +#define TAG_DCACHE_ALL 8 /* Flush entire directory cache */ +#define TAG_TCACHE_ALL 9 /* Flush entire table cache */ +#define TAG_GCACHE_ONE 10 /* Flush one group object */ +#define TAG_DCACHE_ONE_REFRESH 11 /* Flush and refresh one DO */ +#define TAG_READONLY 12 /* Set read only mode */ +#define TAG_READWRITE 14 /* Reset read-write mode */ + +#define TAG_OPSTATS 2048 /* NIS+ operations statistics */ +#define TAG_THREADS 2049 /* Child process/thread status */ +#define TAG_HEAP 2050 /* Heap usage statistics */ +#define TAG_UPDATES 2051 /* Updates to this service */ +#define TAG_VISIBLE 2052 /* First update that isn't replicated */ +#define TAG_S_DCACHE 2053 /* Directory cache statistics */ +#define TAG_S_OCACHE 2054 /* Object cache statistics */ +#define TAG_S_GCACHE 2055 /* Group cache statistics */ +#define TAG_S_STORAGE 2056 /* Group cache statistics */ +#define TAG_UPTIME 2057 /* Time that server has been up */ +#define TAG_DIRLIST 2058 /* Dir served by this server */ +#define TAG_NISCOMPAT 2059 /* Whether supports NIS compat mode */ +#define TAG_DNSFORWARDING 2060 /* Whether DNS forwarding supported */ +#define TAG_SECURITY_LEVEL 2061 /* Security level of the server */ +#define TAG_ROOTSERVER 2062 /* Whether root server */ + +/* + * Declarations for the Group object flags. Currently + * there are only 3. + */ +#define IMPMEM_GROUPS 1 /* Implicit Membership allowed */ +#define RECURS_GROUPS 2 /* Recursive Groups allowed */ +#define NEGMEM_GROUPS 4 /* Negative Groups allowed */ + +#ifdef __cplusplus +} +#endif + +#endif /* _RPCSVC_NIS_TAGS_H */ diff --git a/REORG.TODO/nis/rpcsvc/nislib.h b/REORG.TODO/nis/rpcsvc/nislib.h new file mode 100644 index 0000000000..52fbba4b8f --- /dev/null +++ b/REORG.TODO/nis/rpcsvc/nislib.h @@ -0,0 +1,286 @@ +/* Copyright (C) 1997-2017 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Thorsten Kukuk <kukuk@suse.de>, 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +#ifndef __RPCSVC_NISLIB_H__ +#define __RPCSVC_NISLIB_H__ + +#include <rpcsvc/nis.h> + +__BEGIN_DECLS + +typedef const char *const_nis_name; + +/* nis_names: These functions are used to locate and manipulate all NIS+ + * objects except the NIS+ entry objects. + * + * nis_lookup (name, flags) resolves a NIS+ name and returns a copy of + * that object from a NIS+ server. + * const nis_name name: name of the object to be resolved + * unsigned int flags: logically ORing zero or more flags (FOLLOW_LINKS, + * HARD_LOOKUP, [NO_CACHE], MASTER_ONLY, EXPAND_NAME) + * + * nis_add (name, obj) adds objects to the NIS+ namespace. + * const nis_name name: fully qualified NIS+ name. + * const nis_object *obj: object members zo_name and zo_domain will be + * constructed from name. + * + * nis_remove (name, obj) removes objects from the NIS+ namespace. + * const nis_name name: fully qualified NIS+ name. + * const nis_object *obj: if not NULL, it is assumed to point to a copy + * of the object being removed. In this case, if + * the object on the server does not have the same + * object identifier as the object being passed, + * the operation will fail with the NIS_NOTSAMEOBJ + * error. + * + * nis_modify (name, obj) can change specific attributes of an object + * that already exists in the namespace. + */ +extern nis_result *nis_lookup (const_nis_name name, unsigned int flags) + __THROW; +extern nis_result *nis_add (const_nis_name name, const nis_object *obj) + __THROW; +extern nis_result *nis_remove (const_nis_name name, + const nis_object *obj) __THROW; +extern nis_result *nis_modify (const_nis_name name, + const nis_object *obj) __THROW; + +/* nis_tables: These functions are used to search and modify NIS+ tables. + * + * nis_list (table_name, flags, callback(table_name, obj, userdata), userdata) + * search a table in the NIS+ namespace. + * const nis_name table_name: indexed name ([xx=yy],table.dir) + * unsigned int flags: logically ORing one or more flags (FOLLOW_LINKS, + * [FOLLOW_PATH], HARD_LOOKUP, [ALL_RESULTS], [NO_CACHE], + * MASTER_ONLY, EXPAND_NAME, RETURN_RESULT) + * callback(): callback is an optional pointer to a function that will + * process the ENTRY type objects that are returned from the + * search. If this pointer is NULL, then all entries that match + * the search criteria are returned in the nis_result structure, + * otherwise this function will be called once for each + * entry returned. + * void *userdata: passed to callback function along with the returned + * entry object. + * + * nis_add_entry (table_name, obj, flags) will add the NIS+ object to the + * NIS+ table_name. + * const nis_name table_name + * const nis_object *obj + * unsigned int flags: 0, ADD_OVERWRITE, RETURN_RESULT + * + * nis_modify_entry (name, obj, flags) modifies an object identified by name. + * const nis_name name: object identifier + * const nis_object *obj: should point to an entry with the EN_MODIFIED + * flag set in each column that contains new + * information. + * unsigned int flags: 0, MOD_SAMEOBJ, RETURN_RESULT + * + * nis_remove_entry (table_name, obj, flags) removes a set of entries + * identified by table_name from the table. + * const nis_name table_name: indexed NIS+ name + * const nis_object *obj: if obj is non-null, it is presumed to point to + * a cached copy of the entry. When the removal is + * attempted, and the object that would be removed + * is not the same as the cached object pointed to + * by object then the operation will fail with an + * NIS_NOTSAMEOBJ error + * unsigned int flags: 0, REM_MULTIPLE + * + * nis_first_entry (table_name) fetches entries from a table one at a time. + * const nis_name table_name + * + * nis_next_entry (table_name, cookie) retrieves the "next" entry from a + * table specified by table_name. + * const nis_name table_name: + * const netobj *cookie: The value of cookie from the nis_result structure + * form the previous call. + */ +extern nis_result *nis_list (const_nis_name __name, unsigned int __flags, + int (*__callback)(const_nis_name __table_name, + const nis_object *__obj, + const void *__userdata), + const void *__userdata) __THROW; +extern nis_result *nis_add_entry (const_nis_name __table_name, + const nis_object *__obj, + unsigned int __flags) __THROW; +extern nis_result *nis_modify_entry (const_nis_name __name, + const nis_object *__obj, + unsigned int __flags) __THROW; +extern nis_result *nis_remove_entry (const_nis_name __table_name, + const nis_object *__obj, + unsigned int __flags) __THROW; +extern nis_result *nis_first_entry (const_nis_name __table_name) __THROW; +extern nis_result *nis_next_entry (const_nis_name __table_name, + const netobj *__cookie) __THROW; +/* +** nis_server +*/ +extern nis_error nis_mkdir (const_nis_name __dirname, + const nis_server *__machine) __THROW; +extern nis_error nis_rmdir (const_nis_name __dirname, + const nis_server *__machine) __THROW; +extern nis_error nis_servstate (const nis_server *__machine, + const nis_tag *__tags, int __numtags, + nis_tag **__result) __THROW; +extern nis_error nis_stats (const nis_server *__machine, + const nis_tag *__tags, int __numtags, + nis_tag **__result) __THROW; +extern void nis_freetags (nis_tag *__tags, int __numtags) __THROW; +extern nis_server **nis_getservlist (const_nis_name __dirname) __THROW; +extern void nis_freeservlist (nis_server **__machines) __THROW; + +/* +** nis_subr +*/ +extern nis_name nis_leaf_of (const_nis_name __name) __THROW; +extern nis_name nis_leaf_of_r (const_nis_name __name, char *__buffer, + size_t __buflen) __THROW; +extern nis_name nis_name_of (const_nis_name __name) __THROW; +extern nis_name nis_name_of_r (const_nis_name __name, char *__buffer, + size_t __buflen) __THROW; +extern nis_name nis_domain_of (const_nis_name __name) __THROW; +extern nis_name nis_domain_of_r (const_nis_name __name, char *__buffer, + size_t __buflen) __THROW; +extern nis_name *nis_getnames (const_nis_name __name) __THROW; +extern void nis_freenames (nis_name *__namelist) __THROW; +extern name_pos nis_dir_cmp (const_nis_name __n1, const_nis_name __n2) __THROW; +extern nis_object *nis_clone_object (const nis_object *__src, + nis_object *__dest) __THROW; +extern void nis_destroy_object (nis_object *__obj) __THROW; +extern void nis_print_object (const nis_object *__obj) __THROW; + +/* +** nis_local_names +*/ +extern nis_name nis_local_group (void) __THROW; +extern nis_name nis_local_directory (void) __THROW; +extern nis_name nis_local_principal (void) __THROW; +extern nis_name nis_local_host (void) __THROW; + +/* +** nis_error +*/ +extern const char *nis_sperrno (const nis_error __status) __THROW; +extern void nis_perror (const nis_error __status, const char *__label) __THROW; +extern void nis_lerror (const nis_error __status, const char *__label) __THROW; +extern char *nis_sperror (const nis_error status, const char *__label) __THROW; +extern char *nis_sperror_r (const nis_error __status, const char *__label, + char *__buffer, size_t __buflen) __THROW; +/* +** nis_groups +*/ +extern bool_t nis_ismember (const_nis_name __principal, + const_nis_name __group) __THROW; +extern nis_error nis_addmember (const_nis_name __member, + const_nis_name __group) __THROW; +extern nis_error nis_removemember (const_nis_name __member, + const_nis_name __group) __THROW; +extern nis_error nis_creategroup (const_nis_name __group, + unsigned int __flags) __THROW; +extern nis_error nis_destroygroup (const_nis_name __group) __THROW; +extern void nis_print_group_entry (const_nis_name __group) __THROW; +extern nis_error nis_verifygroup (const_nis_name __group) __THROW; + +/* +** nis_ping +*/ +extern void nis_ping (const_nis_name __dirname, uint32_t __utime, + const nis_object *__dirobj) __THROW; +extern nis_result *nis_checkpoint (const_nis_name __dirname) __THROW; + +/* +** nis_print (XXX INTERNAL FUNCTIONS, SHOULD NOT BE USED !!) +*/ +extern void nis_print_result (const nis_result *__result) __THROW; +extern void nis_print_rights (unsigned int __rights) __THROW; +extern void nis_print_directory (const directory_obj *__dirobj) __THROW; +extern void nis_print_group (const group_obj *__grpobj) __THROW; +extern void nis_print_table (const table_obj *__tblobj) __THROW; +extern void nis_print_link (const link_obj *__lnkobj) __THROW; +extern void nis_print_entry (const entry_obj *__enobj) __THROW; + +/* +** nis_file (XXX INTERNAL FUNCTIONS, SHOULD NOT BE USED !!) +*/ +extern directory_obj *readColdStartFile (void) __THROW; +extern bool_t writeColdStartFile (const directory_obj *__dirobj) __THROW; +extern nis_object *nis_read_obj (const char *__obj) __THROW; +extern bool_t nis_write_obj (const char *__file, const nis_object *__obj) __THROW; + +/* +** nis_clone - (XXX INTERNAL FUNCTIONS, SHOULD NOT BE USED !!) +*/ +extern directory_obj *nis_clone_directory (const directory_obj *__src, + directory_obj *__dest) __THROW; +extern nis_result *nis_clone_result (const nis_result *__src, + nis_result *__dest) __THROW; + +/* nis_free - nis_freeresult */ +extern void nis_freeresult (nis_result *__result) __THROW; +/* (XXX THE FOLLOWING ARE INTERNAL FUNCTIONS, SHOULD NOT BE USED !!) */ +extern void nis_free_request (ib_request *__req) __THROW; +extern void nis_free_directory (directory_obj *__dirobj) __THROW; +extern void nis_free_object (nis_object *__obj) __THROW; + +/* (XXX INTERNAL FUNCTIONS, SHOULD NOT BE USED !!) */ +extern nis_name __nis_default_owner (char *) __THROW; +extern nis_name __nis_default_group (char *) __THROW; +extern uint32_t __nis_default_ttl (char *) __THROW; +extern unsigned int __nis_default_access (char *, unsigned int) __THROW; +extern fd_result *__nis_finddirectory (directory_obj *, const_nis_name) __THROW; +extern void __free_fdresult (fd_result *) __THROW; +extern uint32_t __nis_hash (const void *__keyarg, size_t __len) __THROW; + +/* NIS+ cache locking */ +extern int __nis_lock_cache (void) __THROW; +extern int __nis_unlock_cache (void) __THROW; + +/* (XXX INTERNAL FUNCTIONS, ONLY FOR rpc.nisd AND glibc !!) */ +#if defined (NIS_INTERNAL) || defined (_LIBC) + +struct dir_binding +{ + CLIENT *clnt; /* RPC CLIENT handle */ + nis_server *server_val; /* List of servers */ + unsigned int server_len; /* # of servers */ + unsigned int server_used; /* Which server we are bind in the moment ? */ + unsigned int current_ep; /* Which endpoint of the server are in use? */ + unsigned int trys; /* How many server have we tried ? */ + unsigned int class; /* From which class is server_val ? */ + bool_t master_only; /* Is only binded to the master */ + bool_t use_auth; /* Do we use AUTH ? */ + bool_t use_udp; /* Do we use UDP ? */ + struct sockaddr_in addr; /* Server's IP address */ + int socket; /* Server's local socket */ +}; +typedef struct dir_binding dir_binding; + +extern nis_error __nisbind_create (dir_binding *, const nis_server *, + unsigned int, unsigned int, unsigned int, + unsigned int) __THROW; +extern nis_error __nisbind_connect (dir_binding *) __THROW; +extern nis_error __nisbind_next (dir_binding *) __THROW; +extern void __nisbind_destroy (dir_binding *) __THROW; +extern nis_error __nisfind_server (const_nis_name, int, directory_obj **, + dir_binding *, unsigned int) __THROW; + +#endif + +__END_DECLS + +#endif /* __RPCSVC_NISLIB_H__ */ diff --git a/REORG.TODO/nis/rpcsvc/yp.h b/REORG.TODO/nis/rpcsvc/yp.h new file mode 100644 index 0000000000..968b74c42e --- /dev/null +++ b/REORG.TODO/nis/rpcsvc/yp.h @@ -0,0 +1,339 @@ +/* + * Copyright (c) 2010, Oracle America, Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials + * provided with the distribution. + * * Neither the name of the "Oracle America, Inc." nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef __RPCSVC_YP_H__ +#define __RPCSVC_YP_H__ + +#include <features.h> +#include <rpc/rpc.h> + +#define YPMAXRECORD 1024 +#define YPMAXDOMAIN 64 +#define YPMAXMAP 64 +#define YPMAXPEER 64 + +enum ypstat { + YP_TRUE = 1, + YP_NOMORE = 2, + YP_FALSE = 0, + YP_NOMAP = -1, + YP_NODOM = -2, + YP_NOKEY = -3, + YP_BADOP = -4, + YP_BADDB = -5, + YP_YPERR = -6, + YP_BADARGS = -7, + YP_VERS = -8, +}; +typedef enum ypstat ypstat; + +enum ypxfrstat { + YPXFR_SUCC = 1, + YPXFR_AGE = 2, + YPXFR_NOMAP = -1, + YPXFR_NODOM = -2, + YPXFR_RSRC = -3, + YPXFR_RPC = -4, + YPXFR_MADDR = -5, + YPXFR_YPERR = -6, + YPXFR_BADARGS = -7, + YPXFR_DBM = -8, + YPXFR_FILE = -9, + YPXFR_SKEW = -10, + YPXFR_CLEAR = -11, + YPXFR_FORCE = -12, + YPXFR_XFRERR = -13, + YPXFR_REFUSED = -14, +}; +typedef enum ypxfrstat ypxfrstat; + +typedef char *domainname; +typedef char *mapname; +typedef char *peername; + +typedef struct { + u_int keydat_len; + char *keydat_val; +} keydat; + +typedef struct { + u_int valdat_len; + char *valdat_val; +} valdat; + +struct ypmap_parms { + domainname domain; + mapname map; + u_int ordernum; + peername peer; +}; +typedef struct ypmap_parms ypmap_parms; + +struct ypreq_key { + domainname domain; + mapname map; + keydat key; +}; +typedef struct ypreq_key ypreq_key; + +struct ypreq_nokey { + domainname domain; + mapname map; +}; +typedef struct ypreq_nokey ypreq_nokey; + +struct ypreq_xfr { + ypmap_parms map_parms; + u_int transid; + u_int prog; + u_int port; +}; +typedef struct ypreq_xfr ypreq_xfr; + +struct ypresp_val { + ypstat stat; + valdat val; +}; +typedef struct ypresp_val ypresp_val; + +struct ypresp_key_val { + ypstat stat; +#ifdef STUPID_SUN_BUG + /* This is the form as distributed by Sun. But even the Sun NIS + servers expect the values in the other order. So their + implementation somehow must change the order internally. We + don't want to follow this bad example since the user should be + able to use rpcgen on this file. */ + keydat key; + valdat val; +#else + valdat val; + keydat key; +#endif +}; +typedef struct ypresp_key_val ypresp_key_val; + +struct ypresp_master { + ypstat stat; + peername peer; +}; +typedef struct ypresp_master ypresp_master; + +struct ypresp_order { + ypstat stat; + u_int ordernum; +}; +typedef struct ypresp_order ypresp_order; + +struct ypresp_all { + bool_t more; + union { + ypresp_key_val val; + } ypresp_all_u; +}; +typedef struct ypresp_all ypresp_all; + +struct ypresp_xfr { + u_int transid; + ypxfrstat xfrstat; +}; +typedef struct ypresp_xfr ypresp_xfr; + +struct ypmaplist { + mapname map; + struct ypmaplist *next; +}; +typedef struct ypmaplist ypmaplist; + +struct ypresp_maplist { + ypstat stat; + ypmaplist *maps; +}; +typedef struct ypresp_maplist ypresp_maplist; + +enum yppush_status { + YPPUSH_SUCC = 1, + YPPUSH_AGE = 2, + YPPUSH_NOMAP = -1, + YPPUSH_NODOM = -2, + YPPUSH_RSRC = -3, + YPPUSH_RPC = -4, + YPPUSH_MADDR = -5, + YPPUSH_YPERR = -6, + YPPUSH_BADARGS = -7, + YPPUSH_DBM = -8, + YPPUSH_FILE = -9, + YPPUSH_SKEW = -10, + YPPUSH_CLEAR = -11, + YPPUSH_FORCE = -12, + YPPUSH_XFRERR = -13, + YPPUSH_REFUSED = -14, +}; +typedef enum yppush_status yppush_status; + +struct yppushresp_xfr { + u_int transid; + yppush_status status; +}; +typedef struct yppushresp_xfr yppushresp_xfr; + +enum ypbind_resptype { + YPBIND_SUCC_VAL = 1, + YPBIND_FAIL_VAL = 2, +}; +typedef enum ypbind_resptype ypbind_resptype; + +struct ypbind_binding { + char ypbind_binding_addr[4]; + char ypbind_binding_port[2]; +}; +typedef struct ypbind_binding ypbind_binding; + +struct ypbind_resp { + ypbind_resptype ypbind_status; + union { + u_int ypbind_error; + ypbind_binding ypbind_bindinfo; + } ypbind_resp_u; +}; +typedef struct ypbind_resp ypbind_resp; + +#define YPBIND_ERR_ERR 1 +#define YPBIND_ERR_NOSERV 2 +#define YPBIND_ERR_RESC 3 + +struct ypbind_setdom { + domainname ypsetdom_domain; + ypbind_binding ypsetdom_binding; + u_int ypsetdom_vers; +}; +typedef struct ypbind_setdom ypbind_setdom; + +__BEGIN_DECLS + +#define YPPROG 100004 +#define YPVERS 2 + +#define YPPROC_NULL 0 +extern void *ypproc_null_2 (void *, CLIENT *); +extern void *ypproc_null_2_svc (void *, struct svc_req *); +#define YPPROC_DOMAIN 1 +extern bool_t *ypproc_domain_2 (domainname *, CLIENT *); +extern bool_t *ypproc_domain_2_svc (domainname *, struct svc_req *); +#define YPPROC_DOMAIN_NONACK 2 +extern bool_t *ypproc_domain_nonack_2 (domainname *, CLIENT *); +extern bool_t *ypproc_domain_nonack_2_svc (domainname *, struct svc_req *); +#define YPPROC_MATCH 3 +extern ypresp_val *ypproc_match_2 (ypreq_key *, CLIENT *); +extern ypresp_val *ypproc_match_2_svc (ypreq_key *, struct svc_req *); +#define YPPROC_FIRST 4 +extern ypresp_key_val *ypproc_first_2 (ypreq_key *, CLIENT *); +extern ypresp_key_val *ypproc_first_2_svc (ypreq_key *, struct svc_req *); +#define YPPROC_NEXT 5 +extern ypresp_key_val *ypproc_next_2 (ypreq_key *, CLIENT *); +extern ypresp_key_val *ypproc_next_2_svc (ypreq_key *, struct svc_req *); +#define YPPROC_XFR 6 +extern ypresp_xfr *ypproc_xfr_2 (ypreq_xfr *, CLIENT *); +extern ypresp_xfr *ypproc_xfr_2_svc (ypreq_xfr *, struct svc_req *); +#define YPPROC_CLEAR 7 +extern void *ypproc_clear_2 (void *, CLIENT *); +extern void *ypproc_clear_2_svc (void *, struct svc_req *); +#define YPPROC_ALL 8 +extern ypresp_all *ypproc_all_2 (ypreq_nokey *, CLIENT *); +extern ypresp_all *ypproc_all_2_svc (ypreq_nokey *, struct svc_req *); +#define YPPROC_MASTER 9 +extern ypresp_master *ypproc_master_2 (ypreq_nokey *, CLIENT *); +extern ypresp_master *ypproc_master_2_svc (ypreq_nokey *, struct svc_req *); +#define YPPROC_ORDER 10 +extern ypresp_order *ypproc_order_2 (ypreq_nokey *, CLIENT *); +extern ypresp_order *ypproc_order_2_svc (ypreq_nokey *, struct svc_req *); +#define YPPROC_MAPLIST 11 +extern ypresp_maplist *ypproc_maplist_2 (domainname *, CLIENT *); +extern ypresp_maplist *ypproc_maplist_2_svc (domainname *, struct svc_req *); +extern int ypprog_2_freeresult (SVCXPRT *, xdrproc_t, caddr_t); + + +#define YPPUSH_XFRRESPPROG (0x40000000) +#define YPPUSH_XFRRESPVERS 1 + +#define YPPUSHPROC_NULL 0 +extern void *yppushproc_null_1 (void *, CLIENT *); +extern void *yppushproc_null_1_svc (void *, struct svc_req *); +#define YPPUSHPROC_XFRRESP 1 +extern void *yppushproc_xfrresp_1 (yppushresp_xfr *, CLIENT *); +extern void *yppushproc_xfrresp_1_svc (yppushresp_xfr *, struct svc_req *); +extern int yppush_xfrrespprog_1_freeresult (SVCXPRT *, xdrproc_t, caddr_t); + + +#define YPBINDPROG 100007 +#define YPBINDVERS 2 + +#define YPBINDPROC_NULL 0 +extern void *ypbindproc_null_2 (void *, CLIENT *); +extern void *ypbindproc_null_2_svc (void *, struct svc_req *); +#define YPBINDPROC_DOMAIN 1 +extern ypbind_resp *ypbindproc_domain_2 (domainname *, CLIENT *); +extern ypbind_resp *ypbindproc_domain_2_svc (domainname *, struct svc_req *); +#define YPBINDPROC_SETDOM 2 +extern void *ypbindproc_setdom_2 (ypbind_setdom *, CLIENT *); +extern void *ypbindproc_setdom_2_svc (ypbind_setdom *, struct svc_req *); +extern int ypbindprog_2_freeresult (SVCXPRT *, xdrproc_t, caddr_t); + + +extern bool_t xdr_ypstat (XDR *, ypstat*); +extern bool_t xdr_ypxfrstat (XDR *, ypxfrstat*); +extern bool_t xdr_domainname (XDR *, domainname*); +extern bool_t xdr_mapname (XDR *, mapname*); +extern bool_t xdr_peername (XDR *, peername*); +extern bool_t xdr_keydat (XDR *, keydat*); +extern bool_t xdr_valdat (XDR *, valdat*); +extern bool_t xdr_ypmap_parms (XDR *, ypmap_parms*); +extern bool_t xdr_ypreq_key (XDR *, ypreq_key*); +extern bool_t xdr_ypreq_nokey (XDR *, ypreq_nokey*); +extern bool_t xdr_ypreq_xfr (XDR *, ypreq_xfr*); +extern bool_t xdr_ypresp_val (XDR *, ypresp_val*); +extern bool_t xdr_ypresp_key_val (XDR *, ypresp_key_val*); +extern bool_t xdr_ypresp_master (XDR *, ypresp_master*); +extern bool_t xdr_ypresp_order (XDR *, ypresp_order*); +extern bool_t xdr_ypresp_all (XDR *, ypresp_all*); +extern bool_t xdr_ypresp_xfr (XDR *, ypresp_xfr*); +extern bool_t xdr_ypmaplist (XDR *, ypmaplist*); +extern bool_t xdr_ypresp_maplist (XDR *, ypresp_maplist*); +extern bool_t xdr_yppush_status (XDR *, yppush_status*); +extern bool_t xdr_yppushresp_xfr (XDR *, yppushresp_xfr*); +extern bool_t xdr_ypbind_resptype (XDR *, ypbind_resptype*); +extern bool_t xdr_ypbind_binding (XDR *, ypbind_binding*); +extern bool_t xdr_ypbind_resp (XDR *, ypbind_resp*); +extern bool_t xdr_ypbind_setdom (XDR *, ypbind_setdom*); + +__END_DECLS + +#endif /* !__RPCSVC_YP_H__ */ diff --git a/REORG.TODO/nis/rpcsvc/yp.x b/REORG.TODO/nis/rpcsvc/yp.x new file mode 100644 index 0000000000..269ae6f606 --- /dev/null +++ b/REORG.TODO/nis/rpcsvc/yp.x @@ -0,0 +1,311 @@ +/* @(#)yp.x 2.1 88/08/01 4.0 RPCSRC */ + +/* + * Copyright (c) 2010, Oracle America, Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials + * provided with the distribution. + * * Neither the name of the "Oracle America, Inc." nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * Protocol description file for the Yellow Pages Service + */ + +const YPMAXRECORD = 1024; +const YPMAXDOMAIN = 64; +const YPMAXMAP = 64; +const YPMAXPEER = 64; + + +enum ypstat { + YP_TRUE = 1, + YP_NOMORE = 2, + YP_FALSE = 0, + YP_NOMAP = -1, + YP_NODOM = -2, + YP_NOKEY = -3, + YP_BADOP = -4, + YP_BADDB = -5, + YP_YPERR = -6, + YP_BADARGS = -7, + YP_VERS = -8 +}; + + +enum ypxfrstat { + YPXFR_SUCC = 1, + YPXFR_AGE = 2, + YPXFR_NOMAP = -1, + YPXFR_NODOM = -2, + YPXFR_RSRC = -3, + YPXFR_RPC = -4, + YPXFR_MADDR = -5, + YPXFR_YPERR = -6, + YPXFR_BADARGS = -7, + YPXFR_DBM = -8, + YPXFR_FILE = -9, + YPXFR_SKEW = -10, + YPXFR_CLEAR = -11, + YPXFR_FORCE = -12, + YPXFR_XFRERR = -13, + YPXFR_REFUSED = -14 +}; + + +typedef string domainname<YPMAXDOMAIN>; +typedef string mapname<YPMAXMAP>; +typedef string peername<YPMAXPEER>; +typedef opaque keydat<YPMAXRECORD>; +typedef opaque valdat<YPMAXRECORD>; + + +struct ypmap_parms { + domainname domain; + mapname map; + unsigned int ordernum; + peername peer; +}; + +struct ypreq_key { + domainname domain; + mapname map; + keydat key; +}; + +struct ypreq_nokey { + domainname domain; + mapname map; +}; + +struct ypreq_xfr { + ypmap_parms map_parms; + unsigned int transid; + unsigned int prog; + unsigned int port; +}; + + +struct ypresp_val { + ypstat stat; + valdat val; +}; + +struct ypresp_key_val { + ypstat stat; +#ifdef STUPID_SUN_BUG + /* This is the form as distributed by Sun. But even the Sun NIS + servers expect the values in the other order. So their + implementation somehow must change the order internally. We + don't want to follow this bad example since the user should be + able to use rpcgen on this file. */ + keydat key; + valdat val; +#else + valdat val; + keydat key; +#endif +}; + + +struct ypresp_master { + ypstat stat; + peername peer; +}; + +struct ypresp_order { + ypstat stat; + unsigned int ordernum; +}; + +union ypresp_all switch (bool more) { +case TRUE: + ypresp_key_val val; +case FALSE: + void; +}; + +struct ypresp_xfr { + unsigned int transid; + ypxfrstat xfrstat; +}; + +struct ypmaplist { + mapname map; + ypmaplist *next; +}; + +struct ypresp_maplist { + ypstat stat; + ypmaplist *maps; +}; + +enum yppush_status { + YPPUSH_SUCC = 1, /* Success */ + YPPUSH_AGE = 2, /* Master's version not newer */ + YPPUSH_NOMAP = -1, /* Can't find server for map */ + YPPUSH_NODOM = -2, /* Domain not supported */ + YPPUSH_RSRC = -3, /* Local resource alloc failure */ + YPPUSH_RPC = -4, /* RPC failure talking to server */ + YPPUSH_MADDR = -5, /* Can't get master address */ + YPPUSH_YPERR = -6, /* YP server/map db error */ + YPPUSH_BADARGS = -7, /* Request arguments bad */ + YPPUSH_DBM = -8, /* Local dbm operation failed */ + YPPUSH_FILE = -9, /* Local file I/O operation failed */ + YPPUSH_SKEW = -10, /* Map version skew during transfer */ + YPPUSH_CLEAR = -11, /* Can't send "Clear" req to local ypserv */ + YPPUSH_FORCE = -12, /* No local order number in map use -f flag. */ + YPPUSH_XFRERR = -13, /* ypxfr error */ + YPPUSH_REFUSED = -14 /* Transfer request refused by ypserv */ +}; + +struct yppushresp_xfr { + unsigned transid; + yppush_status status; +}; + +/* + * Response structure and overall result status codes. Success and failure + * represent two separate response message types. + */ + +enum ypbind_resptype { + YPBIND_SUCC_VAL = 1, + YPBIND_FAIL_VAL = 2 +}; + +struct ypbind_binding { + opaque ypbind_binding_addr[4]; /* In network order */ + opaque ypbind_binding_port[2]; /* In network order */ +}; + +union ypbind_resp switch (ypbind_resptype ypbind_status) { +case YPBIND_FAIL_VAL: + unsigned ypbind_error; +case YPBIND_SUCC_VAL: + ypbind_binding ypbind_bindinfo; +}; + +/* Detailed failure reason codes for response field ypbind_error*/ + +const YPBIND_ERR_ERR = 1; /* Internal error */ +const YPBIND_ERR_NOSERV = 2; /* No bound server for passed domain */ +const YPBIND_ERR_RESC = 3; /* System resource allocation failure */ + + +/* + * Request data structure for ypbind "Set domain" procedure. + */ +struct ypbind_setdom { + domainname ypsetdom_domain; + ypbind_binding ypsetdom_binding; + unsigned ypsetdom_vers; +}; + + +/* + * YP access protocol + */ +program YPPROG { + version YPVERS { + void + YPPROC_NULL(void) = 0; + + bool + YPPROC_DOMAIN(domainname) = 1; + + bool + YPPROC_DOMAIN_NONACK(domainname) = 2; + + ypresp_val + YPPROC_MATCH(ypreq_key) = 3; + + ypresp_key_val + YPPROC_FIRST(ypreq_key) = 4; + + ypresp_key_val + YPPROC_NEXT(ypreq_key) = 5; + + ypresp_xfr + YPPROC_XFR(ypreq_xfr) = 6; + + void + YPPROC_CLEAR(void) = 7; + + ypresp_all + YPPROC_ALL(ypreq_nokey) = 8; + + ypresp_master + YPPROC_MASTER(ypreq_nokey) = 9; + + ypresp_order + YPPROC_ORDER(ypreq_nokey) = 10; + + ypresp_maplist + YPPROC_MAPLIST(domainname) = 11; + } = 2; +} = 100004; + + +/* + * YPPUSHPROC_XFRRESP is the callback routine for result of YPPROC_XFR + */ +program YPPUSH_XFRRESPPROG { + version YPPUSH_XFRRESPVERS { + void + YPPUSHPROC_NULL(void) = 0; + +#ifdef STUPID_SUN_BUG + /* This is the form as distributed by Sun. But even + the Sun NIS servers expect the values in the other + order. So their implementation somehow must change + the order internally. We don't want to follow this + bad example since the user should be able to use + rpcgen on this file. */ + yppushresp_xfr + YPPUSHPROC_XFRRESP(void) = 1; +#else + void + YPPUSHPROC_XFRRESP(yppushresp_xfr) = 1; +#endif + } = 1; +} = 0x40000000; /* transient: could be anything up to 0x5fffffff */ + +/* + * YP binding protocol + */ +program YPBINDPROG { + version YPBINDVERS { + void + YPBINDPROC_NULL(void) = 0; + + ypbind_resp + YPBINDPROC_DOMAIN(domainname) = 1; + + void + YPBINDPROC_SETDOM(ypbind_setdom) = 2; + } = 2; +} = 100007; diff --git a/REORG.TODO/nis/rpcsvc/yp_prot.h b/REORG.TODO/nis/rpcsvc/yp_prot.h new file mode 100644 index 0000000000..ae0db3688e --- /dev/null +++ b/REORG.TODO/nis/rpcsvc/yp_prot.h @@ -0,0 +1,366 @@ +/* + * This file contains symbols and structures defining the rpc protocol + * between the NIS clients and the NIS servers. The servers + * are the NIS database servers, and the NIS binders. + */ + +#ifndef _RPCSVC_YP_PROT_H +#define _RPCSVC_YP_PROT_H + +#include <features.h> + +#include <rpc/rpc.h> +#include <rpcsvc/ypclnt.h> + +__BEGIN_DECLS + +/* + * The following procedures are supported by the protocol: + * + * YPPROC_NULL() returns () takes nothing, returns nothing. This indicates + * that the NIS server is alive. + * + * YPPROC_DOMAIN (char *) returns (bool_t) TRUE. Indicates that the + * responding NIS server does serve the named domain; FALSE indicates no + * support. + * + * YPPROC_DOMAIN_NONACK (char *) returns (TRUE) if the NIS server does serve + * the named domain, otherwise does not return. Used in the broadcast case. + * + * YPPROC_MATCH (struct ypreq_key) returns (struct ypresp_val). Returns the + * right-hand value for a passed left-hand key, within a named map and + * domain. + * + * YPPROC_FIRST (struct ypreq_nokey) returns (struct ypresp_key_val). + * Returns the first key-value pair from a named domain and map. + * + * YPPROC_NEXT (struct ypreq_key) returns (struct ypresp_key_val). Returns + * the key-value pair following a passed key-value pair within a named + * domain and map. + * + * YPPROC_XFR (struct ypreq_xfr) returns nothing. Indicates to a server that + * a map should be updated. + * + * YPPROC_CLEAR takes nothing, returns nothing. Instructs a NIS server to + * close the current map, so that old versions of the disk file don't get + * held open. + * + * YPPROC_ALL (struct ypreq_nokey), returns + * union switch (bool_t more) { + * TRUE: (struct ypresp_key_val); + * FALSE: (struct) {}; + * } + * + * YPPROC_MASTER (struct ypreq_nokey), returns (ypresp_master) + * + * YPPROC_ORDER (struct ypreq_nokey), returns (ypresp_order) + * + * YPPROC_MAPLIST (char *), returns (struct ypmaplist *) + */ + +/* Program and version symbols, magic numbers */ + +#define YPPROG 100004 +#define YPVERS 2 +#define YPVERS_ORIG 1 +#define YPMAXRECORD 1024 +#define YPMAXDOMAIN 64 /* XXX orig. yp_prot.h defines 256 */ +#define YPMAXMAP 64 +#define YPMAXPEER 64 /* XXX orig. yp_prot.h defines 256 */ + +/* byte size of a large NIS packet */ +#define YPMSGSZ 1600 + +typedef struct { + u_int keydat_len; + char *keydat_val; +} keydat_t; + +typedef struct { + u_int valdat_len; + char *valdat_val; +} valdat_t; + +struct ypmap_parms { + char *domain; /* Null string means not available */ + char *map; /* Null string means not available */ + unsigned int ordernum; /* 0 means not available */ + char *owner; /* Null string means not available */ +}; + +/* + * Request parameter structures + */ + +struct ypreq_key { + const char *domain; + const char *map; + keydat_t keydat; +}; + +struct ypreq_nokey { + char *domain; + char *map; +}; + +struct ypreq_xfr { + struct ypmap_parms map_parms; + u_int transid; + u_int proto; + u_int port; +}; + +#define ypxfr_domain map_parms.domain +#define ypxfr_map map_parms.map +#define ypxfr_ordernum map_parms.ordernum +#define ypxfr_owner map_parms.owner + +/* Return status values */ + +enum ypstat { + YP_TRUE = 1, /* General purpose success code */ +#define YP_TRUE YP_TRUE + YP_NOMORE = 2, /* No more entries in map */ +#define YP_NOMORE YP_NOMORE + YP_FALSE = 0, /* General purpose failure code */ +#define YP_FALSE YP_FALSE + YP_NOMAP = -1, /* No such map in domain */ +#define YP_NOMAP YP_NOMAP + YP_NODOM = -2, /* Domain not supported */ +#define YP_NODOM YP_NODOM + YP_NOKEY = -3, /* No such key in map */ +#define YP_NOKEY YP_NOKEY + YP_BADOP = -4, /* Invalid operation */ +#define YP_BADOP YP_BADOP + YP_BADDB = -5, /* Server data base is bad */ +#define YP_BADDB YP_BADDB + YP_YPERR = -6, /* NIS server error */ +#define YP_YPERR YP_YPERR + YP_BADARGS = -7, /* Request arguments bad */ +#define YP_BADARGS YP_BADARGS + YP_VERS = -8, /* NIS server version mismatch - server can't supply + requested service. */ +#define YP_VERS YP_VERS +}; + +/* + * Response parameter structures + */ + +typedef enum ypstat ypstat; + +struct ypresp_val { + ypstat status; + valdat_t valdat; +}; + +struct ypresp_key_val { + ypstat status; +#ifdef STUPID_SUN_BUG + /* This is the form as distributed by Sun. But even the Sun NIS + servers expect the values in the other order. So their + implementation somehow must change the order internally. We + don't want to follow this bad example since the user should be + able to use rpcgen on this file. */ + keydat_t keydat; + valdat_t valdat; +#else + valdat_t valdat; + keydat_t keydat; +#endif +}; + +struct ypresp_master { + ypstat status; + char *master; +}; + +struct ypresp_order { + ypstat status; + u_int ordernum; +}; + +struct ypmaplist { + char *map; +#define ypml_name map + struct ypmaplist *next; +#define ypml_next next +}; + +struct ypresp_maplist { + ypstat status; + struct ypmaplist *list; +}; + +/* + * Procedure symbols. YPPROC_NULL, YPPROC_DOMAIN, and YPPROC_DOMAIN_NONACK + * must keep the same values (0, 1, and 2) that they had in the first version + * of the protocol. + */ + +#define YPPROC_NULL 0 +#define YPPROC_DOMAIN 1 +#define YPPROC_DOMAIN_NONACK 2 +#define YPPROC_MATCH 3 +#define YPPROC_FIRST 4 +#define YPPROC_NEXT 5 +#define YPPROC_XFR 6 +#define YPPROC_CLEAR 7 +#define YPPROC_ALL 8 +#define YPPROC_MASTER 9 +#define YPPROC_ORDER 10 +#define YPPROC_MAPLIST 11 +#define YPPROC_NEWXFR 12 + +/* + * Protocol between clients and NIS binder servers + */ + +/* + * The following procedures are supported by the protocol: + * + * YPBINDPROC_NULL() returns () + * takes nothing, returns nothing + * + * YPBINDPROC_DOMAIN takes (char *) returns (struct ypbind_resp) + * + * YPBINDPROC_SETDOM takes (struct ypbind_setdom) returns nothing + */ + +/* Program and version symbols, magic numbers */ + +#define YPBINDPROG 100007 +#define YPBINDVERS 2 +#define YPBINDVERS_ORIG 1 + +/* Procedure symbols */ + +#define YPBINDPROC_NULL 0 +#define YPBINDPROC_DOMAIN 1 +#define YPBINDPROC_SETDOM 2 +/* + * Response structure and overall result status codes. Success and failure + * represent two separate response message types. + */ + +enum ypbind_resptype {YPBIND_SUCC_VAL = 1, YPBIND_FAIL_VAL = 2}; + +struct ypbind_binding { + struct in_addr ypbind_binding_addr; /* In network order */ + unsigned short int ypbind_binding_port; /* In network order */ +}; + +struct ypbind_resp { + enum ypbind_resptype ypbind_status; + union { + u_int ypbind_error; + struct ypbind_binding ypbind_bindinfo; + } ypbind_respbody; +}; + + +/* Detailed failure reason codes for response field ypbind_error*/ + +#define YPBIND_ERR_ERR 1 /* Internal error */ +#define YPBIND_ERR_NOSERV 2 /* No bound server for passed domain */ +#define YPBIND_ERR_RESC 3 /* System resource allocation failure */ + +/* + * Request data structure for ypbind "Set domain" procedure. + */ +struct ypbind_setdom { + char *ypsetdom_domain; + struct ypbind_binding ypsetdom_binding; + u_int ypsetdom_vers; +}; +#define ypsetdom_addr ypsetdom_binding.ypbind_binding_addr +#define ypsetdom_port ypsetdom_binding.ypbind_binding_port + +/* + * Protocol between clients (ypxfr, only) and yppush + * yppush speaks a protocol in the transient range, which + * is supplied to ypxfr as a command-line parameter when it + * is activated by ypserv. + */ +#define YPPUSHVERS 1 +#define YPPUSHVERS_ORIG 1 + +/* Procedure symbols */ + +#define YPPUSHPROC_NULL 0 +#define YPPUSHPROC_XFRRESP 1 + +/* Status values for yppushresp_xfr.status */ + +enum yppush_status { + YPPUSH_SUCC = 1, /* Success */ +#define YPPUSH_SUCC YPPUSH_SUCC + YPPUSH_AGE = 2, /* Master's version not newer */ +#define YPPUSH_AGE YPPUSH_AGE + YPPUSH_NOMAP = -1, /* Can't find server for map */ +#define YPPUSH_NOMAP YPPUSH_NOMAP + YPPUSH_NODOM = -2, /* Domain not supported */ +#define YPPUSH_NODOM YPPUSH_NODOM + YPPUSH_RSRC = -3, /* Local resouce alloc failure */ +#define YPPUSH_RSRC YPPUSH_RSRC + YPPUSH_RPC = -4, /* RPC failure talking to server */ +#define YPPUSH_RPC YPPUSH_RPC + YPPUSH_MADDR = -5, /* Can't get master address */ +#define YPPUSH_MADDR YPPUSH_MADDR + YPPUSH_YPERR = -6, /* NIS server/map db error */ +#define YPPUSH_YPERR YPPUSH_YPERR + YPPUSH_BADARGS = -7, /* Request arguments bad */ +#define YPPUSH_BADARGS YPPUSH_BADARGS + YPPUSH_DBM = -8, /* Local dbm operation failed */ +#define YPPUSH_DBM YPPUSH_DBM + YPPUSH_FILE = -9, /* Local file I/O operation failed */ +#define YPPUSH_FILE YPPUSH_FILE + YPPUSH_SKEW = -10, /* Map version skew during transfer */ +#define YPPUSH_SKEW YPPUSH_SKEW + YPPUSH_CLEAR = -11, /* Can't send "Clear" req to local ypserv */ +#define YPPUSH_CLEAR YPPUSH_CLEAR + YPPUSH_FORCE = -12, /* No local order number in map - use -f flag*/ +#define YPPUSH_FORCE YPPUSH_FORCE + YPPUSH_XFRERR = -13, /* ypxfr error */ +#define YPPUSH_XFRERR YPPUSH_XFRERR + YPPUSH_REFUSED = -14, /* Transfer request refused by ypserv */ +#define YPPUSH_REFUSED YPPUSH_REFUSED + YPPUSH_NOALIAS = -15 /* Alias not found for map or domain */ +#define YPPUSH_NOALIAS YPPUSH_NOALIAS +}; +typedef enum yppush_status yppush_status; + +struct yppushresp_xfr { + u_int transid; + yppush_status status; +}; + +struct ypresp_all { + bool_t more; + union { + struct ypresp_key_val val; + } ypresp_all_u; +}; + +extern bool_t xdr_ypreq_key (XDR *__xdrs, struct ypreq_key * __objp); +extern bool_t xdr_ypreq_nokey (XDR *__xdrs, struct ypreq_nokey * __objp); +extern bool_t xdr_ypreq_xfr (XDR *__xdrs, struct ypreq_xfr * __objp); +extern bool_t xdr_ypresp_val (XDR *__xdrs, struct ypresp_val * __objp); +extern bool_t xdr_ypresp_key_val (XDR *__xdrs, struct ypresp_key_val * __objp); +extern bool_t xdr_ypbind_resp (XDR *__xdrs, struct ypbind_resp * __objp); +extern bool_t xdr_ypbind_setdom (XDR *__xdrs, struct ypbind_setdom * __objp); +extern bool_t xdr_ypmap_parms (XDR *__xdrs, struct ypmap_parms * __objp); +extern bool_t xdr_yppushresp_xfr (XDR *__xdrs, struct yppushresp_xfr * __objp); +extern bool_t xdr_ypresp_order (XDR *__xdrs, struct ypresp_order * __objp); +extern bool_t xdr_ypresp_master (XDR *__xdrs, struct ypresp_master * __objp); +extern bool_t xdr_ypall (XDR *__xdrs, struct ypall_callback * __objp); +extern bool_t xdr_ypresp_maplist (XDR *__xdrs, struct ypresp_maplist * __objp); +extern bool_t xdr_ypbind_binding (XDR *__xdrs, struct ypbind_binding * __objp); +extern bool_t xdr_ypbind_resptype (XDR *__xdrs, enum ypbind_resptype * __objp); +extern bool_t xdr_ypstat (XDR *__xdrs, enum ypbind_resptype * __objp); +extern bool_t xdr_ypresp_all (XDR *__xdrs, struct ypresp_all * __objp); +extern bool_t xdr_domainname (XDR *__xdrs, char ** __objp); + +__END_DECLS + +#endif /* _RPCSVC_YP_PROT_H */ diff --git a/REORG.TODO/nis/rpcsvc/ypclnt.h b/REORG.TODO/nis/rpcsvc/ypclnt.h new file mode 100644 index 0000000000..8f59ad4eae --- /dev/null +++ b/REORG.TODO/nis/rpcsvc/ypclnt.h @@ -0,0 +1,88 @@ +/* Copyright (C) 1996-2017 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Thorsten Kukuk <kukuk@suse.de>, 1996. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + + +#ifndef __RPCSVC_YPCLNT_H__ +#define __RPCSVC_YPCLNT_H__ + +#include <features.h> + +/* Some defines */ +#define YPERR_SUCCESS 0 /* There is no error */ +#define YPERR_BADARGS 1 /* Args to function are bad */ +#define YPERR_RPC 2 /* RPC failure */ +#define YPERR_DOMAIN 3 /* Can't bind to a server with this domain */ +#define YPERR_MAP 4 /* No such map in server's domain */ +#define YPERR_KEY 5 /* No such key in map */ +#define YPERR_YPERR 6 /* Internal yp server or client error */ +#define YPERR_RESRC 7 /* Local resource allocation failure */ +#define YPERR_NOMORE 8 /* No more records in map database */ +#define YPERR_PMAP 9 /* Can't communicate with portmapper */ +#define YPERR_YPBIND 10 /* Can't communicate with ypbind */ +#define YPERR_YPSERV 11 /* Can't communicate with ypserv */ +#define YPERR_NODOM 12 /* Local domain name not set */ +#define YPERR_BADDB 13 /* yp data base is bad */ +#define YPERR_VERS 14 /* YP version mismatch */ +#define YPERR_ACCESS 15 /* Access violation */ +#define YPERR_BUSY 16 /* Database is busy */ + +/* Types of update operations */ +#define YPOP_CHANGE 1 /* Change, do not add */ +#define YPOP_INSERT 2 /* Add, do not change */ +#define YPOP_DELETE 3 /* Delete this entry */ +#define YPOP_STORE 4 /* Add, or change */ + +__BEGIN_DECLS + +/* struct ypall_callback * is the arg which must be passed to yp_all. */ +struct ypall_callback + { + int (*foreach) (int __status, char *__key, int __keylen, + char *__val, int __vallen, char *__data); + char *data; + }; + +/* External NIS client function references. */ +extern int yp_bind (const char *) __THROW; +extern void yp_unbind (const char *) __THROW; +extern int yp_get_default_domain (char **) __THROW; +extern int yp_match (const char *, const char *, const char *, + const int, char **, int *) __THROW; +extern int yp_first (const char *, const char *, char **, + int *, char **, int *) __THROW; +extern int yp_next (const char *, const char *, const char *, + const int, char **, int *, char **, int *) __THROW; +extern int yp_master (const char *, const char *, char **) __THROW; +extern int yp_order (const char *, const char *, unsigned int *) __THROW; +extern int yp_all (const char *, const char *, + const struct ypall_callback *) __THROW; +extern const char *yperr_string (const int) __THROW; +extern const char *ypbinderr_string (const int) __THROW; +extern int ypprot_err (const int) __THROW; +extern int yp_update (char *, char *, unsigned int, char *, + int, char *, int) __THROW; +#if 0 +extern int yp_maplist (const char *, struct ypmaplist **) __THROW; +#endif + +/* This functions exists only under BSD and Linux systems. */ +extern int __yp_check (char **) __THROW; + +__END_DECLS + +#endif /* __RPCSVC_YPCLNT_H__ */ diff --git a/REORG.TODO/nis/rpcsvc/ypupd.h b/REORG.TODO/nis/rpcsvc/ypupd.h new file mode 100644 index 0000000000..d07fd4d744 --- /dev/null +++ b/REORG.TODO/nis/rpcsvc/ypupd.h @@ -0,0 +1,88 @@ +/* + * Copyright (c) 2010, Oracle America, Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials + * provided with the distribution. + * * Neither the name of the "Oracle America, Inc." nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +/* from @(#)ypupdate_prot.x 1.3 91/03/11 TIRPC 1.0 */ + +#ifndef __RPCSVC_YPUPD_H__ +#define __RPCSVC_YPUPD_H__ + +#include <features.h> + +#include <rpc/rpc.h> + +#define MAXMAPNAMELEN 255 +#define MAXYPDATALEN 1023 +#define MAXERRMSGLEN 255 + +__BEGIN_DECLS + +typedef struct { + u_int yp_buf_len; + char *yp_buf_val; +} yp_buf; + +extern bool_t xdr_yp_buf (XDR *, yp_buf*); + +struct ypupdate_args { + char *mapname; + yp_buf key; + yp_buf datum; +}; +typedef struct ypupdate_args ypupdate_args; + +extern bool_t xdr_ypupdate_args (XDR *, ypupdate_args*); + +struct ypdelete_args { + char *mapname; + yp_buf key; +}; +typedef struct ypdelete_args ypdelete_args; + +extern bool_t xdr_ypdelete_args (XDR *, ypdelete_args*); + +#define YPU_PROG 100028 +#define YPU_VERS 1 + +#define YPU_CHANGE 1 +extern u_int * ypu_change_1 (ypupdate_args *, CLIENT *); +extern u_int * ypu_change_1_svc (ypupdate_args *, struct svc_req *); +#define YPU_INSERT 2 +extern u_int * ypu_insert_1 (ypupdate_args *, CLIENT *); +extern u_int * ypu_insert_1_svc (ypupdate_args *, struct svc_req *); +#define YPU_DELETE 3 +extern u_int * ypu_delete_1 (ypdelete_args *, CLIENT *); +extern u_int * ypu_delete_1_svc (ypdelete_args *, struct svc_req *); +#define YPU_STORE 4 +extern u_int * ypu_store_1 (ypupdate_args *, CLIENT *); +extern u_int * ypu_store_1_svc (ypupdate_args *, struct svc_req *); + +__END_DECLS + +#endif /* !__RPCSVC_YPUPD_H__ */ |