1*12b65585SGordon Ross /* 2*12b65585SGordon Ross * This file and its contents are supplied under the terms of the 3*12b65585SGordon Ross * Common Development and Distribution License ("CDDL"), version 1.0. 4*12b65585SGordon Ross * You may only use this file in accordance with the terms of version 5*12b65585SGordon Ross * 1.0 of the CDDL. 6*12b65585SGordon Ross * 7*12b65585SGordon Ross * A full copy of the text of the CDDL should have accompanied this 8*12b65585SGordon Ross * source. A copy of the CDDL is also available via the Internet at 9*12b65585SGordon Ross * http://www.illumos.org/license/CDDL. 10*12b65585SGordon Ross */ 11*12b65585SGordon Ross 12*12b65585SGordon Ross /* 13*12b65585SGordon Ross * Copyright 2014 Nexenta Systems, Inc. All rights reserved. 14*12b65585SGordon Ross */ 15*12b65585SGordon Ross 16*12b65585SGordon Ross #ifndef _SMBD_AUTHSVC_H 17*12b65585SGordon Ross #define _SMBD_AUTHSVC_H 18*12b65585SGordon Ross 19*12b65585SGordon Ross /* 20*12b65585SGordon Ross * Declarations shared with authsvc modules. 21*12b65585SGordon Ross */ 22*12b65585SGordon Ross 23*12b65585SGordon Ross #include <sys/types.h> 24*12b65585SGordon Ross #include <smbsrv/libsmb.h> 25*12b65585SGordon Ross 26*12b65585SGordon Ross /* 27*12b65585SGordon Ross * This is the common authsvc_context shared by all back-ends. 28*12b65585SGordon Ross * Note that ctx_mech_oid is really SPNEGO_MECH_OID, and the 29*12b65585SGordon Ross * ctx_itoken, ctx_otoken members are SPNEGO_TOKEN_HANDLE, 30*12b65585SGordon Ross * but this is using the underlying types so as to avoid 31*12b65585SGordon Ross * dragging in spnego.h here. 32*12b65585SGordon Ross */ 33*12b65585SGordon Ross typedef struct authsvc_context { 34*12b65585SGordon Ross int ctx_socket; 35*12b65585SGordon Ross int ctx_mech_oid; 36*12b65585SGordon Ross int (*ctx_mh_work)(struct authsvc_context *); 37*12b65585SGordon Ross void (*ctx_mh_fini)(struct authsvc_context *); 38*12b65585SGordon Ross int ctx_itoktype; 39*12b65585SGordon Ross int ctx_negresult; 40*12b65585SGordon Ross 41*12b65585SGordon Ross /* (in,out) SPNEGO token handles */ 42*12b65585SGordon Ross void *ctx_itoken; 43*12b65585SGordon Ross void *ctx_otoken; 44*12b65585SGordon Ross 45*12b65585SGordon Ross /* (in,out) raw (buf,len,type) */ 46*12b65585SGordon Ross void *ctx_irawbuf; 47*12b65585SGordon Ross uint_t ctx_irawlen; 48*12b65585SGordon Ross int ctx_irawtype; 49*12b65585SGordon Ross void *ctx_orawbuf; 50*12b65585SGordon Ross uint_t ctx_orawlen; 51*12b65585SGordon Ross int ctx_orawtype; 52*12b65585SGordon Ross 53*12b65585SGordon Ross /* (in,out) body (buf,len) */ 54*12b65585SGordon Ross void *ctx_ibodybuf; 55*12b65585SGordon Ross uint_t ctx_ibodylen; 56*12b65585SGordon Ross void *ctx_obodybuf; 57*12b65585SGordon Ross uint_t ctx_obodylen; 58*12b65585SGordon Ross 59*12b65585SGordon Ross /* who is the client */ 60*12b65585SGordon Ross smb_lsa_clinfo_t ctx_clinfo; 61*12b65585SGordon Ross 62*12b65585SGordon Ross /* final authentication token */ 63*12b65585SGordon Ross struct smb_token *ctx_token; 64*12b65585SGordon Ross 65*12b65585SGordon Ross /* private data for the back-end */ 66*12b65585SGordon Ross void *ctx_backend; 67*12b65585SGordon Ross } authsvc_context_t; 68*12b65585SGordon Ross 69*12b65585SGordon Ross int smbd_krb5ssp_init(authsvc_context_t *); 70*12b65585SGordon Ross int smbd_krb5ssp_work(authsvc_context_t *); 71*12b65585SGordon Ross void smbd_krb5ssp_fini(authsvc_context_t *); 72*12b65585SGordon Ross 73*12b65585SGordon Ross int smbd_ntlmssp_init(authsvc_context_t *); 74*12b65585SGordon Ross int smbd_ntlmssp_work(authsvc_context_t *); 75*12b65585SGordon Ross void smbd_ntlmssp_fini(authsvc_context_t *); 76*12b65585SGordon Ross 77*12b65585SGordon Ross /* Exposed for unit tests. */ 78*12b65585SGordon Ross int smbd_authsvc_dispatch(authsvc_context_t *); 79*12b65585SGordon Ross authsvc_context_t *smbd_authctx_create(void); 80*12b65585SGordon Ross void smbd_authctx_destroy(authsvc_context_t *); 81*12b65585SGordon Ross 82*12b65585SGordon Ross #endif /* _SMBD_AUTHSVC_H */ 83