1 /* @(#)svc_auth.h 2.1 88/07/29 4.0 RPCSRC */ 2 /* 3 * Copyright (c) 2010, Oracle America, Inc. 4 * 5 * All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions are met: 9 * 10 * * Redistributions of source code must retain the above copyright 11 * notice, this list of conditions and the following disclaimer. 12 * 13 * * Redistributions in binary form must reproduce the above copyright 14 * notice, this list of conditions and the following disclaimer in 15 * the documentation and/or other materials provided with the 16 * distribution. 17 * 18 * * Neither the name of the "Oracle America, Inc." nor the names of 19 * its contributors may be used to endorse or promote products 20 * derived from this software without specific prior written permission. 21 * 22 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 23 * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 24 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 25 * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 26 * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 27 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 28 * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 29 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 30 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 31 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 32 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 */ 34 /* @(#)svc_auth.h 1.6 86/07/16 SMI */ 35 36 /* 37 * svc_auth.h, Service side of rpc authentication. 38 */ 39 40 /* 41 * Interface to server-side authentication flavors. 42 */ 43 44 #ifndef GSSRPC_SVC_AUTH_H 45 #define GSSRPC_SVC_AUTH_H 46 47 #include <gssapi/gssapi.h> 48 49 GSSRPC__BEGIN_DECLS 50 51 struct svc_req; 52 53 typedef struct SVCAUTH { 54 struct svc_auth_ops { 55 int (*svc_ah_wrap)(struct SVCAUTH *, XDR *, xdrproc_t, 56 caddr_t); 57 int (*svc_ah_unwrap)(struct SVCAUTH *, XDR *, xdrproc_t, 58 caddr_t); 59 int (*svc_ah_destroy)(struct SVCAUTH *); 60 } *svc_ah_ops; 61 void * svc_ah_private; 62 } SVCAUTH; 63 64 #ifdef GSSRPC__IMPL 65 66 extern SVCAUTH svc_auth_none; 67 68 extern struct svc_auth_ops svc_auth_none_ops; 69 extern struct svc_auth_ops svc_auth_gssapi_ops; 70 extern struct svc_auth_ops svc_auth_gss_ops; 71 72 /* 73 * Server side authenticator 74 */ 75 /* RENAMED: should be _authenticate. */ 76 extern enum auth_stat gssrpc__authenticate(struct svc_req *rqst, 77 struct rpc_msg *msg, bool_t *no_dispatch); 78 79 #define SVCAUTH_WRAP(auth, xdrs, xfunc, xwhere) \ 80 ((*((auth)->svc_ah_ops->svc_ah_wrap))(auth, xdrs, xfunc, xwhere)) 81 #define SVCAUTH_UNWRAP(auth, xdrs, xfunc, xwhere) \ 82 ((*((auth)->svc_ah_ops->svc_ah_unwrap))(auth, xdrs, xfunc, xwhere)) 83 #define SVCAUTH_DESTROY(auth) \ 84 ((*((auth)->svc_ah_ops->svc_ah_destroy))(auth)) 85 86 /* no authentication */ 87 /* RENAMED: should be _svcauth_none. */ 88 enum auth_stat gssrpc__svcauth_none(struct svc_req *, 89 struct rpc_msg *, bool_t *); 90 /* unix style (uid, gids) */ 91 /* RENAMED: should be _svcauth_unix. */ 92 enum auth_stat gssrpc__svcauth_unix(struct svc_req *, 93 struct rpc_msg *, bool_t *); 94 /* short hand unix style */ 95 /* RENAMED: should be _svcauth_short. */ 96 enum auth_stat gssrpc__svcauth_short(struct svc_req *, 97 struct rpc_msg *, bool_t *); 98 /* GSS-API style */ 99 /* RENAMED: should be _svcauth_gssapi. */ 100 enum auth_stat gssrpc__svcauth_gssapi(struct svc_req *, 101 struct rpc_msg *, bool_t *); 102 /* RPCSEC_GSS */ 103 enum auth_stat gssrpc__svcauth_gss(struct svc_req *, 104 struct rpc_msg *, bool_t *); 105 106 #endif /* defined(GSSRPC__IMPL) */ 107 108 /* 109 * Approved way of getting principal of caller 110 */ 111 char *svcauth_gss_get_principal(SVCAUTH *auth); 112 /* 113 * Approved way of setting server principal 114 */ 115 bool_t svcauth_gss_set_svc_name(gss_name_t name); 116 117 GSSRPC__END_DECLS 118 119 #endif /* !defined(GSSRPC_SVC_AUTH_H) */ 120