This commit was generated by cvs2svn to compensate for changes in r26206,

which included commits to RCS files with non-trunk default branches.
This commit is contained in:
wpaul 1997-05-28 04:35:55 +00:00
commit 34b9627195
11 changed files with 2307 additions and 0 deletions

90
include/rpcsvc/crypt.x Normal file
View File

@ -0,0 +1,90 @@
/*
* Copyright (c) 1996
* Bill Paul <wpaul@ctr.columbia.edu>. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. 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.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by Bill Paul.
* 4. Neither the name of the author nor the names of any co-contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY Bill Paul 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 Bill Paul 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.
*
* $Id$
*/
#ifndef RPC_HDR
%#ifndef lint
%static const char rcsid[] = "$Id$";
%#endif
#endif
/*
* This protocol definition exists because of the U.S. government and
* its stupid export laws. We can't export DES code from the United
* States to other countries (even though the code already exists
* outside the U.S. -- go figure that one out) but we need to make
* Secure RPC work. The normal way around this is to break the DES
* code out into a shared library; we can then provide a dummy lib
* in the base OS and provide the real lib in the secure dist, which
* the user can install later. But we need Secure RPC for NIS+, and
* there are several system programs that use NIS+ which are statically
* linked. We would have to provide replacements for these programs
* in the secure dist, but there are a lot, and this is a pain. The
* shared lib trick won't work for these programs, and we can't change
* them once they're compiled.
*
* One solution for this problem is to do the DES encryption as a system
* call; no programs need to be changed and we can even supply the DES
* support as an LKM. But this bloats the kernel. Maybe if we have
* Secure NFS one day this will be worth it, but for now we should keep
* this mess in user space.
*
* So we have this second solution: we provide a server that does the
* DES encryption for us. In this case, the server is keyserv (we need
* it to make Secure RPC work anyway) and we use this protocol to ship
* the data back and forth between keyserv and the application.
*/
enum des_dir { ENCRYPT_DES, DECRYPT_DES };
enum des_mode { CBC_DES, ECB_DES };
struct desargs {
u_char des_key[8]; /* key (with low bit parity) */
des_dir des_dir; /* direction */
des_mode des_mode; /* mode */
u_char des_ivec[8]; /* input vector */
opaque desbuf<>;
};
struct desresp {
opaque desbuf<>;
u_char des_ivec[8];
int stat;
};
program CRYPT_PROG {
version CRYPT_VERS {
desresp
DES_CRYPT(desargs) = 1;
} = 1;
} = 600100029;

284
include/rpcsvc/key_prot.x Normal file
View File

@ -0,0 +1,284 @@
%/*
% * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
% * unrestricted use provided that this legend is included on all tape
% * media and as a part of the software program in whole or part. Users
% * may copy or modify Sun RPC without charge, but are not authorized
% * to license or distribute it to anyone else except as part of a product or
% * program developed by the user.
% *
% * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
% * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
% * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
% *
% * Sun RPC is provided with no support and without any obligation on the
% * part of Sun Microsystems, Inc. to assist in its use, correction,
% * modification or enhancement.
% *
% * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
% * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
% * OR ANY PART THEREOF.
% *
% * In no event will Sun Microsystems, Inc. be liable for any lost revenue
% * or profits or other special, indirect and consequential damages, even if
% * Sun has been advised of the possibility of such damages.
% *
% * Sun Microsystems, Inc.
% * 2550 Garcia Avenue
% * Mountain View, California 94043
% */
/*
* Key server protocol definition
* Copyright (C) 1990, 1991 Sun Microsystems, Inc.
*
* The keyserver is a public key storage/encryption/decryption service
* The encryption method used is based on the Diffie-Hellman exponential
* key exchange technology.
*
* The key server is local to each machine, akin to the portmapper.
* Under TI-RPC, communication with the keyserver is through the
* loopback transport.
*
* NOTE: This .x file generates the USER level headers for the keyserver.
* the KERNEL level headers are created by hand as they kernel has special
* requirements.
*/
%#pragma ident "@(#)key_prot.x 1.7 94/04/29 SMI"
%
%/* Copyright (c) 1990, 1991 Sun Microsystems, Inc. */
%
%/*
% * Compiled from key_prot.x using rpcgen.
% * DO NOT EDIT THIS FILE!
% * This is NOT source code!
% */
/*
* PROOT and MODULUS define the way the Diffie-Hellman key is generated.
*
* MODULUS should be chosen as a prime of the form: MODULUS == 2*p + 1,
* where p is also prime.
*
* PROOT satisfies the following two conditions:
* (1) (PROOT ** 2) % MODULUS != 1
* (2) (PROOT ** p) % MODULUS != 1
*
*/
const PROOT = 3;
const HEXMODULUS = "d4a0ba0250b6fd2ec626e7efd637df76c716e22d0944b88b";
const HEXKEYBYTES = 48; /* HEXKEYBYTES == strlen(HEXMODULUS) */
const KEYSIZE = 192; /* KEYSIZE == bit length of key */
const KEYBYTES = 24; /* byte length of key */
/*
* The first 16 hex digits of the encrypted secret key are used as
* a checksum in the database.
*/
const KEYCHECKSUMSIZE = 16;
/*
* status of operation
*/
enum keystatus {
KEY_SUCCESS, /* no problems */
KEY_NOSECRET, /* no secret key stored */
KEY_UNKNOWN, /* unknown netname */
KEY_SYSTEMERR /* system error (out of memory, encryption failure) */
};
typedef opaque keybuf[HEXKEYBYTES]; /* store key in hex */
typedef string netnamestr<MAXNETNAMELEN>;
/*
* Argument to ENCRYPT or DECRYPT
*/
struct cryptkeyarg {
netnamestr remotename;
des_block deskey;
};
/*
* Argument to ENCRYPT_PK or DECRYPT_PK
*/
struct cryptkeyarg2 {
netnamestr remotename;
netobj remotekey; /* Contains a length up to 1024 bytes */
des_block deskey;
};
/*
* Result of ENCRYPT, DECRYPT, ENCRYPT_PK, and DECRYPT_PK
*/
union cryptkeyres switch (keystatus status) {
case KEY_SUCCESS:
des_block deskey;
default:
void;
};
const MAXGIDS = 16; /* max number of gids in gid list */
/*
* Unix credential
*/
struct unixcred {
u_int uid;
u_int gid;
u_int gids<MAXGIDS>;
};
/*
* Result returned from GETCRED
*/
union getcredres switch (keystatus status) {
case KEY_SUCCESS:
unixcred cred;
default:
void;
};
/*
* key_netstarg;
*/
struct key_netstarg {
keybuf st_priv_key;
keybuf st_pub_key;
netnamestr st_netname;
};
union key_netstres switch (keystatus status){
case KEY_SUCCESS:
key_netstarg knet;
default:
void;
};
#ifdef RPC_HDR
%
%#ifndef opaque
%#define opaque char
%#endif
%
#endif
program KEY_PROG {
version KEY_VERS {
/*
* This is my secret key.
* Store it for me.
*/
keystatus
KEY_SET(keybuf) = 1;
/*
* I want to talk to X.
* Encrypt a conversation key for me.
*/
cryptkeyres
KEY_ENCRYPT(cryptkeyarg) = 2;
/*
* X just sent me a message.
* Decrypt the conversation key for me.
*/
cryptkeyres
KEY_DECRYPT(cryptkeyarg) = 3;
/*
* Generate a secure conversation key for me
*/
des_block
KEY_GEN(void) = 4;
/*
* Get me the uid, gid and group-access-list associated
* with this netname (for kernel which cannot use NIS)
*/
getcredres
KEY_GETCRED(netnamestr) = 5;
} = 1;
version KEY_VERS2 {
/*
* #######
* Procedures 1-5 are identical to version 1
* #######
*/
/*
* This is my secret key.
* Store it for me.
*/
keystatus
KEY_SET(keybuf) = 1;
/*
* I want to talk to X.
* Encrypt a conversation key for me.
*/
cryptkeyres
KEY_ENCRYPT(cryptkeyarg) = 2;
/*
* X just sent me a message.
* Decrypt the conversation key for me.
*/
cryptkeyres
KEY_DECRYPT(cryptkeyarg) = 3;
/*
* Generate a secure conversation key for me
*/
des_block
KEY_GEN(void) = 4;
/*
* Get me the uid, gid and group-access-list associated
* with this netname (for kernel which cannot use NIS)
*/
getcredres
KEY_GETCRED(netnamestr) = 5;
/*
* I want to talk to X. and I know X's public key
* Encrypt a conversation key for me.
*/
cryptkeyres
KEY_ENCRYPT_PK(cryptkeyarg2) = 6;
/*
* X just sent me a message. and I know X's public key
* Decrypt the conversation key for me.
*/
cryptkeyres
KEY_DECRYPT_PK(cryptkeyarg2) = 7;
/*
* Store my public key, netname and private key.
*/
keystatus
KEY_NET_PUT(key_netstarg) = 8;
/*
* Retrieve my public key, netname and private key.
*/
key_netstres
KEY_NET_GET(void) = 9;
/*
* Return me the conversation key that is constructed
* from my secret key and this publickey.
*/
cryptkeyres
KEY_GET_CONV(keybuf) = 10;
} = 2;
} = 100029;

465
include/rpcsvc/nis.x Normal file
View File

@ -0,0 +1,465 @@
%/*
% * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
% * unrestricted use provided that this legend is included on all tape
% * media and as a part of the software program in whole or part. Users
% * may copy or modify Sun RPC without charge, but are not authorized
% * to license or distribute it to anyone else except as part of a product or
% * program developed by the user or with the express written consent of
% * Sun Microsystems, Inc.
% *
% * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
% * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
% * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
% *
% * Sun RPC is provided with no support and without any obligation on the
% * part of Sun Microsystems, Inc. to assist in its use, correction,
% * modification or enhancement.
% *
% * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
% * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
% * OR ANY PART THEREOF.
% *
% * In no event will Sun Microsystems, Inc. be liable for any lost revenue
% * or profits or other special, indirect and consequential damages, even if
% * Sun has been advised of the possibility of such damages.
% *
% * Sun Microsystems, Inc.
% * 2550 Garcia Avenue
% * Mountain View, California 94043
% */
#ifndef RPC_HDR
%#ifndef lint
%static const char rcsid[] = "$Id: nis.x,v 1.5 1996/12/05 06:13:41 wpaul Exp $";
%#endif /* not lint */
#endif
/*
* From 4.1 : @(#)nis.x 1.61 Copyright 1989 Sun Microsystems
*
* RPC Language Protocol description file for NIS Plus
* This version : 1.61
* Last Modified : 3/19/91
*/
#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
/*
* This is just pointless.
*/
#ifdef SUN_STUPIDITY
#if RPC_SVC
%#include "nis_svc.h"
#endif
#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, /* Out of band failure */
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 */
u_long zticks; /* server ticks */
u_long dticks; /* DBM ticks. */
u_long aticks; /* Cache (accel) ticks */
u_long 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 */
u_long ibr_flags; /* Optional flags */
nis_object ibr_obj<1>; /* optional object (add/modify) */
nis_server ibr_cbhost<1>; /* Optional callback info */
u_long 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 */
u_long 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 {
u_long 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 */
u_long cp_zticks; /* Service 'ticks' */
u_long 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_long).
* These are used to report statistics (see tag definitions below)
* and to set or reset state variables.
*/
struct nis_tag {
u_long tag_type; /* Statistic tag (may vary) */
string tag_val<1024>; /* Statistic value may also vary */
};
struct nis_taglist {
nis_tag tags<>; /* List of tags */
};
struct dump_args {
nis_name da_dir; /* Directory to dump */
u_long 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 */
};
/*
* What's going on here? Well, it's like this. When the service
* is being compiled it wants to have the service definition specific
* info included, and when the client is being compiled it wants that
* info. This includes the appropriate file which was generated by
* make in the protocols directory (probably /usr/include/rpcsvc).
*
* Uhm... guys? With RPC, you aren't supposed to have seperate
* server-specific and client-specific header files. You have one header
* file that's suitable for both. If your code doesn't work using just
* the one header file, I submit to you that it's broken.
* -Bill
*/
#ifdef SUN_STUPIDITY
#ifdef RPC_SVC
%#include "nis_svc.h"
#endif
#ifdef RPC_CLNT
%#include "nis_clnt.h"
#endif
#endif
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 */
u_long 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_long 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 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

View File

@ -0,0 +1,86 @@
%/*
% * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
% * unrestricted use provided that this legend is included on all tape
% * media and as a part of the software program in whole or part. Users
% * may copy or modify Sun RPC without charge, but are not authorized
% * to license or distribute it to anyone else except as part of a product or
% * program developed by the user or with the express written consent of
% * Sun Microsystems, Inc.
% *
% * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
% * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
% * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
% *
% * Sun RPC is provided with no support and without any obligation on the
% * part of Sun Microsystems, Inc. to assist in its use, correction,
% * modification or enhancement.
% *
% * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
% * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
% * OR ANY PART THEREOF.
% *
% * In no event will Sun Microsystems, Inc. be liable for any lost revenue
% * or profits or other special, indirect and consequential damages, even if
% * Sun has been advised of the possibility of such damages.
% *
% * Sun Microsystems, Inc.
% * 2550 Garcia Avenue
% * Mountain View, California 94043
% */
/*
* nis_cache.x
*
* Copyright (c) 1988-1992 Sun Microsystems Inc
* All Rights Reserved.
*/
/* From: %#pragma ident "@(#)nis_cache.x 1.11 94/05/03 SMI" */
#ifndef RPC_HDR
%#ifndef lint
%static const char rcsid[] = "$Id: nis_cache.x,v 1.4 1996/07/29 14:32:44 wpaul Exp $";
%#endif /* not lint */
#endif
#ifdef RPC_HDR
%#include <rpc/types.h>
%#include <rpcsvc/nis.h>
%
%/* default cache file */
%#define CACHEFILE "/var/nis/NIS_SHARED_DIRCACHE"
%
%/* clients have to read-lock the cache file, and SVR4 locking requires that */
%/* the file be writable, but we don't want a world-writable cache file. */
%/* So... everyone agrees to use a different, world-writable file for the */
%/* locking operations, but the data is in CACHEFILE. */
%#define CACHELOCK "/usr/tmp/.NIS_DIR_CACHELOCK"
%
%/* the file containing one trusted XDR'ed directory object.
% * This has to be present for the system to work.
% */
%#define COLD_START_FILE "/var/nis/NIS_COLD_START"
%
%enum pc_status {HIT, MISS, NEAR_MISS};
%
%extern int __nis_debuglevel;
%
%
#endif
#ifdef RPC_CLNT
#ifdef SOLARIS
%#include "../gen/nis_clnt.h"
#else
%#include "nis.h"
#endif
#endif
program CACHEPROG {
version CACHE_VER_1 {
void NIS_CACHE_ADD_ENTRY(fd_result) = 1;
void NIS_CACHE_REMOVE_ENTRY(directory_obj) = 2;
void NIS_CACHE_READ_COLDSTART(void) = 3;
void NIS_CACHE_REFRESH_ENTRY(string<>) = 4;
} = 1;
} = 100301;

View File

@ -0,0 +1,75 @@
%/*
% * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
% * unrestricted use provided that this legend is included on all tape
% * media and as a part of the software program in whole or part. Users
% * may copy or modify Sun RPC without charge, but are not authorized
% * to license or distribute it to anyone else except as part of a product or
% * program developed by the user or with the express written consent of
% * Sun Microsystems, Inc.
% *
% * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
% * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
% * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
% *
% * Sun RPC is provided with no support and without any obligation on the
% * part of Sun Microsystems, Inc. to assist in its use, correction,
% * modification or enhancement.
% *
% * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
% * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
% * OR ANY PART THEREOF.
% *
% * In no event will Sun Microsystems, Inc. be liable for any lost revenue
% * or profits or other special, indirect and consequential damages, even if
% * Sun has been advised of the possibility of such damages.
% *
% * Sun Microsystems, Inc.
% * 2550 Garcia Avenue
% * Mountain View, California 94043
% */
/*
* nis_callback.x
*
* Copyright (c) 1988-1992 Sun Microsystems Inc
* All Rights Reserved.
*/
/* From: %#pragma ident "@(#)nis_callback.x 1.7 94/05/03 SMI" */
#ifndef RPC_HDR
%#ifndef lint
%static const char rcsid[] = "$Id: nis_callback.x,v 1.3 1996/07/29 14:32:56 wpaul Exp $";
%#endif /* not lint */
#endif
/*
* "@(#)zns_cback.x 1.2 90/09/10 Copyr 1990 Sun Micro"
*
* RPCL description of the Callback Service.
*/
#ifdef RPC_HDR
%#include <rpcsvc/nis.h>
#endif
#ifdef RPC_XDR
#ifdef SOLARIS
%#include "nis_clnt.h"
#else
%#include "nis.h"
#endif
#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;

161
include/rpcsvc/nis_db.h Normal file
View File

@ -0,0 +1,161 @@
/*
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
* unrestricted use provided that this legend is included on all tape
* media and as a part of the software program in whole or part. Users
* may copy or modify Sun RPC without charge, but are not authorized
* to license or distribute it to anyone else except as part of a product or
* program developed by the user.
*
* SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
* WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
* PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
*
* Sun RPC is provided with no support and without any obligation on the
* part of Sun Microsystems, Inc. to assist in its use, correction,
* modification or enhancement.
*
* SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
* INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
* OR ANY PART THEREOF.
*
* In no event will Sun Microsystems, Inc. be liable for any lost revenue
* or profits or other special, indirect and consequential damages, even if
* Sun has been advised of the possibility of such damages.
*
* Sun Microsystems, Inc.
* 2550 Garcia Avenue
* Mountain View, California 94043
*/
/*
* Copyright (c) 1991, by Sun Microsystems Inc.
*/
/*
* This header file defines the interface to the NIS database. All
* implementations of the database must export at least these routines.
* They must also follow the conventions set herein. See the implementors
* guide for specific semantics that are required.
*/
#ifndef _RPCSVC_NIS_DB_H
#define _RPCSVC_NIS_DB_H
/* From: #pragma ident "@(#)nis_db.h 1.8 94/05/03 SMI" */
#pragma ident "$Id: nis_db.h,v 1.3 1996/07/29 13:59:13 wpaul Exp $"
/*
* Note: although the version of <rpcsvc/nis_db.h> shipped with Solaris
* 2.5/2.5.x is actually older than this one (according to the ident
* string), it contains changes and a few added functions. Those changes
* have been hand merged into this file to bring it up to date.
*/
#include <rpc/rpc.h>
#include <rpcsvc/nis.h>
#ifdef __cplusplus
extern "C" {
#endif
enum db_status {
DB_SUCCESS = 0,
DB_NOTFOUND = 1,
DB_NOTUNIQUE = 2,
DB_BADTABLE = 3,
DB_BADQUERY = 4,
DB_BADOBJECT = 5,
DB_MEMORY_LIMIT = 6,
DB_STORAGE_LIMIT = 7,
DB_INTERNAL_ERROR = 8
};
typedef enum db_status db_status;
enum db_action {
DB_LOOKUP = 0,
DB_REMOVE = 1,
DB_ADD = 2,
DB_FIRST = 3,
DB_NEXT = 4,
DB_ALL = 5,
DB_RESET_NEXT = 6,
};
typedef enum db_action db_action;
typedef entry_obj *entry_object_p;
typedef struct {
u_int db_next_desc_len;
char *db_next_desc_val;
} db_next_desc;
struct db_result {
db_status status;
db_next_desc nextinfo;
struct {
u_int objects_len;
entry_object_p *objects_val;
} objects;
long ticks;
};
typedef struct db_result db_result;
/*
* Prototypes for the database functions.
*/
#if (__STDC__)
extern bool_t db_initialize(char *);
#ifdef ORIGINAL_DECLS
extern bool_t db_create_table(char *, table_obj *);
extern bool_t db_destroy_table(char *);
#else
extern db_status db_create_table(char *, table_obj *);
extern db_status db_destroy_table(char *);
#endif
extern db_result *db_first_entry(char *, int, nis_attr *);
extern db_result *db_next_entry(char *, db_next_desc *);
extern db_result *db_reset_next_entry(char *, db_next_desc *);
extern db_result *db_list_entries(char *, int, nis_attr *);
extern db_result *db_add_entry(char *, int, nis_attr *, entry_obj *);
extern db_result *db_remove_entry(char *, int, nis_attr *);
extern db_status db_checkpoint(char *);
extern db_status db_standby(char *);
#ifndef ORIGINAL_DECLS
extern db_status db_table_exists(char *);
extern db_status db_unload_table(char *);
extern void db_free_result(db_result *);
#endif
#else /* Non-prototype definitions */
extern bool_t db_initialize();
#ifdef ORIGINAL_DECLS
extern bool_t db_create_table();
extern bool_t db_destroy_table();
#else
extern db_status db_create_table();
extern db_status db_destroy_table();
#endif
extern db_result *db_first_entry();
extern db_result *db_next_entry();
extern db_result *db_reset_next_entry();
extern db_result *db_list_entries();
extern db_result *db_add_entry();
extern db_result *db_remove_entry();
extern db_status db_checkpoint();
extern db_status db_standby();
#ifndef ORIGINAL_DECLS
extern db_status db_table_exists();
extern db_status db_unload_table();
extern void db_free_result();
#endif
#endif /* __STDC__ */
#ifdef __cplusplus
}
#endif
#endif /* _RPCSVC_NIS_DB_H */

318
include/rpcsvc/nis_object.x Normal file
View File

@ -0,0 +1,318 @@
%/*
% * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
% * unrestricted use provided that this legend is included on all tape
% * media and as a part of the software program in whole or part. Users
% * may copy or modify Sun RPC without charge, but are not authorized
% * to license or distribute it to anyone else except as part of a product or
% * program developed by the user or with the express written consent of
% * Sun Microsystems, Inc.
% *
% * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
% * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
% * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
% *
% * Sun RPC is provided with no support and without any obligation on the
% * part of Sun Microsystems, Inc. to assist in its use, correction,
% * modification or enhancement.
% *
% * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
% * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
% * OR ANY PART THEREOF.
% *
% * In no event will Sun Microsystems, Inc. be liable for any lost revenue
% * or profits or other special, indirect and consequential damages, even if
% * Sun has been advised of the possibility of such damages.
% *
% * Sun Microsystems, Inc.
% * 2550 Garcia Avenue
% * Mountain View, California 94043
% */
/*
* nis_object.x
*
* Copyright (c) 1988-1992 Sun Microsystems Inc
* All Rights Reserved.
*/
/* From: %#pragma ident "@(#)nis_object.x 1.10 94/05/03 SMI" */
%#pragma ident "$Id: nis_object.x,v 1.2 1996/07/29 14:31:02 wpaul Exp $"
#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 */
/*
* 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.
*/
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) */
};
/*
* 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 {
u_long 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 */
u_long 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 */
u_long 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 {
u_long 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 {
u_long 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 */
u_long tc_flags; /* control flags */
u_long 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 DIRECTORY_OBJ :
struct directory_obj di_data;
case GROUP_OBJ :
struct group_obj gr_data;
case TABLE_OBJ :
struct table_obj ta_data;
case ENTRY_OBJ:
struct entry_obj en_data;
case LINK_OBJ :
struct link_obj li_data;
case PRIVATE_OBJ :
opaque po_data<>;
case NO_OBJ :
void;
case 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 {
u_long ctime; /* Time of objects creation */
u_long 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 */
u_long zo_access; /* Access rights (owner, group, world) */
u_long 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

138
include/rpcsvc/nis_tags.h Normal file
View File

@ -0,0 +1,138 @@
/*
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
* unrestricted use provided that this legend is included on all tape
* media and as a part of the software program in whole or part. Users
* may copy or modify Sun RPC without charge, but are not authorized
* to license or distribute it to anyone else except as part of a product or
* program developed by the user.
*
* SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
* WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
* PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
*
* Sun RPC is provided with no support and without any obligation on the
* part of Sun Microsystems, Inc. to assist in its use, correction,
* modification or enhancement.
*
* SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
* INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
* OR ANY PART THEREOF.
*
* In no event will Sun Microsystems, Inc. be liable for any lost revenue
* or profits or other special, indirect and consequential damages, even if
* Sun has been advised of the possibility of such damages.
*
* Sun Microsystems, Inc.
* 2550 Garcia Avenue
* Mountain View, California 94043
*/
/*
* Copyright (c) 1991, Sun Microsystems Inc.
*/
/*
* 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
/* From: #pragma ident "@(#)nis_tags.h 1.10 94/05/03 SMI" */
/* from file: zns_tags.h 1.7 Copyright (c) 1990 Sun Microsystems */
#pragma ident "$Id: nis_tags.h,v 1.2 1996/07/29 14:26:03 wpaul Exp $"
#ifdef __cplusplus
extern "C" {
#endif
#ifndef ORIGINAL_DECLS
#define NIS_DIR "data"
#endif
/* 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 */
#ifdef ORIGINAL_DECLS
#define MOD_RESERVED (1<<13) /* Spare MOD semantic */
#else
#define MOD_EXCLUSIVE (1<<13) /* Modify no overwrite on modified keys */
#endif
/* 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 */
#ifndef ORIGINAL_DECLS
#define TAG_GCACHE_ALL TAG_GCACHE
#endif
#define TAG_DCACHE 4 /* Flush the directory cache */
#ifndef ORIGINAL_DECLS
#define TAG_DCACHE_ONE TAG_DCACHE
#endif
#define TAG_OCACHE 5 /* Flush the Object Cache */
#define TAG_SECURE 6 /* Set the security level */
#ifndef ORIGINAL_DECLS
#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 */
#endif
#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 */
#ifndef ORIGINAL_DECLS
#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 */
#endif
/*
* 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 */

318
include/rpcsvc/nislib.h Normal file
View File

@ -0,0 +1,318 @@
/*
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
* unrestricted use provided that this legend is included on all tape
* media and as a part of the software program in whole or part. Users
* may copy or modify Sun RPC without charge, but are not authorized
* to license or distribute it to anyone else except as part of a product or
* program developed by the user.
*
* SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
* WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
* PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
*
* Sun RPC is provided with no support and without any obligation on the
* part of Sun Microsystems, Inc. to assist in its use, correction,
* modification or enhancement.
*
* SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
* INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
* OR ANY PART THEREOF.
*
* In no event will Sun Microsystems, Inc. be liable for any lost revenue
* or profits or other special, indirect and consequential damages, even if
* Sun has been advised of the possibility of such damages.
*
* Sun Microsystems, Inc.
* 2550 Garcia Avenue
* Mountain View, California 94043
*/
/*
* Copyright (c) 1991, Sun Microsystems Inc.
*/
/*
* This file contains the interfaces that are visible in the SunOS 5.x
* implementation of NIS Plus. When using C++ the defined __cplusplus and
* __STDC__ should both be true.
*/
#ifndef _RPCSVC_NISLIB_H
#define _RPCSVC_NISLIB_H
/* From: #pragma ident "@(#)nislib.h 1.16 94/05/03 SMI" */
#pragma ident "$Id: nislib.h,v 1.3 1996/09/19 19:37:07 wpaul Exp wpaul $"
#ifdef __cplusplus
extern "C" {
#endif
struct signature {
int signature_len;
char *signature_val;
};
#ifdef __STDC__
extern void nis_freeresult(nis_result *);
extern nis_result * nis_lookup(nis_name, u_long);
extern nis_result * nis_list(nis_name, u_long,
int (*)(nis_name, nis_object *, void *), void *);
extern nis_result * nis_add(nis_name, nis_object *);
extern nis_result * nis_remove(nis_name, nis_object *);
extern nis_result * nis_modify(nis_name, nis_object *);
extern nis_result * nis_add_entry(nis_name, nis_object *, u_long);
extern nis_result * nis_remove_entry(nis_name, nis_object *, u_long);
extern nis_result * nis_modify_entry(nis_name, nis_object *, u_long);
extern nis_result * nis_first_entry(nis_name);
extern nis_result * nis_next_entry(nis_name, netobj *);
extern nis_error nis_mkdir(nis_name, nis_server *);
extern nis_error nis_rmdir(nis_name, nis_server *);
extern name_pos nis_dir_cmp(nis_name, nis_name);
extern nis_name * nis_getnames(nis_name);
extern void nis_freenames(nis_name *);
extern nis_name nis_domain_of(nis_name);
extern nis_name nis_leaf_of(nis_name);
extern nis_name nis_leaf_of_r(const nis_name, char *, size_t);
extern nis_name nis_name_of(nis_name);
extern nis_name nis_local_group(void);
extern nis_name nis_local_directory(void);
extern nis_name nis_local_principal(void);
extern nis_name nis_local_host(void);
extern void nis_destroy_object(nis_object *);
extern nis_object * nis_clone_object(nis_object *, nis_object *);
extern void nis_print_object(nis_object *);
extern char * nis_sperrno(nis_error);
extern void nis_perror(nis_error, char *);
extern char * nis_sperror(nis_error, char *);
extern void nis_lerror(nis_error, char *);
extern void nis_print_group_entry(nis_name);
extern bool_t nis_ismember(nis_name, nis_name);
extern nis_error nis_creategroup(nis_name, u_long);
extern nis_error nis_destroygroup(nis_name);
extern nis_error nis_addmember(nis_name, nis_name);
extern nis_error nis_removemember(nis_name, nis_name);
extern nis_error nis_verifygroup(nis_name);
extern void nis_freeservlist(nis_server **);
extern nis_server ** nis_getservlist(nis_name);
extern nis_error nis_stats(nis_server *, nis_tag *, int, nis_tag **);
extern nis_error nis_servstate(nis_server *, nis_tag *, int, nis_tag **);
extern void nis_freetags(nis_tag *, int);
extern nis_result * nis_checkpoint(nis_name);
extern void nis_ping(nis_name, u_long, nis_object *);
/*
* XXX: PLEASE NOTE THAT THE FOLLOWING FUNCTIONS ARE INTERNAL
* TO NIS+ AND SHOULD NOT BE USED BY ANY APPLICATION PROGRAM.
* THEIR SEMANTICS AND/OR SIGNATURE CAN CHANGE WITHOUT NOTICE.
* SO, PLEASE DO NOT USE THEM. YOU ARE WARNED!!!!
*/
extern char ** __break_name(nis_name, int *);
extern int __name_distance(char **, char **);
extern nis_result * nis_make_error(nis_error, u_long, u_long, u_long, u_long);
extern nis_attr * __cvt2attr(int *, char **);
extern void nis_free_request(ib_request *);
extern nis_error nis_get_request(nis_name, nis_object *, netobj*, ib_request*);
extern nis_object * nis_read_obj(char *);
extern int nis_write_obj(char *, nis_object *);
extern int nis_in_table(nis_name, NIS_HASH_TABLE *, int *);
extern int nis_insert_item(NIS_HASH_ITEM *, NIS_HASH_TABLE *);
extern NIS_HASH_ITEM * nis_find_item(nis_name, NIS_HASH_TABLE *);
extern NIS_HASH_ITEM * nis_remove_item(nis_name, NIS_HASH_TABLE *);
extern void nis_insert_name(nis_name, NIS_HASH_TABLE *);
extern void nis_remove_name(nis_name, NIS_HASH_TABLE *);
extern CLIENT * nis_make_rpchandle(nis_server *, int, u_long, u_long, u_long,
int, int);
extern void * nis_get_static_storage(struct nis_sdata *, u_long, u_long);
extern char * nis_data(char *);
extern void nis_print_rights(u_long);
extern void nis_print_directory(directory_obj *);
extern void nis_print_group(group_obj *);
extern void nis_print_table(table_obj *);
extern void nis_print_link(link_obj *);
extern void nis_print_entry(entry_obj *);
extern nis_object * nis_get_object(char *, char *, char *, u_long, u_long,
zotypes);
extern nis_server * __nis_init_callback(CLIENT *,
int (*)(nis_name, nis_object *, void *), void *);
extern int nis_getdtblsize(void);
extern int __nis_run_callback(netobj *, u_long, struct timeval *, CLIENT *);
extern log_result *nis_dumplog(nis_server *, nis_name, u_long);
extern log_result *nis_dump(nis_server *, nis_name,
int (*)(nis_name, nis_object *, void *));
extern bool_t __do_ismember(nis_name, nis_name,
nis_result *(*)(nis_name, u_long));
extern nis_name __nis_map_group(nis_name);
extern nis_name __nis_map_group_r(nis_name, char*, size_t);
extern nis_error __nis_CacheBind(char *, directory_obj *);
extern nis_error __nis_CacheSearch(char *, directory_obj *);
extern bool_t __nis_CacheRemoveEntry(directory_obj *);
extern void __nis_CacheRestart(void);
extern void __nis_CachePrint(void);
extern void __nis_CacheDumpStatistics(void);
extern bool_t writeColdStartFile(directory_obj *);
extern CLIENT * __get_ti_clnt(char *, CLIENT *, char **, pid_t *);
extern int __strcmp_case_insens(char *, char *);
extern int __strncmp_case_insens(char *, char *);
extern fd_result * nis_finddirectory(directory_obj *, nis_name);
extern int __start_clock(int);
extern u_long __stop_clock(int);
/*
* This particular function is part of the FreeBSD NIS+ implementation
* only. Ideally it should be somewhere else, but it is used by both
* rpc.nisd and nis_cachemgr, and there aren't that many headers common
* to both programs.
*/
extern struct signature *__nis_calculate_encrypted_cksum(unsigned char *, unsigned int, char *, int);
#else
/* Non-prototype definitions (old fashioned C) */
extern void nis_freeresult();
extern nis_result * nis_lookup();
extern nis_result * nis_list();
extern nis_result * nis_add();
extern nis_result * nis_remove();
extern nis_result * nis_modify();
extern nis_result * nis_add_entry();
extern nis_result * nis_remove_entry();
extern nis_result * nis_modify_entry();
extern nis_result * nis_first_entry();
extern nis_result * nis_next_entry();
extern nis_error nis_mkdir();
extern nis_error nis_rmdir();
extern name_pos nis_dir_cmp();
extern nis_name *nis_getnames();
extern void nis_freenames();
extern nis_name nis_domain_of();
extern nis_name nis_leaf_of();
extern nis_name nis_leaf_of_r();
extern nis_name nis_name_of();
extern nis_name nis_local_group();
extern nis_name nis_local_directory();
extern nis_name nis_local_principal();
extern nis_name nis_local_host();
extern void nis_destroy_object();
extern nis_object * nis_clone_object();
extern void nis_print_object();
extern char * nis_sperrno();
extern void nis_perror();
extern char * nis_sperror();
extern void nis_lerror();
extern void nis_print_group_entry();
extern bool_t nis_ismember();
extern nis_error nis_creategroup();
extern nis_error nis_destroygroup();
extern nis_error nis_addmember();
extern nis_error nis_removemember();
extern nis_error nis_verifygroup();
extern void nis_freeservlist();
extern nis_server ** nis_getservlist();
extern nis_error nis_stats();
extern nis_error nis_servstate();
extern void nis_freetags();
extern nis_result * nis_checkpoint();
extern void nis_ping();
/*
* XXX: PLEASE NOTE THAT THE FOLLOWING FUNCTIONS ARE INTERNAL
* TO NIS+ AND SHOULD NOT BE USED BY ANY APPLICATION PROGRAM.
* THEIR SEMANTICS AND/OR SIGNATURE CAN CHANGE WITHOUT NOTICE.
* SO, PLEASE DO NOT USE THEM. YOU ARE WARNED!!!!
*/
extern char ** __break_name();
extern int __name_distance();
extern nis_result * nis_make_error();
extern nis_attr * __cvt2attr();
extern void nis_free_request();
extern nis_error nis_get_request();
extern nis_object * nis_read_obj();
extern int nis_write_obj();
extern int nis_in_table();
extern int nis_insert_item();
extern NIS_HASH_ITEM * nis_find_item();
extern NIS_HASH_ITEM * nis_remove_item();
extern void nis_insert_name();
extern void nis_remove_name();
extern CLIENT * nis_make_rpchandle();
extern void * nis_get_static_storage();
extern char * nis_data();
extern void nis_print_rights();
extern void nis_print_directory();
extern void nis_print_group();
extern void nis_print_table();
extern void nis_print_link();
extern void nis_print_entry();
extern nis_object * nis_get_object();
extern nis_server * __nis_init_callback();
extern int nis_getdtblsize();
extern int __nis_run_callback();
extern log_result * nis_dump();
extern log_result * nis_dumplog();
extern bool_t __do_ismember();
extern nis_name __nis_map_group();
extern nis_name __nis_map_group_r();
extern nis_error __nis_CacheBind();
extern directory_obj * __nis_CacheSearch();
extern bool_t __nis_CacheRemoveEntry();
extern void __nis_CacheRestart();
extern void __nis_CachePrint();
extern void __nis_CacheDumpStatistics();
extern bool_t writeColdStartFile();
extern CLIENT * __get_ti_clnt();
extern int __strcmp_case_insens();
extern int __strncmp_case_insens();
extern fd_result * nis_finddirectory();
extern int __start_clock();
extern u_long __stop_clock();
/*
* This particular function is part of the FreeBSD NIS+ implementation
* only. Ideally it should be somewhere else, but it is used by both
* rpc.nisd and nis_cachemgr, and there aren't that many headers common
* to both programs.
*/
extern struct signature *__nis_calculate_encrypted_cksum();
#endif
#define NUL '\0'
#ifdef __cplusplus
}
#endif
#endif /* _RPCSVC_NISLIB_H */

285
include/rpcsvc/pmap_prot.x Normal file
View File

@ -0,0 +1,285 @@
%/*
% * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
% * unrestricted use provided that this legend is included on all tape
% * media and as a part of the software program in whole or part. Users
% * may copy or modify Sun RPC without charge, but are not authorized
% * to license or distribute it to anyone else except as part of a product or
% * program developed by the user.
% *
% * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
% * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
% * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
% *
% * Sun RPC is provided with no support and without any obligation on the
% * part of Sun Microsystems, Inc. to assist in its use, correction,
% * modification or enhancement.
% *
% * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
% * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
% * OR ANY PART THEREOF.
% *
% * In no event will Sun Microsystems, Inc. be liable for any lost revenue
% * or profits or other special, indirect and consequential damages, even if
% * Sun has been advised of the possibility of such damages.
% *
% * Sun Microsystems, Inc.
% * 2550 Garcia Avenue
% * Mountain View, California 94043
% */
%/*
% * Copyright (c) 1984,1989 by Sun Microsystems, Inc.
% */
%/* from pmap_prot.x */
#ifdef RPC_HDR
%
%#pragma ident "@(#)pmap_prot.x 1.6 94/04/29 SMI"
%
%#ifndef _KERNEL
%
#endif
/*
* Port Mapper Protocol Specification (in RPC Language)
* derived from RFC 1057
*/
%/*
% * Protocol for the local binder service, or pmap.
% *
% * Copyright (C) 1984, Sun Microsystems, Inc.
% *
% * The following procedures are supported by the protocol:
% *
% * PMAPPROC_NULL() returns ()
% * takes nothing, returns nothing
% *
% * PMAPPROC_SET(struct pmap) returns (bool_t)
% * TRUE is success, FALSE is failure. Registers the tuple
% * [prog, vers, prot, port].
% *
% * PMAPPROC_UNSET(struct pmap) returns (bool_t)
% * TRUE is success, FALSE is failure. Un-registers pair
% * [prog, vers]. prot and port are ignored.
% *
% * PMAPPROC_GETPORT(struct pmap) returns (long unsigned).
% * 0 is failure. Otherwise returns the port number where the pair
% * [prog, vers] is registered. It may lie!
% *
% * PMAPPROC_DUMP() RETURNS (struct pmaplist_ptr)
% *
% * PMAPPROC_CALLIT(unsigned, unsigned, unsigned, string<>)
% * RETURNS (port, string<>);
% * usage: encapsulatedresults = PMAPPROC_CALLIT(prog, vers, proc,
% * encapsulatedargs);
% * Calls the procedure on the local machine. If it is not registered,
% * this procedure is quite; ie it does not return error information!!!
% * This procedure only is supported on rpc/udp and calls via
% * rpc/udp. This routine only passes null authentication parameters.
% * This file has no interface to xdr routines for PMAPPROC_CALLIT.
% *
% * The service supports remote procedure calls on udp/ip or tcp/ip socket 111.
% */
%
const PMAPPORT = 111; /* portmapper port number */
%
%
%/*
% * A mapping of (program, version, protocol) to port number
% */
struct pmap {
unsigned long pm_prog;
unsigned long pm_vers;
unsigned long pm_prot;
unsigned long pm_port;
};
#ifdef RPC_HDR
%
%typedef pmap PMAP;
%
#endif
%
%/*
% * Supported values for the "prot" field
% */
%
const PMAP_IPPROTO_TCP = 6; /* protocol number for TCP/IP */
const PMAP_IPPROTO_UDP = 17; /* protocol number for UDP/IP */
%
%
%/*
% * A list of mappings
% *
% * Below are two definitions for the pmaplist structure. This is done because
% * xdr_pmaplist() is specified to take a struct pmaplist **, rather than a
% * struct pmaplist * that rpcgen would produce. One version of the pmaplist
% * structure (actually called pm__list) is used with rpcgen, and the other is
% * defined only in the header file for compatibility with the specified
% * interface.
% */
struct pm__list {
pmap pml_map;
struct pm__list *pml_next;
};
typedef pm__list *pmaplist_ptr; /* results of PMAPPROC_DUMP */
#ifdef RPC_HDR
%
%typedef struct pm__list pmaplist;
%typedef struct pm__list PMAPLIST;
%
%#ifndef __cplusplus
%struct pmaplist {
% PMAP pml_map;
% struct pmaplist *pml_next;
%};
%#endif
%
%#ifdef __cplusplus
%extern "C" {
%#endif
%#ifdef __STDC__
%extern bool_t xdr_pmaplist(XDR *, pmaplist**);
%#else /* K&R C */
%bool_t xdr_pmaplist();
%#endif
%#ifdef __cplusplus
%}
%#endif
%
#endif
%
%/*
% * Arguments to callit
% */
struct rmtcallargs {
unsigned long prog;
unsigned long vers;
unsigned long proc;
opaque args<>;
};
#ifdef RPC_HDR
%
%/*
% * Client-side only representation of rmtcallargs structure.
% *
% * The routine that XDRs the rmtcallargs structure must deal with the
% * opaque arguments in the "args" structure. xdr_rmtcall_args() needs to be
% * passed the XDR routine that knows the args' structure. This routine
% * doesn't need to go over-the-wire (and it wouldn't make sense anyway) since
% * the application being called knows the args structure already. So we use a
% * different "XDR" structure on the client side, p_rmtcallargs, which includes
% * the args' XDR routine.
% */
%struct p_rmtcallargs {
% u_long prog;
% u_long vers;
% u_long proc;
% struct {
% u_int args_len;
% char *args_val;
% } args;
% xdrproc_t xdr_args; /* encodes args */
%};
%
#endif /* def RPC_HDR */
%
%
%/*
% * Results of callit
% */
struct rmtcallres {
unsigned long port;
opaque res<>;
};
#ifdef RPC_HDR
%
%/*
% * Client-side only representation of rmtcallres structure.
% */
%struct p_rmtcallres {
% u_long port;
% struct {
% u_int res_len;
% char *res_val;
% } res;
% xdrproc_t xdr_res; /* decodes res */
%};
%
#endif /* def RPC_HDR */
/*
* Port mapper procedures
*/
program PMAPPROG {
version PMAPVERS {
void
PMAPPROC_NULL(void) = 0;
bool
PMAPPROC_SET(pmap) = 1;
bool
PMAPPROC_UNSET(pmap) = 2;
unsigned long
PMAPPROC_GETPORT(pmap) = 3;
pmaplist_ptr
PMAPPROC_DUMP(void) = 4;
rmtcallres
PMAPPROC_CALLIT(rmtcallargs) = 5;
} = 2;
} = 100000;
%
#ifdef RPC_HDR
%#define PMAPVERS_PROTO ((u_long)2)
%#define PMAPVERS_ORIG ((u_long)1)
%
%#else /* ndef _KERNEL */
%
%#include <rpc/pmap_rmt.h>
%
%#ifdef __cplusplus
%extern "C" {
%#endif
%
%#define PMAPPORT 111
%
%struct pmap {
% long unsigned pm_prog;
% long unsigned pm_vers;
% long unsigned pm_prot;
% long unsigned pm_port;
%};
%typedef struct pmap PMAP;
%#ifdef __STDC__
%extern bool_t xdr_pmap (XDR *, struct pmap *);
%#else
%extern bool_t xdr_pmap ();
%#endif
%
%struct pmaplist {
% struct pmap pml_map;
% struct pmaplist *pml_next;
%};
%typedef struct pmaplist PMAPLIST;
%typedef struct pmaplist *pmaplist_ptr;
%
%
%#ifdef __cplusplus
%}
%#endif
%
%#endif /* ndef _KERNEL */
#endif

View File

@ -0,0 +1,87 @@
%/*
% * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
% * unrestricted use provided that this legend is included on all tape
% * media and as a part of the software program in whole or part. Users
% * may copy or modify Sun RPC without charge, but are not authorized
% * to license or distribute it to anyone else except as part of a product or
% * program developed by the user or with the express written consent of
% * Sun Microsystems, Inc.
% *
% * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
% * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
% * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
% *
% * Sun RPC is provided with no support and without any obligation on the
% * part of Sun Microsystems, Inc. to assist in its use, correction,
% * modification or enhancement.
% *
% * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
% * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
% * OR ANY PART THEREOF.
% *
% * In no event will Sun Microsystems, Inc. be liable for any lost revenue
% * or profits or other special, indirect and consequential damages, even if
% * Sun has been advised of the possibility of such damages.
% *
% * Sun Microsystems, Inc.
% * 2550 Garcia Avenue
% * Mountain View, California 94043
% */
%/*
% * Copyright (c) 1986, 1990 by Sun Microsystems, Inc.
% */
%
%/* from @(#)ypupdate_prot.x 1.3 91/03/11 TIRPC 1.0 */
#ifndef RPC_HDR
%#ifndef lint
%static const char rcsid[] = "$Id$";
%#endif
#endif
%
%/*
% * Compiled from ypupdate_prot.x using rpcgen
% * This is NOT source code!
% * DO NOT EDIT THIS FILE!
% */
/*
* YP update service protocol
*/
#ifdef RPC_HDR
%
%#ifndef _rpcsvc_ypupdate_prot_h
%#define _rpcsvc_ypupdate_prot_h
%
#endif
const MAXMAPNAMELEN = 255;
const MAXYPDATALEN = 1023;
const MAXERRMSGLEN = 255;
program YPU_PROG {
version YPU_VERS {
u_int YPU_CHANGE(ypupdate_args) = 1;
u_int YPU_INSERT(ypupdate_args) = 2;
u_int YPU_DELETE(ypdelete_args) = 3;
u_int YPU_STORE(ypupdate_args) = 4;
} = 1;
} = 100028;
typedef opaque yp_buf<MAXYPDATALEN>;
struct ypupdate_args {
string mapname<MAXMAPNAMELEN>;
yp_buf key;
yp_buf datum;
};
struct ypdelete_args {
string mapname<MAXMAPNAMELEN>;
yp_buf key;
};
#ifdef RPC_HDR
%
%#endif /* !_rpcsvc_ypupdate_prot_h */
#endif