2 Unix SMB/CIFS implementation.
4 Generic Authentication Interface
6 Copyright (C) Andrew Tridgell 2003
7 Copyright (C) Andrew Bartlett <abartlet@samba.org> 2004
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2 of the License, or
12 (at your option) any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25 struct gensec_security;
31 char schan_session_key[16];
33 struct gensec_target {
34 const char *principal;
36 const struct sock_addr *addr;
40 #define GENSEC_WANT_SESSION_KEY 0x1
41 #define GENSEC_WANT_SIGN 0x2
42 #define GENSEC_WANT_SEAL 0x4
51 struct auth_session_info;
53 struct gensec_security_ops {
55 const char *sasl_name;
56 uint8 auth_type; /* 0 if not offered on DCE-RPC */
57 const char *oid; /* NULL if not offered by SPENGO */
58 NTSTATUS (*client_start)(struct gensec_security *gensec_security);
59 NTSTATUS (*server_start)(struct gensec_security *gensec_security);
60 NTSTATUS (*update)(struct gensec_security *gensec_security, TALLOC_CTX *out_mem_ctx,
61 const DATA_BLOB in, DATA_BLOB *out);
62 NTSTATUS (*seal_packet)(struct gensec_security *gensec_security, TALLOC_CTX *sig_mem_ctx,
63 uint8_t *data, size_t length,
64 const uint8_t *whole_pdu, size_t pdu_length,
66 NTSTATUS (*sign_packet)(struct gensec_security *gensec_security, TALLOC_CTX *sig_mem_ctx,
67 const uint8_t *data, size_t length,
68 const uint8_t *whole_pdu, size_t pdu_length,
70 size_t (*sig_size)(struct gensec_security *gensec_security);
71 NTSTATUS (*check_packet)(struct gensec_security *gensec_security, TALLOC_CTX *sig_mem_ctx,
72 const uint8_t *data, size_t length,
73 const uint8_t *whole_pdu, size_t pdu_length,
74 const DATA_BLOB *sig);
75 NTSTATUS (*unseal_packet)(struct gensec_security *gensec_security, TALLOC_CTX *sig_mem_ctx,
76 uint8_t *data, size_t length,
77 const uint8_t *whole_pdu, size_t pdu_length,
79 NTSTATUS (*session_key)(struct gensec_security *gensec_security, DATA_BLOB *session_key);
80 NTSTATUS (*session_info)(struct gensec_security *gensec_security,
81 struct auth_session_info **session_info);
82 void (*end)(struct gensec_security *gensec_security);
85 typedef NTSTATUS (*gensec_password_callback)(struct gensec_security *gensec_security, TALLOC_CTX *mem_ctx,
88 #define GENSEC_INTERFACE_VERSION 0
90 struct gensec_security {
91 gensec_password_callback password_callback;
92 void *password_callback_private;
93 const struct gensec_security_ops *ops;
95 struct gensec_user user;
96 struct gensec_user default_user;
97 struct gensec_target target;
98 enum gensec_role gensec_role;
100 uint32 want_features;
103 /* this structure is used by backends to determine the size of some critical types */
104 struct gensec_critical_sizes {
105 int interface_version;
106 int sizeof_gensec_security_ops;
107 int sizeof_gensec_security;
111 /* pre-declare schannel structure for schannel backend */
112 struct schannel_state;