summaryrefslogtreecommitdiffstats
path: root/include/rpc/auth.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/rpc/auth.h')
-rw-r--r--include/rpc/auth.h242
1 files changed, 166 insertions, 76 deletions
diff --git a/include/rpc/auth.h b/include/rpc/auth.h
index 4d6c38d..68e8827 100644
--- a/include/rpc/auth.h
+++ b/include/rpc/auth.h
@@ -1,3 +1,5 @@
+/* $NetBSD: auth.h,v 1.15 2000/06/02 22:57:55 fvdl Exp $ */
+
/*
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
* unrestricted use provided that this legend is included on all tape
@@ -28,6 +30,7 @@
*
* from: @(#)auth.h 1.17 88/02/08 SMI
* from: @(#)auth.h 2.3 88/08/07 4.0 RPCSRC
+ * from: @(#)auth.h 1.43 98/02/02 SMI
* $FreeBSD$
*/
@@ -43,6 +46,8 @@
#ifndef _RPC_AUTH_H
#define _RPC_AUTH_H
+#include <rpc/xdr.h>
+#include <rpc/clnt_stat.h>
#include <sys/cdefs.h>
#include <sys/socket.h>
@@ -50,6 +55,67 @@
#define MAXNETNAMELEN 255 /* maximum length of network user's name */
/*
+ * Client side authentication/security data
+ */
+
+typedef struct sec_data {
+ u_int secmod; /* security mode number e.g. in nfssec.conf */
+ u_int rpcflavor; /* rpc flavors:AUTH_UNIX,AUTH_DES,RPCSEC_GSS */
+ int flags; /* AUTH_F_xxx flags */
+ caddr_t data; /* opaque data per flavor */
+} sec_data_t;
+
+#ifdef _SYSCALL32_IMPL
+struct sec_data32 {
+ uint32_t secmod; /* security mode number e.g. in nfssec.conf */
+ uint32_t rpcflavor; /* rpc flavors:AUTH_UNIX,AUTH_DES,RPCSEC_GSS */
+ int32_t flags; /* AUTH_F_xxx flags */
+ caddr32_t data; /* opaque data per flavor */
+};
+#endif /* _SYSCALL32_IMPL */
+
+/*
+ * AUTH_DES flavor specific data from sec_data opaque data field.
+ * AUTH_KERB has the same structure.
+ */
+typedef struct des_clnt_data {
+ struct netbuf syncaddr; /* time sync addr */
+ struct knetconfig *knconf; /* knetconfig info that associated */
+ /* with the syncaddr. */
+ char *netname; /* server's netname */
+ int netnamelen; /* server's netname len */
+} dh_k4_clntdata_t;
+
+#ifdef _SYSCALL32_IMPL
+struct des_clnt_data32 {
+ struct netbuf32 syncaddr; /* time sync addr */
+ caddr32_t knconf; /* knetconfig info that associated */
+ /* with the syncaddr. */
+ caddr32_t netname; /* server's netname */
+ int32_t netnamelen; /* server's netname len */
+};
+#endif /* _SYSCALL32_IMPL */
+
+#ifdef KERBEROS
+/*
+ * flavor specific data to hold the data for AUTH_DES/AUTH_KERB(v4)
+ * in sec_data->data opaque field.
+ */
+typedef struct krb4_svc_data {
+ int window; /* window option value */
+} krb4_svcdata_t;
+
+typedef struct krb4_svc_data des_svcdata_t;
+#endif /* KERBEROS */
+
+/*
+ * authentication/security specific flags
+ */
+#define AUTH_F_RPCTIMESYNC 0x001 /* use RPC to do time sync */
+#define AUTH_F_TRYNONE 0x002 /* allow fall back to AUTH_NONE */
+
+
+/*
* Status returned from authentication check
*/
enum auth_stat {
@@ -67,18 +133,32 @@ enum auth_stat {
*/
AUTH_INVALIDRESP=6, /* bogus response verifier */
AUTH_FAILED=7 /* some unknown reason */
+#ifdef KERBEROS
+ /*
+ * kerberos errors
+ */
+ AUTH_KERB_GENERIC = 8, /* kerberos generic error */
+ AUTH_TIMEEXPIRE = 9, /* time of credential expired */
+ AUTH_TKT_FILE = 10, /* something wrong with ticket file */
+ AUTH_DECODE = 11, /* can't decode authenticator */
+ AUTH_NET_ADDR = 12 /* wrong net address in ticket */
+#endif /* KERBEROS */
};
union des_block {
struct {
- u_int32_t high;
- u_int32_t low;
+ uint32_t high;
+ uint32_t low;
} key;
char c[8];
};
typedef union des_block des_block;
__BEGIN_DECLS
-extern bool_t xdr_des_block __P((XDR *, des_block *));
+#ifdef __STDC__
+extern bool_t xdr_des_block(XDR *, des_block *);
+#else
+extern bool_t xdr_des_block();
+#endif
__END_DECLS
/*
@@ -89,29 +169,26 @@ 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 __rpc_auth {
+typedef struct __auth {
struct opaque_auth ah_cred;
struct opaque_auth ah_verf;
union des_block ah_key;
struct auth_ops {
- void (*ah_nextverf) __P((struct __rpc_auth *));
+ void (*ah_nextverf) (struct __auth *);
/* nextverf & serialize */
- int (*ah_marshal) __P((struct __rpc_auth *, XDR *));
+ int (*ah_marshal) (struct __auth *, XDR *);
/* validate verifier */
- int (*ah_validate) __P((struct __rpc_auth *,
- struct opaque_auth *));
+ int (*ah_validate) (struct __auth *,
+ struct opaque_auth *);
/* refresh credentials */
- int (*ah_refresh) __P((struct __rpc_auth *));
+ int (*ah_refresh) (struct __auth *, void *);
/* destroy this structure */
- void (*ah_destroy) __P((struct __rpc_auth *));
+ void (*ah_destroy) (struct __auth *);
} *ah_ops;
caddr_t ah_private;
} AUTH;
@@ -140,10 +217,10 @@ typedef struct __rpc_auth {
#define auth_validate(auth, verfp) \
((*((auth)->ah_ops->ah_validate))((auth), verfp))
-#define AUTH_REFRESH(auth) \
- ((*((auth)->ah_ops->ah_refresh))(auth))
-#define auth_refresh(auth) \
- ((*((auth)->ah_ops->ah_refresh))(auth))
+#define AUTH_REFRESH(auth, msg) \
+ ((*((auth)->ah_ops->ah_refresh))(auth, msg))
+#define auth_refresh(auth, msg) \
+ ((*((auth)->ah_ops->ah_refresh))(auth, msg))
#define AUTH_DESTROY(auth) \
((*((auth)->ah_ops->ah_destroy))(auth))
@@ -151,14 +228,16 @@ typedef struct __rpc_auth {
((*((auth)->ah_ops->ah_destroy))(auth))
+__BEGIN_DECLS
extern struct opaque_auth _null_auth;
+__END_DECLS
/*
* These are the various implementations of client side authenticators.
*/
/*
- * Unix style authentication
+ * System style authentication
* AUTH *authunix_create(machname, uid, gid, len, aup_gids)
* char *machname;
* int uid;
@@ -167,94 +246,105 @@ extern struct opaque_auth _null_auth;
* int *aup_gids;
*/
__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));
+extern AUTH *authunix_create(char *, int, int, int,
+ int *);
+extern AUTH *authunix_create_default(void); /* takes no parameters */
+extern AUTH *authnone_create(void); /* takes no parameters */
__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)
+ * AUTH *authsecdes_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
+ * const char *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
+extern AUTH *authdes_create (char *, u_int, struct sockaddr *, des_block *);
+extern AUTH *authdes_seccreate (const char *, const u_int, const char *,
+ const des_block *);
+__END_DECLS
+
+__BEGIN_DECLS
+extern bool_t xdr_opaque_auth __P((XDR *, struct opaque_auth *));
__END_DECLS
+#define authsys_create(c,i1,i2,i3,ip) authunix_create((c),(i1),(i2),(i3),(ip))
+#define authsys_create_default() authunix_create_default()
+
/*
* 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 * ));
+extern int getnetname(char *);
+extern int host2netname(char *, const char *, const char *);
+extern int user2netname(char *, const uid_t, const char *);
+extern int netname2user(char *, uid_t *, gid_t *, int *, gid_t *);
+extern int netname2host(char *, char *, const int);
+extern void passwd2des ( char *, char * );
__END_DECLS
/*
- * Keyserv interface routines.
- * XXX Should not be here.
+ *
+ * These routines interface to the keyserv daemon
+ *
*/
-#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(const char *, des_block *);
+extern int key_encryptsession(const char *, des_block *);
+extern int key_gendes(des_block *);
+extern int key_setsecret(const char *);
+extern int key_secretkey_is_set(void);
+__END_DECLS
+#ifdef KERBEROS
+/*
+ * Kerberos style authentication
+ * AUTH *authkerb_seccreate(service, srv_inst, realm, window, timehost, status)
+ * const char *service; - service name
+ * const char *srv_inst; - server instance
+ * const char *realm; - server realm
+ * const u_int window; - time to live
+ * const char *timehost; - optional hostname to sync with
+ * int *status; - kerberos status returned
+ */
__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 * ));
+extern AUTH *authkerb_seccreate(const char *, const char *, const char *,
+ const u_int, const char *, int *);
__END_DECLS
/*
- * Publickey routines.
+ * Map a kerberos credential into a unix cred.
+ *
+ * authkerb_getucred(rqst, uid, gid, grouplen, groups)
+ * const struct svc_req *rqst; - request pointer
+ * uid_t *uid;
+ * gid_t *gid;
+ * short *grouplen;
+ * int *groups;
+ *
*/
__BEGIN_DECLS
-extern int getpublickey __P(( char *, char * ));
-extern int getpublicandprivatekey __P(( char *, char * ));
-extern int getsecretkey __P(( char *, char *, char * ));
+extern int authkerb_getucred(/* struct svc_req *, uid_t *, gid_t *,
+ short *, int * */);
__END_DECLS
+#endif /* KERBEROS */
+__BEGIN_DECLS
+struct svc_req;
+struct rpc_msg;
+enum auth_stat _svcauth_null __P((struct svc_req *, struct rpc_msg *));
+enum auth_stat _svcauth_short __P((struct svc_req *, struct rpc_msg *));
+enum auth_stat _svcauth_unix __P((struct svc_req *, struct rpc_msg *));
+__END_DECLS
#define AUTH_NONE 0 /* no authentication */
#define AUTH_NULL 0 /* backward compatibility */
-#define AUTH_UNIX 1 /* unix style (uid, gids) */
-#define AUTH_SYS 1 /* forward compatibility */
+#define AUTH_SYS 1 /* unix style (uid, gids) */
+#define AUTH_UNIX AUTH_SYS
#define AUTH_SHORT 2 /* short hand unix style */
-#define AUTH_DES 3 /* des style (encrypted timestamps) */
+#define AUTH_DH 3 /* for Diffie-Hellman mechanism */
+#define AUTH_DES AUTH_DH /* for backward compatibility */
+#define AUTH_KERB 4 /* kerberos style */
#endif /* !_RPC_AUTH_H */
OpenPOWER on IntegriCloud