Step two: import Secure RPC changes to include/rpc.

Reviewed by:	Mark Murray
This commit is contained in:
Bill Paul 1997-05-28 04:42:53 +00:00
parent 3b0f74670a
commit f7e2700f42
17 changed files with 1288 additions and 305 deletions

View File

@ -1,4 +1,3 @@
/* @(#)auth.h 2.3 88/08/07 4.0 RPCSRC; from 1.17 88/02/08 SMI */
/*
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
* unrestricted use provided that this legend is included on all tape
@ -6,26 +5,30 @@
* 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
* WARRANTIES OF DESIGN, MERCHANTABILITY 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
*
* from: @(#)auth.h 1.17 88/02/08 SMI
* from: @(#)auth.h 2.3 88/08/07 4.0 RPCSRC
* $Id: auth.h,v 1.6 1996/12/30 13:59:37 peter Exp $
*/
/*
@ -38,6 +41,10 @@
* "sessions".
*/
#ifndef _RPC_AUTH_H
#define _RPC_AUTH_H
#include <sys/cdefs.h>
#include <sys/socket.h>
#define MAX_AUTH_BYTES 400
#define MAXNETNAMELEN 255 /* maximum length of network user's name */
@ -62,19 +69,17 @@ enum auth_stat {
AUTH_FAILED=7 /* some unknown reason */
};
#if (mc68000 || sparc || vax || i386 || tahoe || luna68k || hp300 || mips)
typedef u_long u_int32; /* 32-bit unsigned integers */
#endif
union des_block {
struct {
u_int32 high;
u_int32 low;
u_int32_t high;
u_int32_t low;
} key;
char c[8];
};
typedef union des_block des_block;
extern bool_t xdr_des_block();
__BEGIN_DECLS
extern bool_t xdr_des_block __P((XDR *, des_block *));
__END_DECLS
/*
* Authentication info. Opaque to client.
@ -84,21 +89,29 @@ struct opaque_auth {
caddr_t oa_base; /* address of more auth stuff */
u_int oa_length; /* not to exceed MAX_AUTH_BYTES */
};
__BEGIN_DECLS
bool_t xdr_opaque_auth __P((XDR *xdrs, struct opaque_auth *ap));
__END_DECLS
/*
* Auth handle, interface to client side authenticators.
*/
typedef struct {
typedef struct __rpc_auth {
struct opaque_auth ah_cred;
struct opaque_auth ah_verf;
union des_block ah_key;
struct auth_ops {
void (*ah_nextverf)();
int (*ah_marshal)(); /* nextverf & serialize */
int (*ah_validate)(); /* validate varifier */
int (*ah_refresh)(); /* refresh credentials */
void (*ah_destroy)(); /* destroy this structure */
void (*ah_nextverf) __P((struct __rpc_auth *));
/* nextverf & serialize */
int (*ah_marshal) __P((struct __rpc_auth *, XDR *));
/* validate verifier */
int (*ah_validate) __P((struct __rpc_auth *,
struct opaque_auth *));
/* refresh credentials */
int (*ah_refresh) __P((struct __rpc_auth *));
/* destroy this structure */
void (*ah_destroy) __P((struct __rpc_auth *));
} *ah_ops;
caddr_t ah_private;
} AUTH;
@ -140,7 +153,6 @@ typedef struct {
extern struct opaque_auth _null_auth;
/*
* These are the various implementations of client side authenticators.
*/
@ -154,13 +166,97 @@ extern struct opaque_auth _null_auth;
* int len;
* int *aup_gids;
*/
extern AUTH *authunix_create();
extern AUTH *authunix_create_default(); /* takes no parameters */
extern AUTH *authnone_create(); /* takes no parameters */
extern AUTH *authdes_create();
__BEGIN_DECLS
struct sockaddr_in;
extern AUTH *authunix_create __P((char *, int, int, int, int *));
extern AUTH *authunix_create_default __P((void));
extern AUTH *authnone_create __P((void));
__END_DECLS
/* Forward compatibility with TI-RPC */
#define authsys_create authunix_create
#define authsys_create_default authunix_create_default
/*
* DES style authentication
* AUTH *authdes_create(servername, window, timehost, ckey)
* char *servername; - network name of server
* u_int window; - time to live
* struct sockaddr *timehost; - optional hostname to sync with
* des_block *ckey; - optional conversation key to use
*/
__BEGIN_DECLS
extern AUTH *authdes_create __P(( char *, u_int, struct sockaddr *, des_block * ));
#ifdef NOTYET
/*
* TI-RPC supports this call, but it requires the inclusion of
* NIS+-specific headers which would require the inclusion of other
* headers which would result in a tangled mess. For now, the NIS+
* code prototypes this routine internally.
*/
extern AUTH *authdes_pk_create __P(( char *, netobj *, u_int,
struct sockaddr *, des_block *,
nis_server * ));
#endif
__END_DECLS
/*
* Netname manipulation routines.
*/
__BEGIN_DECLS
extern int netname2user __P(( char *, uid_t *, gid_t *, int *, gid_t *));
extern int netname2host __P(( char *, char *, int ));
extern int getnetname __P(( char * ));
extern int user2netname __P(( char *, uid_t, char * ));
extern int host2netname __P(( char *, char *, char * ));
extern void passwd2des __P(( char *, char * ));
__END_DECLS
/*
* Keyserv interface routines.
* XXX Should not be here.
*/
#ifndef HEXKEYBYTES
#define HEXKEYBYTES 48
#endif
typedef char kbuf[HEXKEYBYTES];
typedef char *namestr;
struct netstarg {
kbuf st_priv_key;
kbuf st_pub_key;
namestr st_netname;
};
__BEGIN_DECLS
extern int key_decryptsession __P(( const char *, des_block * ));
extern int key_decryptsession_pk __P(( char *, netobj *, des_block * ));
extern int key_encryptsession __P(( const char *, des_block * ));
extern int key_encryptsession_pk __P(( char *, netobj *, des_block * ));
extern int key_gendes __P(( des_block * ));
extern int key_setsecret __P(( const char * ));
extern int key_secretkey_is_set __P(( void ));
extern int key_setnet __P(( struct netstarg * ));
extern int key_get_conv __P(( char *, des_block * ));
__END_DECLS
/*
* Publickey routines.
*/
__BEGIN_DECLS
extern int getpublickey __P(( char *, char * ));
extern int getpublicandprivatekey __P(( char *, char * ));
extern int getsecretkey __P(( char *, char *, char * ));
__END_DECLS
#ifndef AUTH_NONE /* Protect against <login_cap.h> */
#define AUTH_NONE 0 /* no authentication */
#endif
#define AUTH_NULL 0 /* backward compatibility */
#define AUTH_UNIX 1 /* unix style (uid, gids) */
#define AUTH_SYS 1 /* forward compatibility */
#define AUTH_SHORT 2 /* short hand unix style */
#define AUTH_DES 3 /* des style (encrypted timestamps) */
#endif /* !_RPC_AUTH_H */

109
include/rpc/auth_des.h Normal file
View File

@ -0,0 +1,109 @@
/* @(#)auth_des.h 2.2 88/07/29 4.0 RPCSRC; from 1.3 88/02/08 SMI */
/*
* 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) 1988 by Sun Microsystems, Inc.
*/
/*
* auth_des.h, Protocol for DES style authentication for RPC
*/
#ifndef _AUTH_DES_
#define _AUTH_DES_
/*
* There are two kinds of "names": fullnames and nicknames
*/
enum authdes_namekind {
ADN_FULLNAME,
ADN_NICKNAME
};
/*
* A fullname contains the network name of the client,
* a conversation key and the window
*/
struct authdes_fullname {
char *name; /* network name of client, up to MAXNETNAMELEN */
des_block key; /* conversation key */
u_long window; /* associated window */
};
/*
* A credential
*/
struct authdes_cred {
enum authdes_namekind adc_namekind;
struct authdes_fullname adc_fullname;
u_long adc_nickname;
};
/*
* A des authentication verifier
*/
struct authdes_verf {
union {
struct timeval adv_ctime; /* clear time */
des_block adv_xtime; /* crypt time */
} adv_time_u;
u_long adv_int_u;
};
/*
* des authentication verifier: client variety
*
* adv_timestamp is the current time.
* adv_winverf is the credential window + 1.
* Both are encrypted using the conversation key.
*/
#define adv_timestamp adv_time_u.adv_ctime
#define adv_xtimestamp adv_time_u.adv_xtime
#define adv_winverf adv_int_u
/*
* des authentication verifier: server variety
*
* adv_timeverf is the client's timestamp + client's window
* adv_nickname is the server's nickname for the client.
* adv_timeverf is encrypted using the conversation key.
*/
#define adv_timeverf adv_time_u.adv_ctime
#define adv_xtimeverf adv_time_u.adv_xtime
#define adv_nickname adv_int_u
__BEGIN_DECLS
extern int authdes_getucred __P(( struct authdes_cred *, uid_t *, gid_t *, int *, gid_t * ));
__END_DECLS
#endif /* ndef _AUTH_DES_ */

View File

@ -1,4 +1,3 @@
/* @(#)auth_unix.h 2.2 88/07/29 4.0 RPCSRC; from 1.8 88/02/08 SMI */
/*
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
* unrestricted use provided that this legend is included on all tape
@ -6,28 +5,31 @@
* 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
* WARRANTIES OF DESIGN, MERCHANTABILITY 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
*
* from: @(#)auth_unix.h 1.8 88/02/08 SMI
* from: @(#)auth_unix.h 2.2 88/07/29 4.0 RPCSRC
* $Id: auth_unix.h,v 1.4 1996/01/30 23:31:42 mpp Exp $
*/
/* @(#)auth_unix.h 1.5 86/07/16 SMI */
/*
* auth_unix.h, Protocol for UNIX style authentication parameters for RPC
@ -42,6 +44,10 @@
* for the credentials.
*/
#ifndef _RPC_AUTH_UNIX_H
#define _RPC_AUTH_UNIX_H
#include <sys/cdefs.h>
/* The machine name is part of a credential; it may not exceed 255 bytes */
#define MAX_MACHINE_NAME 255
@ -60,13 +66,19 @@ struct authunix_parms {
int *aup_gids;
};
extern bool_t xdr_authunix_parms();
#define authsys_parms authunix_parms
/*
* If a response verifier has flavor AUTH_SHORT,
__BEGIN_DECLS
extern bool_t xdr_authunix_parms __P((XDR *, struct authunix_parms *));
__END_DECLS
/*
* If a response verifier has flavor AUTH_SHORT,
* then the body of the response verifier encapsulates the following structure;
* again it is serialized in the obvious fashion.
*/
struct short_hand_verf {
struct opaque_auth new_cred;
};
#endif /* !_RPC_AUTH_UNIX_H */

View File

@ -1,4 +1,3 @@
/* @(#)clnt.h 2.1 88/07/29 4.0 RPCSRC; from 1.31 88/02/08 SMI*/
/*
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
* unrestricted use provided that this legend is included on all tape
@ -6,26 +5,30 @@
* 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
* WARRANTIES OF DESIGN, MERCHANTABILITY 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
*
* from: @(#)clnt.h 1.31 88/02/08 SMI
* from: @(#)clnt.h 2.1 88/07/29 4.0 RPCSRC
* $Id: clnt.h,v 1.5 1996/12/30 13:59:38 peter Exp $
*/
/*
@ -34,8 +37,10 @@
* Copyright (C) 1984, Sun Microsystems, Inc.
*/
#ifndef _CLNT_
#define _CLNT_
#ifndef _RPC_CLNT_H_
#define _RPC_CLNT_H_
#include <sys/cdefs.h>
#include <sys/un.h>
/*
* Rpc calls return an enum clnt_stat. This should be looked at more,
@ -87,15 +92,15 @@ enum clnt_stat {
struct rpc_err {
enum clnt_stat re_status;
union {
int RE_errno; /* realated system error */
int RE_errno; /* related system error */
enum auth_stat RE_why; /* why the auth error occurred */
struct {
u_long low; /* lowest verion supported */
u_long high; /* highest verion supported */
u_int32_t low; /* lowest verion supported */
u_int32_t high; /* highest verion supported */
} RE_vers;
struct { /* maybe meaningful if RPC_FAILED */
long s1;
long s2;
int32_t s1;
int32_t s2;
} RE_lb; /* life boot & debugging only */
} ru;
#define re_errno ru.RE_errno
@ -110,15 +115,26 @@ struct rpc_err {
* Created by individual implementations, see e.g. rpc_udp.c.
* Client is responsible for initializing auth, see e.g. auth_none.c.
*/
typedef struct {
typedef struct __rpc_client {
AUTH *cl_auth; /* authenticator */
struct clnt_ops {
enum clnt_stat (*cl_call)(); /* call remote procedure */
void (*cl_abort)(); /* abort a call */
void (*cl_geterr)(); /* get specific error code */
bool_t (*cl_freeres)(); /* frees results */
void (*cl_destroy)();/* destroy this structure */
bool_t (*cl_control)();/* the ioctl() of rpc */
/* call remote procedure */
enum clnt_stat (*cl_call) __P((struct __rpc_client *,
u_long, xdrproc_t, caddr_t, xdrproc_t,
caddr_t, struct timeval));
/* abort a call */
void (*cl_abort) __P((struct __rpc_client *));
/* get specific error code */
void (*cl_geterr) __P((struct __rpc_client *,
struct rpc_err *));
/* frees results */
bool_t (*cl_freeres) __P((struct __rpc_client *,
xdrproc_t, caddr_t));
/* destroy this structure */
void (*cl_destroy) __P((struct __rpc_client *));
/* the ioctl() of rpc */
bool_t (*cl_control) __P((struct __rpc_client *, u_int,
void *));
} *cl_ops;
caddr_t cl_private; /* private stuff */
} CLIENT;
@ -143,9 +159,11 @@ typedef struct {
* struct timeval timeout;
*/
#define CLNT_CALL(rh, proc, xargs, argsp, xres, resp, secs) \
((*(rh)->cl_ops->cl_call)(rh, proc, xargs, argsp, xres, resp, secs))
((*(rh)->cl_ops->cl_call)(rh, proc, xargs, (caddr_t)argsp, \
xres, (caddr_t)resp, secs))
#define clnt_call(rh, proc, xargs, argsp, xres, resp, secs) \
((*(rh)->cl_ops->cl_call)(rh, proc, xargs, argsp, xres, resp, secs))
((*(rh)->cl_ops->cl_call)(rh, proc, xargs, (caddr_t)argsp, \
xres, (caddr_t)resp, secs))
/*
* void
@ -185,17 +203,42 @@ typedef struct {
#define clnt_control(cl,rq,in) ((*(cl)->cl_ops->cl_control)(cl,rq,in))
/*
* control operations that apply to both udp and tcp transports
* control operations that apply to udp, tcp and unix transports
*
* Note: options marked XXX are no-ops in this implementation of RPC.
* The are present in TI-RPC but can't be implemented here since they
* depend on the presence of STREAMS/TLI, which we don't have.
*
*/
#define CLSET_TIMEOUT 1 /* set timeout (timeval) */
#define CLGET_TIMEOUT 2 /* get timeout (timeval) */
#define CLGET_SERVER_ADDR 3 /* get server's address (sockaddr) */
#define CLGET_FD 6 /* get connections file descriptor */
#define CLGET_SVC_ADDR 7 /* get server's address (netbuf) XXX */
#define CLSET_FD_CLOSE 8 /* close fd while clnt_destroy */
#define CLSET_FD_NCLOSE 9 /* Do not close fd while clnt_destroy */
#define CLGET_XID 10 /* Get xid */
#define CLSET_XID 11 /* Set xid */
#define CLGET_VERS 12 /* Get version number */
#define CLSET_VERS 13 /* Set version number */
#define CLGET_PROG 14 /* Get program number */
#define CLSET_PROG 15 /* Set program number */
#define CLSET_SVC_ADDR 16 /* get server's address (netbuf) XXX */
#define CLSET_PUSH_TIMOD 17 /* push timod if not already present XXX */
#define CLSET_POP_TIMOD 18 /* pop timod XXX */
/*
* udp only control operations
*/
#define CLSET_RETRY_TIMEOUT 4 /* set retry timeout (timeval) */
#define CLGET_RETRY_TIMEOUT 5 /* get retry timeout (timeval) */
/*
* Operations which GSSAPI needs. (Bletch.)
*/
#define CLGET_LOCAL_ADDR 19 /* get local addr (sockaddr) */
/*
* void
* CLNT_DESTROY(rh);
@ -206,7 +249,7 @@ typedef struct {
/*
* RPCTEST is a test program which is accessable on every rpc
* RPCTEST is a test program which is accessible on every rpc
* transport/port. It is used for testing, performance evaluation,
* and network administration.
*/
@ -224,7 +267,7 @@ typedef struct {
/*
* Below are the client handle creation routines for the various
* implementations of client side rpc. They can return NULL if a
* implementations of client side rpc. They can return NULL if a
* creation failure occurs.
*/
@ -235,21 +278,24 @@ typedef struct {
* u_long prog;
* u_long vers;
*/
extern CLIENT *clntraw_create();
__BEGIN_DECLS
extern CLIENT *clntraw_create __P((u_long, u_long));
__END_DECLS
/*
* Generic client creation routine. Supported protocols are "udp" and "tcp"
* Generic client creation routine. Supported protocols are "udp", "tcp"
* and "unix".
* CLIENT *
* clnt_create(host, prog, vers, prot);
* char *host; -- hostname
* u_long prog; -- program number
* u_long vers; -- version number
* char *prot; -- protocol
*/
extern CLIENT *
clnt_create(/*host, prog, vers, prot*/); /*
char *host; -- hostname
u_long prog; -- program number
u_long vers; -- version number
char *prot; -- protocol
*/
__BEGIN_DECLS
extern CLIENT *clnt_create __P((char *, u_long, u_long, char *));
__END_DECLS
/*
@ -263,7 +309,15 @@ clnt_create(/*host, prog, vers, prot*/); /*
* u_int sendsz;
* u_int recvsz;
*/
extern CLIENT *clnttcp_create();
__BEGIN_DECLS
extern CLIENT *clnttcp_create __P((struct sockaddr_in *,
u_long,
u_long,
int *,
u_int,
u_int));
__END_DECLS
/*
* UDP based rpc.
@ -286,27 +340,69 @@ extern CLIENT *clnttcp_create();
* u_int sendsz;
* u_int recvsz;
*/
extern CLIENT *clntudp_create();
extern CLIENT *clntudp_bufcreate();
__BEGIN_DECLS
extern CLIENT *clntudp_create __P((struct sockaddr_in *,
u_long,
u_long,
struct timeval,
int *));
extern CLIENT *clntudp_bufcreate __P((struct sockaddr_in *,
u_long,
u_long,
struct timeval,
int *,
u_int,
u_int));
__END_DECLS
/*
* AF_UNIX based rpc
* CLIENT *
* clntunix_create(raddr, prog, vers, sockp, sendsz, recvsz)
* struct sockaddr_un *raddr;
* u_long prog;
* u_long version;
* register int *sockp;
* u_int sendsz;
* u_int recvsz;
*/
__BEGIN_DECLS
extern CLIENT *clntunix_create __P((struct sockaddr_un *,
u_long,
u_long,
int *,
u_int,
u_int));
__END_DECLS
/*
* Print why creation failed
*/
void clnt_pcreateerror(/* char *msg */); /* stderr */
char *clnt_spcreateerror(/* char *msg */); /* string */
__BEGIN_DECLS
extern void clnt_pcreateerror __P((char *)); /* stderr */
extern char *clnt_spcreateerror __P((char *)); /* string */
__END_DECLS
/*
* Like clnt_perror(), but is more verbose in its output
*/
void clnt_perrno(/* enum clnt_stat num */); /* stderr */
*/
__BEGIN_DECLS
extern void clnt_perrno __P((enum clnt_stat)); /* stderr */
extern char *clnt_sperrno __P((enum clnt_stat)); /* string */
__END_DECLS
/*
* Print an English error message, given the client error code
*/
void clnt_perror(/* CLIENT *clnt, char *msg */); /* stderr */
char *clnt_sperror(/* CLIENT *clnt, char *msg */); /* string */
__BEGIN_DECLS
extern void clnt_perror __P((CLIENT *, char *)); /* stderr */
extern char *clnt_sperror __P((CLIENT *, char *)); /* string */
__END_DECLS
/*
/*
* If a creation fails, the following allows the user to figure out why.
*/
struct rpc_createerr {
@ -317,15 +413,7 @@ struct rpc_createerr {
extern struct rpc_createerr rpc_createerr;
/*
* Copy error message to buffer.
*/
char *clnt_sperrno(/* enum clnt_stat num */); /* string */
#define UDPMSGSIZE 8800 /* rpc imposed limit on udp msg size */
#define RPCSMALLMSGSIZE 400 /* a more reasonable packet size */
#endif /*!_CLNT_*/
#endif /* !_RPC_CLNT_H */

72
include/rpc/des.h Normal file
View File

@ -0,0 +1,72 @@
/* @(#)des.h 2.2 88/08/10 4.0 RPCSRC; from 2.7 88/02/08 SMI */
/*
* 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
*/
/*
* Generic DES driver interface
* Keep this file hardware independent!
* Copyright (c) 1986 by Sun Microsystems, Inc.
*/
#define DES_MAXLEN 65536 /* maximum # of bytes to encrypt */
#define DES_QUICKLEN 16 /* maximum # of bytes to encrypt quickly */
enum desdir { ENCRYPT, DECRYPT };
enum desmode { CBC, ECB };
/*
* parameters to ioctl call
*/
struct desparams {
u_char des_key[8]; /* key (with low bit parity) */
enum desdir des_dir; /* direction */
enum desmode des_mode; /* mode */
u_char des_ivec[8]; /* input vector */
unsigned des_len; /* number of bytes to crypt */
union {
u_char UDES_data[DES_QUICKLEN];
u_char *UDES_buf;
} UDES;
# define des_data UDES.UDES_data /* direct data here if quick */
# define des_buf UDES.UDES_buf /* otherwise, pointer to data */
};
/*
* Encrypt an arbitrary sized buffer
*/
#define DESIOCBLOCK _IOWR(d, 6, struct desparams)
/*
* Encrypt of small amount of data, quickly
*/
#define DESIOCQUICK _IOWR(d, 7, struct desparams)
/*
* Software DES.
*/
extern int _des_crypt __P(( char *, int, struct desparams * ));

119
include/rpc/des_crypt.h Normal file
View File

@ -0,0 +1,119 @@
/*
* @(#)des_crypt.h 2.1 88/08/11 4.0 RPCSRC; from 1.4 88/02/08 (C) 1986 SMI
*
* des_crypt.h, des library routine interface
* Copyright (C) 1986, Sun Microsystems, Inc.
*/
/*
* 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
*/
#include <sys/cdefs.h>
#include <rpc/rpc.h>
#define DES_MAXDATA 8192 /* max bytes encrypted in one call */
#define DES_DIRMASK (1 << 0)
#define DES_ENCRYPT (0*DES_DIRMASK) /* Encrypt */
#define DES_DECRYPT (1*DES_DIRMASK) /* Decrypt */
#define DES_DEVMASK (1 << 1)
#define DES_HW (0*DES_DEVMASK) /* Use hardware device */
#define DES_SW (1*DES_DEVMASK) /* Use software device */
#define DESERR_NONE 0 /* succeeded */
#define DESERR_NOHWDEVICE 1 /* succeeded, but hw device not available */
#define DESERR_HWERROR 2 /* failed, hardware/driver error */
#define DESERR_BADPARAM 3 /* failed, bad parameter to call */
#define DES_FAILED(err) \
((err) > DESERR_NOHWDEVICE)
/*
* cbc_crypt()
* ecb_crypt()
*
* Encrypt (or decrypt) len bytes of a buffer buf.
* The length must be a multiple of eight.
* The key should have odd parity in the low bit of each byte.
* ivec is the input vector, and is updated to the new one (cbc only).
* The mode is created by oring together the appropriate parameters.
* DESERR_NOHWDEVICE is returned if DES_HW was specified but
* there was no hardware to do it on (the data will still be
* encrypted though, in software).
*/
/*
* Cipher Block Chaining mode
*/
__BEGIN_DECLS
#ifdef __STDC__
int cbc_crypt __P(( char *, char *, unsigned int, unsigned int, char *));
#else
cbc_crypt(/* key, buf, len, mode, ivec */); /*
char *key;
char *buf;
unsigned len;
unsigned mode;
char *ivec;
*/
#endif
/*
* Electronic Code Book mode
*/
#ifdef __STDC__
int ecb_crypt __P(( char *, char *, unsigned int, unsigned int ));
#else
ecb_crypt(/* key, buf, len, mode */); /*
char *key;
char *buf;
unsigned len;
unsigned mode;
*/
#endif
__END_DECLS
#ifndef KERNEL
/*
* Set des parity for a key.
* DES parity is odd and in the low bit of each byte
*/
__BEGIN_DECLS
#ifdef __STDC__
void des_setparity __P(( char *));
#else
void
des_setparity(/* key */); /*
char *key;
*/
#endif
__END_DECLS
#endif

261
include/rpc/key_prot.h Normal file
View File

@ -0,0 +1,261 @@
/*
* Please do not edit this file.
* It was generated using rpcgen.
*/
#ifndef _KEY_PROT_H_RPCGEN
#define _KEY_PROT_H_RPCGEN
#include <rpc/rpc.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
* 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
*/
#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!
*/
#define PROOT 3
#define HEXMODULUS "d4a0ba0250b6fd2ec626e7efd637df76c716e22d0944b88b"
#define HEXKEYBYTES 48
#define KEYSIZE 192
#define KEYBYTES 24
#define KEYCHECKSUMSIZE 16
enum keystatus {
KEY_SUCCESS = 0,
KEY_NOSECRET = 1,
KEY_UNKNOWN = 2,
KEY_SYSTEMERR = 3
};
typedef enum keystatus keystatus;
typedef char keybuf[HEXKEYBYTES];
typedef char *netnamestr;
struct cryptkeyarg {
netnamestr remotename;
des_block deskey;
};
typedef struct cryptkeyarg cryptkeyarg;
struct cryptkeyarg2 {
netnamestr remotename;
netobj remotekey;
des_block deskey;
};
typedef struct cryptkeyarg2 cryptkeyarg2;
struct cryptkeyres {
keystatus status;
union {
des_block deskey;
} cryptkeyres_u;
};
typedef struct cryptkeyres cryptkeyres;
#define MAXGIDS 16
struct unixcred {
u_int uid;
u_int gid;
struct {
u_int gids_len;
u_int *gids_val;
} gids;
};
typedef struct unixcred unixcred;
struct getcredres {
keystatus status;
union {
unixcred cred;
} getcredres_u;
};
typedef struct getcredres getcredres;
struct key_netstarg {
keybuf st_priv_key;
keybuf st_pub_key;
netnamestr st_netname;
};
typedef struct key_netstarg key_netstarg;
struct key_netstres {
keystatus status;
union {
key_netstarg knet;
} key_netstres_u;
};
typedef struct key_netstres key_netstres;
#ifndef opaque
#define opaque char
#endif
#define KEY_PROG ((unsigned long)(100029))
#define KEY_VERS ((unsigned long)(1))
#if defined(__STDC__) || defined(__cplusplus)
#define KEY_SET ((unsigned long)(1))
extern keystatus * key_set_1(char *, CLIENT *);
extern keystatus * key_set_1_svc(char *, struct svc_req *);
#define KEY_ENCRYPT ((unsigned long)(2))
extern cryptkeyres * key_encrypt_1(cryptkeyarg *, CLIENT *);
extern cryptkeyres * key_encrypt_1_svc(cryptkeyarg *, struct svc_req *);
#define KEY_DECRYPT ((unsigned long)(3))
extern cryptkeyres * key_decrypt_1(cryptkeyarg *, CLIENT *);
extern cryptkeyres * key_decrypt_1_svc(cryptkeyarg *, struct svc_req *);
#define KEY_GEN ((unsigned long)(4))
extern des_block * key_gen_1(void *, CLIENT *);
extern des_block * key_gen_1_svc(void *, struct svc_req *);
#define KEY_GETCRED ((unsigned long)(5))
extern getcredres * key_getcred_1(netnamestr *, CLIENT *);
extern getcredres * key_getcred_1_svc(netnamestr *, struct svc_req *);
extern int key_prog_1_freeresult(SVCXPRT *, xdrproc_t, caddr_t);
#else /* K&R C */
#define KEY_SET ((unsigned long)(1))
extern keystatus * key_set_1();
extern keystatus * key_set_1_svc();
#define KEY_ENCRYPT ((unsigned long)(2))
extern cryptkeyres * key_encrypt_1();
extern cryptkeyres * key_encrypt_1_svc();
#define KEY_DECRYPT ((unsigned long)(3))
extern cryptkeyres * key_decrypt_1();
extern cryptkeyres * key_decrypt_1_svc();
#define KEY_GEN ((unsigned long)(4))
extern des_block * key_gen_1();
extern des_block * key_gen_1_svc();
#define KEY_GETCRED ((unsigned long)(5))
extern getcredres * key_getcred_1();
extern getcredres * key_getcred_1_svc();
extern int key_prog_1_freeresult();
#endif /* K&R C */
#define KEY_VERS2 ((unsigned long)(2))
#if defined(__STDC__) || defined(__cplusplus)
extern keystatus * key_set_2(char *, CLIENT *);
extern keystatus * key_set_2_svc(char *, struct svc_req *);
extern cryptkeyres * key_encrypt_2(cryptkeyarg *, CLIENT *);
extern cryptkeyres * key_encrypt_2_svc(cryptkeyarg *, struct svc_req *);
extern cryptkeyres * key_decrypt_2(cryptkeyarg *, CLIENT *);
extern cryptkeyres * key_decrypt_2_svc(cryptkeyarg *, struct svc_req *);
extern des_block * key_gen_2(void *, CLIENT *);
extern des_block * key_gen_2_svc(void *, struct svc_req *);
extern getcredres * key_getcred_2(netnamestr *, CLIENT *);
extern getcredres * key_getcred_2_svc(netnamestr *, struct svc_req *);
#define KEY_ENCRYPT_PK ((unsigned long)(6))
extern cryptkeyres * key_encrypt_pk_2(cryptkeyarg2 *, CLIENT *);
extern cryptkeyres * key_encrypt_pk_2_svc(cryptkeyarg2 *, struct svc_req *);
#define KEY_DECRYPT_PK ((unsigned long)(7))
extern cryptkeyres * key_decrypt_pk_2(cryptkeyarg2 *, CLIENT *);
extern cryptkeyres * key_decrypt_pk_2_svc(cryptkeyarg2 *, struct svc_req *);
#define KEY_NET_PUT ((unsigned long)(8))
extern keystatus * key_net_put_2(key_netstarg *, CLIENT *);
extern keystatus * key_net_put_2_svc(key_netstarg *, struct svc_req *);
#define KEY_NET_GET ((unsigned long)(9))
extern key_netstres * key_net_get_2(void *, CLIENT *);
extern key_netstres * key_net_get_2_svc(void *, struct svc_req *);
#define KEY_GET_CONV ((unsigned long)(10))
extern cryptkeyres * key_get_conv_2(char *, CLIENT *);
extern cryptkeyres * key_get_conv_2_svc(char *, struct svc_req *);
extern int key_prog_2_freeresult(SVCXPRT *, xdrproc_t, caddr_t);
#else /* K&R C */
extern keystatus * key_set_2();
extern keystatus * key_set_2_svc();
extern cryptkeyres * key_encrypt_2();
extern cryptkeyres * key_encrypt_2_svc();
extern cryptkeyres * key_decrypt_2();
extern cryptkeyres * key_decrypt_2_svc();
extern des_block * key_gen_2();
extern des_block * key_gen_2_svc();
extern getcredres * key_getcred_2();
extern getcredres * key_getcred_2_svc();
#define KEY_ENCRYPT_PK ((unsigned long)(6))
extern cryptkeyres * key_encrypt_pk_2();
extern cryptkeyres * key_encrypt_pk_2_svc();
#define KEY_DECRYPT_PK ((unsigned long)(7))
extern cryptkeyres * key_decrypt_pk_2();
extern cryptkeyres * key_decrypt_pk_2_svc();
#define KEY_NET_PUT ((unsigned long)(8))
extern keystatus * key_net_put_2();
extern keystatus * key_net_put_2_svc();
#define KEY_NET_GET ((unsigned long)(9))
extern key_netstres * key_net_get_2();
extern key_netstres * key_net_get_2_svc();
#define KEY_GET_CONV ((unsigned long)(10))
extern cryptkeyres * key_get_conv_2();
extern cryptkeyres * key_get_conv_2_svc();
extern int key_prog_2_freeresult();
#endif /* K&R C */
/* the xdr functions */
#if defined(__STDC__) || defined(__cplusplus)
extern bool_t xdr_keystatus(XDR *, keystatus*);
extern bool_t xdr_keybuf(XDR *, keybuf);
extern bool_t xdr_netnamestr(XDR *, netnamestr*);
extern bool_t xdr_cryptkeyarg(XDR *, cryptkeyarg*);
extern bool_t xdr_cryptkeyarg2(XDR *, cryptkeyarg2*);
extern bool_t xdr_cryptkeyres(XDR *, cryptkeyres*);
extern bool_t xdr_unixcred(XDR *, unixcred*);
extern bool_t xdr_getcredres(XDR *, getcredres*);
extern bool_t xdr_key_netstarg(XDR *, key_netstarg*);
extern bool_t xdr_key_netstres(XDR *, key_netstres*);
#else /* K&R C */
extern bool_t xdr_keystatus();
extern bool_t xdr_keybuf();
extern bool_t xdr_netnamestr();
extern bool_t xdr_cryptkeyarg();
extern bool_t xdr_cryptkeyarg2();
extern bool_t xdr_cryptkeyres();
extern bool_t xdr_unixcred();
extern bool_t xdr_getcredres();
extern bool_t xdr_key_netstarg();
extern bool_t xdr_key_netstres();
#endif /* K&R C */
#ifdef __cplusplus
}
#endif
#endif /* !_KEY_PROT_H_RPCGEN */

View File

@ -1,4 +1,3 @@
/* @(#)pmap_clnt.h 2.1 88/07/29 4.0 RPCSRC; from 1.11 88/02/08 SMI */
/*
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
* unrestricted use provided that this legend is included on all tape
@ -6,26 +5,30 @@
* 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
* WARRANTIES OF DESIGN, MERCHANTABILITY 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
*
* from: @(#)pmap_clnt.h 1.11 88/02/08 SMI
* from: @(#)pmap_clnt.h 2.1 88/07/29 4.0 RPCSRC
* $Id: pmap_clnt.h,v 1.5 1996/12/30 13:59:38 peter Exp $
*/
/*
@ -43,7 +46,7 @@
* head = pmap_getmaps(address);
* clnt_stat = pmap_rmtcall(address, program, version, procedure,
* xdrargs, argsp, xdrres, resp, tout, port_ptr)
* (works for udp only.)
* (works for udp only.)
* clnt_stat = clnt_broadcast(program, version, procedure,
* xdrargs, argsp, xdrres, resp, eachresult)
* (like pmap_rmtcall, except the call is broadcasted to all
@ -57,9 +60,26 @@
* address if the responder to the broadcast.
*/
extern bool_t pmap_set();
extern bool_t pmap_unset();
extern struct pmaplist *pmap_getmaps();
enum clnt_stat pmap_rmtcall();
enum clnt_stat clnt_broadcast();
extern u_short pmap_getport();
#ifndef _RPC_PMAPCLNT_H
#define _RPC_PMAPCLNT_H
#include <sys/cdefs.h>
__BEGIN_DECLS
extern bool_t pmap_set __P((u_long, u_long, int, int));
extern bool_t pmap_unset __P((u_long, u_long));
extern struct pmaplist *pmap_getmaps __P((struct sockaddr_in *));
extern enum clnt_stat pmap_rmtcall __P((struct sockaddr_in *,
u_long, u_long, u_long,
xdrproc_t, caddr_t,
xdrproc_t, caddr_t,
struct timeval, u_long *));
extern enum clnt_stat clnt_broadcast __P((u_long, u_long, u_long,
xdrproc_t, char *,
xdrproc_t, char *,
bool_t (*) __P((caddr_t,
struct sockaddr_in *))));
extern u_short pmap_getport __P((struct sockaddr_in *,
u_long, u_long, u_int));
__END_DECLS
#endif /* !_RPC_PMAPCLNT_H */

View File

@ -1,4 +1,3 @@
/* @(#)pmap_prot.h 2.1 88/07/29 4.0 RPCSRC; from 1.14 88/02/08 SMI */
/*
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
* unrestricted use provided that this legend is included on all tape
@ -6,26 +5,30 @@
* 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
* WARRANTIES OF DESIGN, MERCHANTABILITY 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
*
* from: @(#)pmap_prot.h 1.14 88/02/08 SMI
* from: @(#)pmap_prot.h 2.1 88/07/29 4.0 RPCSRC
* $Id: pmap_prot.h,v 1.4 1996/01/30 23:32:08 mpp Exp $
*/
/*
@ -65,6 +68,10 @@
* The service supports remote procedure calls on udp/ip or tcp/ip socket 111.
*/
#ifndef _RPC_PMAPPROT_H
#define _RPC_PMAPPROT_H
#include <sys/cdefs.h>
#define PMAPPORT ((u_short)111)
#define PMAPPROG ((u_long)100000)
#define PMAPVERS ((u_long)2)
@ -84,11 +91,14 @@ struct pmap {
long unsigned pm_port;
};
extern bool_t xdr_pmap();
struct pmaplist {
struct pmap pml_map;
struct pmaplist *pml_next;
};
extern bool_t xdr_pmaplist();
__BEGIN_DECLS
extern bool_t xdr_pmap __P((XDR *, struct pmap *));
extern bool_t xdr_pmaplist __P((XDR *, struct pmaplist **));
__END_DECLS
#endif /* !_RPC_PMAPPROT_H */

View File

@ -1,4 +1,3 @@
/* @(#)pmap_rmt.h 2.1 88/07/29 4.0 RPCSRC; from 1.2 88/02/08 SMI */
/*
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
* unrestricted use provided that this legend is included on all tape
@ -6,26 +5,30 @@
* 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
* WARRANTIES OF DESIGN, MERCHANTABILITY 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
*
* from: @(#)pmap_rmt.h 1.2 88/02/08 SMI
* from: @(#)pmap_rmt.h 2.1 88/07/29 4.0 RPCSRC
* $Id: pmap_rmt.h,v 1.4 1996/01/30 23:32:12 mpp Exp $
*/
/*
@ -35,14 +38,16 @@
* Copyright (C) 1986, Sun Microsystems, Inc.
*/
#ifndef _RPC_PMAPRMT_H
#define _RPC_PMAPRMT_H
#include <sys/cdefs.h>
struct rmtcallargs {
u_long prog, vers, proc, arglen;
caddr_t args_ptr;
xdrproc_t xdr_args;
};
bool_t xdr_rmtcall_args();
struct rmtcallres {
u_long *port_ptr;
u_long resultslen;
@ -50,4 +55,9 @@ struct rmtcallres {
xdrproc_t xdr_results;
};
bool_t xdr_rmtcallres();
__BEGIN_DECLS
extern bool_t xdr_rmtcall_args __P((XDR *, struct rmtcallargs *));
extern bool_t xdr_rmtcallres __P((XDR *, struct rmtcallres *));
__END_DECLS
#endif /* !_RPC_PMAPRMT_H */

View File

@ -1,4 +1,3 @@
/* @(#)rpc.h 2.4 89/07/11 4.0 RPCSRC; from 1.9 88/02/08 SMI */
/*
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
* unrestricted use provided that this legend is included on all tape
@ -6,11 +5,11 @@
* 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
* WARRANTIES OF DESIGN, MERCHANTABILITY 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.
@ -26,6 +25,10 @@
* Sun Microsystems, Inc.
* 2550 Garcia Avenue
* Mountain View, California 94043
*
* from: @(#)rpc.h 1.9 88/02/08 SMI
* from: @(#)rpc.h 2.4 89/07/11 4.0 RPCSRC
* $Id: rpc.h,v 1.6 1996/12/30 13:59:39 peter Exp $
*/
/*
@ -34,8 +37,8 @@
*
* Copyright (C) 1984, Sun Microsystems, Inc.
*/
#ifndef __RPC_HEADER__
#define __RPC_HEADER__
#ifndef _RPC_RPC_H
#define _RPC_RPC_H
#include <rpc/types.h> /* some typedefs */
#include <netinet/in.h>
@ -53,10 +56,10 @@
#include <rpc/rpc_msg.h> /* protocol for rpc messages */
#include <rpc/auth_unix.h> /* protocol for unix style cred */
/*
* Uncomment-out the next line if you are building the rpc library with
* Uncomment-out the next line if you are building the rpc library with
* DES Authentication (see the README file in the secure_rpc/ directory).
*/
/*#include <rpc/auth_des.h> * protocol for des style cred */
#include <rpc/auth_des.h> /* protocol for des style cred */
/* Server side only remote procedure callee */
#include <rpc/svc.h> /* service manager and multiplexer */
@ -75,6 +78,16 @@ struct rpcent {
int r_number; /* rpc program number */
};
struct rpcent *getrpcbyname(), *getrpcbynumber(), *getrpcent();
__BEGIN_DECLS
extern struct rpcent *getrpcbyname __P((char *));
extern struct rpcent *getrpcbynumber __P((int));
extern struct rpcent *getrpcent __P((void));
extern int getrpcport __P((char *host, int prognum, int versnum, int proto));
extern void setrpcent __P((int));
extern void endrpcent __P((void));
#endif /* ndef __RPC_HEADER__ */
extern int bindresvport __P((int, struct sockaddr_in *));
extern int get_myaddress __P((struct sockaddr_in *));
__END_DECLS
#endif /* !_RPC_RPC_H */

78
include/rpc/rpc_com.h Normal file
View File

@ -0,0 +1,78 @@
/*
* 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) 1986 - 1991 by Sun Microsystems, Inc.
*/
/*
* rpc_com.h, Common definitions for both the server and client side.
* All for the topmost layer of rpc
*
*/
#ifndef _RPC_RPCCOM_H
#define _RPC_RPCCOM_H
#pragma ident "@(#)rpc_com.h 1.11 93/07/05 SMI"
#ifdef __cplusplus
extern "C" {
#endif
/*
* File descriptor to be used on xxx_create calls to get default descriptor
*/
#define RPC_ANYSOCK -1
#define RPC_ANYFD RPC_ANYSOCK
/*
* The max size of the transport, if the size cannot be determined
* by other means.
*/
#define RPC_MAXDATASIZE 9000
#define RPC_MAXADDRSIZE 1024
#if defined(__STDC__) || defined(__cplusplus)
extern u_int __rpc_get_t_size (int, long);
extern u_int __rpc_get_a_size (long);
extern int __rpc_dtbsize (void);
extern int _rpc_dtablesize (void);
extern int _rpc_get_default_domain(char **);
#else
extern u_int __rpc_get_t_size ();
extern u_int __rpc_get_a_size ();
extern int __rpc_dtbsize ();
extern int _rpc_dtablesize ();
extern int _rpc_get_default_domain();
#endif
#ifdef __cplusplus
}
#endif
#endif /* _RPC_RPCCOM_H */

View File

@ -1,4 +1,3 @@
/* @(#)rpc_msg.h 2.1 88/07/29 4.0 RPCSRC */
/*
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
* unrestricted use provided that this legend is included on all tape
@ -6,28 +5,31 @@
* 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
* WARRANTIES OF DESIGN, MERCHANTABILITY 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
*
* from: @(#)rpc_msg.h 1.7 86/07/16 SMI
* from: @(#)rpc_msg.h 2.1 88/07/29 4.0 RPCSRC
* $Id: rpc_msg.h,v 1.6 1996/12/30 13:59:39 peter Exp $
*/
/* @(#)rpc_msg.h 1.7 86/07/16 SMI */
/*
* rpc_msg.h
@ -36,6 +38,9 @@
* Copyright (C) 1984, Sun Microsystems, Inc.
*/
#ifndef _RPC_RPCMSG_H
#define _RPC_RPCMSG_H
#define RPC_MSG_VERSION ((u_long) 2)
#define RPC_SERVICE_PORT ((u_short) 2048)
@ -83,8 +88,8 @@ struct accepted_reply {
enum accept_stat ar_stat;
union {
struct {
u_long low;
u_long high;
u_int32_t low;
u_int32_t high;
} AR_versions;
struct {
caddr_t where;
@ -103,8 +108,8 @@ struct rejected_reply {
enum reject_stat rj_stat;
union {
struct {
u_long low;
u_long high;
u_int32_t low;
u_int32_t high;
} RJ_versions;
enum auth_stat RJ_why; /* why authentication did not work */
} ru;
@ -129,10 +134,10 @@ struct reply_body {
* Body of an rpc request call.
*/
struct call_body {
u_long cb_rpcvers; /* must be equal to two */
u_long cb_prog;
u_long cb_vers;
u_long cb_proc;
u_int32_t cb_rpcvers; /* must be equal to two */
u_int32_t cb_prog;
u_int32_t cb_vers;
u_int32_t cb_proc;
struct opaque_auth cb_cred;
struct opaque_auth cb_verf; /* protocol specific - provided by client */
};
@ -141,7 +146,7 @@ struct call_body {
* The rpc message
*/
struct rpc_msg {
u_long rm_xid;
u_int32_t rm_xid;
enum msg_type rm_direction;
union {
struct call_body RM_cmb;
@ -153,14 +158,14 @@ struct rpc_msg {
#define acpted_rply ru.RM_rmb.ru.RP_ar
#define rjcted_rply ru.RM_rmb.ru.RP_dr
__BEGIN_DECLS
/*
* XDR routine to handle a rpc message.
* xdr_callmsg(xdrs, cmsg)
* XDR *xdrs;
* struct rpc_msg *cmsg;
*/
extern bool_t xdr_callmsg();
extern bool_t xdr_callmsg __P((XDR *, struct rpc_msg *));
/*
* XDR routine to pre-serialize the static part of a rpc message.
@ -168,7 +173,7 @@ extern bool_t xdr_callmsg();
* XDR *xdrs;
* struct rpc_msg *cmsg;
*/
extern bool_t xdr_callhdr();
extern bool_t xdr_callhdr __P((XDR *, struct rpc_msg *));
/*
* XDR routine to handle a rpc reply.
@ -176,7 +181,7 @@ extern bool_t xdr_callhdr();
* XDR *xdrs;
* struct rpc_msg *rmsg;
*/
extern bool_t xdr_replymsg();
extern bool_t xdr_replymsg __P((XDR *, struct rpc_msg *));
/*
* Fills in the error part of a reply message.
@ -184,4 +189,8 @@ extern bool_t xdr_replymsg();
* struct rpc_msg *msg;
* struct rpc_err *error;
*/
extern void _seterr_reply();
struct rpc_err;
extern void _seterr_reply __P((struct rpc_msg *, struct rpc_err *));
__END_DECLS
#endif /* !_RPC_RPCMSG_H */

View File

@ -1,4 +1,3 @@
/* @(#)svc.h 2.2 88/07/29 4.0 RPCSRC; from 1.20 88/02/08 SMI */
/*
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
* unrestricted use provided that this legend is included on all tape
@ -6,26 +5,30 @@
* 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
* WARRANTIES OF DESIGN, MERCHANTABILITY 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
*
* from: @(#)svc.h 1.20 88/02/08 SMI
* from: @(#)svc.h 2.2 88/07/29 4.0 RPCSRC
* $Id: svc.h,v 1.6 1996/12/30 13:59:40 peter Exp $
*/
/*
@ -34,8 +37,9 @@
* Copyright (C) 1984, Sun Microsystems, Inc.
*/
#ifndef __SVC_HEADER__
#define __SVC_HEADER__
#ifndef _RPC_SVC_H
#define _RPC_SVC_H
#include <sys/cdefs.h>
/*
* This interface must manage two items concerning remote procedure calling:
@ -68,16 +72,26 @@ enum xprt_stat {
/*
* Server side transport handle
*/
typedef struct {
typedef struct __rpc_svcxprt {
int xp_sock;
u_short xp_port; /* associated port number */
struct xp_ops {
bool_t (*xp_recv)(); /* receive incomming requests */
enum xprt_stat (*xp_stat)(); /* get transport status */
bool_t (*xp_getargs)(); /* get arguments */
bool_t (*xp_reply)(); /* send reply */
bool_t (*xp_freeargs)();/* free mem allocated for args */
void (*xp_destroy)(); /* destroy this struct */
/* receive incoming requests */
bool_t (*xp_recv) __P((struct __rpc_svcxprt *,
struct rpc_msg *));
/* get transport status */
enum xprt_stat (*xp_stat) __P((struct __rpc_svcxprt *));
/* get arguments */
bool_t (*xp_getargs) __P((struct __rpc_svcxprt *, xdrproc_t,
caddr_t));
/* send reply */
bool_t (*xp_reply) __P((struct __rpc_svcxprt *,
struct rpc_msg *));
/* free mem allocated for args */
bool_t (*xp_freeargs) __P((struct __rpc_svcxprt *, xdrproc_t,
caddr_t));
/* destroy this struct */
void (*xp_destroy) __P((struct __rpc_svcxprt *));
} *xp_ops;
int xp_addrlen; /* length of remote address */
struct sockaddr_in xp_raddr; /* remote address */
@ -134,9 +148,9 @@ typedef struct {
* Service request
*/
struct svc_req {
u_long rq_prog; /* service program number */
u_long rq_vers; /* service protocol version */
u_long rq_proc; /* the desired procedure */
u_int32_t rq_prog; /* service program number */
u_int32_t rq_vers; /* service protocol version */
u_int32_t rq_proc; /* the desired procedure */
struct opaque_auth rq_cred; /* raw creds from the wire */
caddr_t rq_clntcred; /* read only cooked cred */
SVCXPRT *rq_xprt; /* associated transport */
@ -151,9 +165,12 @@ struct svc_req {
* u_long prog;
* u_long vers;
* void (*dispatch)();
* int protocol; (like TCP or UDP, zero means do not register)
* int protocol; (like TCP or UDP, zero means do not register)
*/
extern bool_t svc_register();
__BEGIN_DECLS
extern bool_t svc_register __P((SVCXPRT *, u_long, u_long,
void (*) __P((struct svc_req *, SVCXPRT *)), int));
__END_DECLS
/*
* Service un-registration
@ -162,7 +179,9 @@ extern bool_t svc_register();
* u_long prog;
* u_long vers;
*/
extern void svc_unregister();
__BEGIN_DECLS
extern void svc_unregister __P((u_long, u_long));
__END_DECLS
/*
* Transport registration.
@ -170,7 +189,9 @@ extern void svc_unregister();
* xprt_register(xprt)
* SVCXPRT *xprt;
*/
extern void xprt_register();
__BEGIN_DECLS
extern void xprt_register __P((SVCXPRT *));
__END_DECLS
/*
* Transport un-register
@ -178,7 +199,9 @@ extern void xprt_register();
* xprt_unregister(xprt)
* SVCXPRT *xprt;
*/
extern void xprt_unregister();
__BEGIN_DECLS
extern void xprt_unregister __P((SVCXPRT *));
__END_DECLS
@ -186,7 +209,7 @@ extern void xprt_unregister();
/*
* When the service routine is called, it must first check to see if it
* knows about the procedure; if not, it should call svcerr_noproc
* and return. If so, it should deserialize its arguments via
* and return. If so, it should deserialize its arguments via
* SVC_GETARGS (defined above). If the deserialization does not work,
* svcerr_decode should be called followed by a return. Successful
* decoding of the arguments should be followed the execution of the
@ -197,7 +220,7 @@ extern void xprt_unregister();
* Note: do not confuse access-control failure with weak authentication!
*
* NB: In pure implementations of rpc, the caller always waits for a reply
* msg. This message is sent when svc_sendreply is called.
* msg. This message is sent when svc_sendreply is called.
* Therefore pure service implementations should always call
* svc_sendreply even if the function logically returns void; use
* xdr.h - xdr_void for the xdr routine. HOWEVER, tcp based rpc allows
@ -209,15 +232,17 @@ extern void xprt_unregister();
* deadlock the caller and server processes!
*/
extern bool_t svc_sendreply();
extern void svcerr_decode();
extern void svcerr_weakauth();
extern void svcerr_noproc();
extern void svcerr_progvers();
extern void svcerr_auth();
extern void svcerr_noprog();
extern void svcerr_systemerr();
__BEGIN_DECLS
extern bool_t svc_sendreply __P((SVCXPRT *, xdrproc_t, char *));
extern void svcerr_decode __P((SVCXPRT *));
extern void svcerr_weakauth __P((SVCXPRT *));
extern void svcerr_noproc __P((SVCXPRT *));
extern void svcerr_progvers __P((SVCXPRT *, u_long, u_long));
extern void svcerr_auth __P((SVCXPRT *, enum auth_stat));
extern void svcerr_noprog __P((SVCXPRT *));
extern void svcerr_systemerr __P((SVCXPRT *));
__END_DECLS
/*
* Lowest level dispatching -OR- who owns this process anyway.
* Somebody has to wait for incoming requests and then call the correct
@ -231,14 +256,11 @@ extern void svcerr_systemerr();
/*
* Global keeper of rpc service descriptors in use
* dynamic; must be inspected before each call to select
* dynamic; must be inspected before each call to select
*/
#ifdef FD_SETSIZE
extern int svc_maxfd;
extern fd_set svc_fdset;
#define svc_fds svc_fdset.fds_bits[0] /* compatibility */
#else
extern int svc_fds;
#endif /* def FD_SETSIZE */
/*
* a small program implemented by the svc_rpc implementation itself;
@ -246,9 +268,12 @@ extern int svc_fds;
*/
extern void rpctest_service();
extern void svc_getreq();
extern void svc_getreqset(); /* takes fdset instead of int */
extern void svc_run(); /* never returns */
__BEGIN_DECLS
extern void svc_getreq __P((int));
extern void svc_getreqset __P((fd_set *));
extern void svc_getreqset2 __P((fd_set *, int)); /* XXX: nonstd, undoc */
extern void svc_run __P((void));
__END_DECLS
/*
* Socket to use on svcxxx_create call to get default socket
@ -262,19 +287,34 @@ extern void svc_run(); /* never returns */
/*
* Memory based rpc for testing and timing.
*/
extern SVCXPRT *svcraw_create();
__BEGIN_DECLS
extern SVCXPRT *svcraw_create __P((void));
__END_DECLS
/*
* Udp based rpc.
*/
extern SVCXPRT *svcudp_create();
extern SVCXPRT *svcudp_bufcreate();
__BEGIN_DECLS
extern SVCXPRT *svcudp_create __P((int));
extern SVCXPRT *svcudp_bufcreate __P((int, u_int, u_int));
__END_DECLS
/*
* Tcp based rpc.
*/
extern SVCXPRT *svctcp_create();
__BEGIN_DECLS
extern SVCXPRT *svctcp_create __P((int, u_int, u_int));
extern SVCXPRT *svcfd_create __P((int, u_int, u_int));
__END_DECLS
/*
* AF_UNIX socket based rpc.
*/
__BEGIN_DECLS
extern SVCXPRT *svcunix_create __P((int, u_int, u_int, char *));
extern SVCXPRT *svcunixfd_create __P((int, u_int, u_int));
__END_DECLS
#endif !__SVC_HEADER__
#endif /* !_RPC_SVC_H */

View File

@ -1,4 +1,3 @@
/* @(#)svc_auth.h 2.1 88/07/29 4.0 RPCSRC */
/*
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
* unrestricted use provided that this legend is included on all tape
@ -6,37 +5,48 @@
* 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
* WARRANTIES OF DESIGN, MERCHANTABILITY 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
*
* from: @(#)svc_auth.h 1.6 86/07/16 SMI
* from: @(#)svc_auth.h 2.1 88/07/29 4.0 RPCSRC
* $Id: svc_auth.h,v 1.4 1996/01/30 23:32:36 mpp Exp $
*/
/* @(#)svc_auth.h 1.6 86/07/16 SMI */
/*
* svc_auth.h, Service side of rpc authentication.
*
*
* Copyright (C) 1984, Sun Microsystems, Inc.
*/
#ifndef _RPC_SVCAUTH_H
#define _RPC_SVCAUTH_H
/*
* Server side authenticator
*/
extern enum auth_stat _authenticate();
__BEGIN_DECLS
extern enum auth_stat _authenticate __P((struct svc_req *, struct rpc_msg *));
extern int svc_auth_reg __P(( register int, enum auth_stat (*)() ));
extern enum auth_stat _svcauth_des __P(( struct svc_req *, struct rpc_msg * ));
__END_DECLS
#endif /* !_RPC_SVCAUTH_H */

View File

@ -1,4 +1,3 @@
/* @(#)types.h 2.3 88/08/15 4.0 RPCSRC */
/*
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
* unrestricted use provided that this legend is included on all tape
@ -6,45 +5,52 @@
* 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
* WARRANTIES OF DESIGN, MERCHANTABILITY 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
*
* from: @(#)types.h 1.18 87/07/24 SMI
* from: @(#)types.h 2.3 88/08/15 4.0 RPCSRC
* $Id: types.h,v 1.5 1996/12/30 13:59:40 peter Exp $
*/
/* @(#)types.h 1.18 87/07/24 SMI */
/*
* Rpc additions to <sys/types.h>
*/
#ifndef __TYPES_RPC_HEADER__
#define __TYPES_RPC_HEADER__
#ifndef _RPC_TYPES_H
#define _RPC_TYPES_H
#define bool_t int
#define enum_t int
#define FALSE (0)
#define TRUE (1)
#define bool_t int32_t
#define enum_t int32_t
#define __dontcare__ -1
#ifndef FALSE
# define FALSE (0)
#endif
#ifndef TRUE
# define TRUE (1)
#endif
#ifndef NULL
# define NULL 0
# define NULL 0
#endif
void *malloc();
#define mem_alloc(bsize) malloc(bsize)
#define mem_free(ptr, bsize) free(ptr)
@ -53,11 +59,4 @@ void *malloc();
#endif
#include <sys/time.h>
#ifndef INADDR_LOOPBACK
#define INADDR_LOOPBACK (u_long)0x7F000001
#endif
#ifndef MAXHOSTNAMELEN
#define MAXHOSTNAMELEN 64
#endif
#endif /* ndef __TYPES_RPC_HEADER__ */
#endif /* !_RPC_TYPES_H */

View File

@ -1,4 +1,3 @@
/* @(#)xdr.h 2.2 88/07/29 4.0 RPCSRC */
/*
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
* unrestricted use provided that this legend is included on all tape
@ -6,28 +5,31 @@
* 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
* WARRANTIES OF DESIGN, MERCHANTABILITY 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
*
* from: @(#)xdr.h 1.19 87/04/22 SMI
* from: @(#)xdr.h 2.2 88/07/29 4.0 RPCSRC
* $Id: xdr.h,v 1.5 1996/12/30 13:59:41 peter Exp $
*/
/* @(#)xdr.h 1.19 87/04/22 SMI */
/*
* xdr.h, External Data Representation Serialization Routines.
@ -35,8 +37,9 @@
* Copyright (C) 1984, Sun Microsystems, Inc.
*/
#ifndef __XDR_HEADER__
#define __XDR_HEADER__
#ifndef _RPC_XDR_H
#define _RPC_XDR_H
#include <sys/cdefs.h>
/*
* XDR provides a conventional way for converting between C data
@ -86,34 +89,31 @@ enum xdr_op {
#define RNDUP(x) ((((x) + BYTES_PER_XDR_UNIT - 1) / BYTES_PER_XDR_UNIT) \
* BYTES_PER_XDR_UNIT)
/*
* A xdrproc_t exists for each data type which is to be encoded or decoded.
*
* The second argument to the xdrproc_t is a pointer to an opaque pointer.
* The opaque pointer generally points to a structure of the data type
* to be decoded. If this pointer is 0, then the type routines should
* allocate dynamic storage of the appropriate size and return it.
* bool_t (*xdrproc_t)(XDR *, caddr_t *);
*/
typedef bool_t (*xdrproc_t)();
/*
* The XDR handle.
* Contains operation which is being applied to the stream,
* an operations vector for the paticular implementation (e.g. see xdr_mem.c),
* and two private fields for the use of the particular impelementation.
* an operations vector for the particular implementation (e.g. see xdr_mem.c),
* and two private fields for the use of the particular implementation.
*/
typedef struct {
typedef struct __rpc_xdr {
enum xdr_op x_op; /* operation; fast additional param */
struct xdr_ops {
bool_t (*x_getlong)(); /* get a long from underlying stream */
bool_t (*x_putlong)(); /* put a long to " */
bool_t (*x_getbytes)();/* get some bytes from " */
bool_t (*x_putbytes)();/* put some bytes to " */
u_int (*x_getpostn)();/* returns bytes off from beginning */
bool_t (*x_setpostn)();/* lets you reposition the stream */
long * (*x_inline)(); /* buf quick ptr to buffered data */
void (*x_destroy)(); /* free privates of this xdr_stream */
/* get a long from underlying stream */
bool_t (*x_getlong) __P((struct __rpc_xdr *, long *));
/* put a long to underlying stream */
bool_t (*x_putlong) __P((struct __rpc_xdr *, long *));
/* get some bytes from underlying stream */
bool_t (*x_getbytes) __P((struct __rpc_xdr *, caddr_t, u_int));
/* put some bytes to underlying stream */
bool_t (*x_putbytes) __P((struct __rpc_xdr *, caddr_t, u_int));
/* returns bytes off from beginning */
u_int (*x_getpostn) __P((struct __rpc_xdr *));
/* lets you reposition the stream */
bool_t (*x_setpostn) __P((struct __rpc_xdr *, u_int));
/* buf quick ptr to buffered data */
int32_t *(*x_inline) __P((struct __rpc_xdr *, u_int));
/* free privates of this xdr_stream */
void (*x_destroy) __P((struct __rpc_xdr *));
} *x_ops;
caddr_t x_public; /* users' data */
caddr_t x_private; /* pointer to private data */
@ -121,6 +121,18 @@ typedef struct {
int x_handy; /* extra private word */
} XDR;
/*
* A xdrproc_t exists for each data type which is to be encoded or decoded.
*
* The second argument to the xdrproc_t is a pointer to an opaque pointer.
* The opaque pointer generally points to a structure of the data type
* to be decoded. If this pointer is 0, then the type routines should
* allocate dynamic storage of the appropriate size and return it.
*
* XXX can't actually prototype it, because some take three args!!!
*/
typedef bool_t (*xdrproc_t) __P((/* XDR *, void *, u_int */));
/*
* Operations defined on a XDR handle
*
@ -189,7 +201,7 @@ struct xdr_discrim {
};
/*
* In-line routines for fast encode/decode of primitve data types.
* In-line routines for fast encode/decode of primitive data types.
* Caveat emptor: these use single memory cycles to get the
* data from the underlying buffer, and will fail to operate
* properly if the data is not aligned. The standard way to use these
@ -221,50 +233,75 @@ struct xdr_discrim {
/*
* These are the "generic" xdr routines.
*/
extern bool_t xdr_void();
extern bool_t xdr_int();
extern bool_t xdr_u_int();
extern bool_t xdr_long();
extern bool_t xdr_u_long();
extern bool_t xdr_short();
extern bool_t xdr_u_short();
extern bool_t xdr_bool();
extern bool_t xdr_enum();
extern bool_t xdr_array();
extern bool_t xdr_bytes();
extern bool_t xdr_opaque();
extern bool_t xdr_string();
extern bool_t xdr_union();
extern bool_t xdr_char();
extern bool_t xdr_u_char();
extern bool_t xdr_vector();
extern bool_t xdr_float();
extern bool_t xdr_double();
extern bool_t xdr_reference();
extern bool_t xdr_pointer();
extern bool_t xdr_wrapstring();
__BEGIN_DECLS
extern bool_t xdr_void __P((void));
extern bool_t xdr_int __P((XDR *, int *));
extern bool_t xdr_u_int __P((XDR *, u_int *));
extern bool_t xdr_long __P((XDR *, long *));
extern bool_t xdr_u_long __P((XDR *, u_long *));
extern bool_t xdr_short __P((XDR *, short *));
extern bool_t xdr_u_short __P((XDR *, u_short *));
extern bool_t xdr_int16_t __P((XDR *, int16_t *));
extern bool_t xdr_u_int16_t __P((XDR *, u_int16_t *));
extern bool_t xdr_int32_t __P((XDR *, int32_t *));
extern bool_t xdr_u_int32_t __P((XDR *, u_int32_t *));
extern bool_t xdr_bool __P((XDR *, bool_t *));
extern bool_t xdr_enum __P((XDR *, enum_t *));
extern bool_t xdr_array __P((XDR *, char **, u_int *, u_int, u_int, xdrproc_t));
extern bool_t xdr_bytes __P((XDR *, char **, u_int *, u_int));
extern bool_t xdr_opaque __P((XDR *, caddr_t, u_int));
extern bool_t xdr_string __P((XDR *, char **, u_int));
extern bool_t xdr_union __P((XDR *, enum_t *, char *, struct xdr_discrim *, xdrproc_t));
extern unsigned long xdr_sizeof __P((xdrproc_t, void *));
extern bool_t xdr_char __P((XDR *, char *));
extern bool_t xdr_u_char __P((XDR *, u_char *));
extern bool_t xdr_vector __P((XDR *, char *, u_int, u_int, xdrproc_t));
extern bool_t xdr_float __P((XDR *, float *));
extern bool_t xdr_double __P((XDR *, double *));
extern bool_t xdr_reference __P((XDR *, caddr_t *, u_int, xdrproc_t));
extern bool_t xdr_pointer __P((XDR *, caddr_t *, u_int, xdrproc_t));
extern bool_t xdr_wrapstring __P((XDR *, char **));
extern void xdr_free __P((xdrproc_t, char *));
__END_DECLS
/*
* Common opaque bytes objects used by many rpc protocols;
* declared here due to commonality.
*/
#define MAX_NETOBJ_SZ 1024
#define MAX_NETOBJ_SZ 1024
struct netobj {
u_int n_len;
char *n_bytes;
};
typedef struct netobj netobj;
extern bool_t xdr_netobj();
extern bool_t xdr_netobj __P((XDR *, struct netobj *));
/*
* These are the public routines for the various implementations of
* xdr streams.
*/
extern void xdrmem_create(); /* XDR using memory buffers */
extern void xdrstdio_create(); /* XDR using stdio library */
extern void xdrrec_create(); /* XDR pseudo records for tcp */
extern bool_t xdrrec_endofrecord(); /* make end of xdr record */
extern bool_t xdrrec_skiprecord(); /* move to beginning of next record */
extern bool_t xdrrec_eof(); /* true if no more input */
__BEGIN_DECLS
/* XDR using memory buffers */
extern void xdrmem_create __P((XDR *, char *, u_int, enum xdr_op));
#endif !__XDR_HEADER__
#ifdef _STDIO_H_
/* XDR using stdio library */
extern void xdrstdio_create __P((XDR *, FILE *, enum xdr_op));
#endif
/* XDR pseudo records for tcp */
extern void xdrrec_create __P((XDR *, u_int, u_int, char *,
int (*) __P((caddr_t, caddr_t, int)),
int (*) __P((caddr_t, caddr_t, int))));
/* make end of xdr record */
extern bool_t xdrrec_endofrecord __P((XDR *, int));
/* move to beginning of next record */
extern bool_t xdrrec_skiprecord __P((XDR *));
/* true if no more input */
extern bool_t xdrrec_eof __P((XDR *));
__END_DECLS
#endif /* !_RPC_XDR_H */