8edacd74aa34c4f493759ed7aceb866c5de4ee84
[obnox/samba/samba-obnox.git] / source3 / include / ntlmssp_wrap.h
1 /*
2    NLTMSSP wrappers
3
4    Copyright (C) Andrew Tridgell      2001
5    Copyright (C) Andrew Bartlett 2001-2003
6
7    This program is free software; you can redistribute it and/or modify
8    it under the terms of the GNU General Public License as published by
9    the Free Software Foundation; either version 3 of the License, or
10    (at your option) any later version.
11
12    This program is distributed in the hope that it will be useful,
13    but WITHOUT ANY WARRANTY; without even the implied warranty of
14    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15    GNU General Public License for more details.
16
17    You should have received a copy of the GNU General Public License
18    along with this program.  If not, see <http://www.gnu.org/licenses/>.
19 */
20
21 #ifndef _NTLMSSP_WRAP_
22 #define _NTLMSSP_WRAP_
23
24 struct gensec_security;
25
26 struct auth_ntlmssp_state {
27         /* used only by server implementation */
28         struct auth_context *auth_context;
29         struct gensec_security *gensec_security;
30
31         /* used by both client and server implementation */
32         struct ntlmssp_state *ntlmssp_state;
33 };
34
35 NTSTATUS auth_ntlmssp_sign_packet(struct auth_ntlmssp_state *ans,
36                                   TALLOC_CTX *sig_mem_ctx,
37                                   const uint8_t *data,
38                                   size_t length,
39                                   const uint8_t *whole_pdu,
40                                   size_t pdu_length,
41                                   DATA_BLOB *sig);
42 NTSTATUS auth_ntlmssp_check_packet(struct auth_ntlmssp_state *ans,
43                                    const uint8_t *data,
44                                    size_t length,
45                                    const uint8_t *whole_pdu,
46                                    size_t pdu_length,
47                                    const DATA_BLOB *sig);
48 NTSTATUS auth_ntlmssp_seal_packet(struct auth_ntlmssp_state *ans,
49                                   TALLOC_CTX *sig_mem_ctx,
50                                   uint8_t *data,
51                                   size_t length,
52                                   const uint8_t *whole_pdu,
53                                   size_t pdu_length,
54                                   DATA_BLOB *sig);
55 NTSTATUS auth_ntlmssp_unseal_packet(struct auth_ntlmssp_state *ans,
56                                     uint8_t *data,
57                                     size_t length,
58                                     const uint8_t *whole_pdu,
59                                     size_t pdu_length,
60                                     const DATA_BLOB *sig);
61 bool auth_ntlmssp_negotiated_sign(struct auth_ntlmssp_state *ans);
62 bool auth_ntlmssp_negotiated_seal(struct auth_ntlmssp_state *ans);
63 NTSTATUS auth_ntlmssp_set_username(struct auth_ntlmssp_state *ans,
64                                    const char *user);
65 NTSTATUS auth_ntlmssp_set_domain(struct auth_ntlmssp_state *ans,
66                                  const char *domain);
67 NTSTATUS auth_ntlmssp_set_password(struct auth_ntlmssp_state *ans,
68                                    const char *password);
69 void auth_ntlmssp_want_feature(struct auth_ntlmssp_state *ans, uint32_t feature);
70 DATA_BLOB auth_ntlmssp_get_session_key(struct auth_ntlmssp_state *ans, 
71                                        TALLOC_CTX *mem_ctx);
72
73 NTSTATUS auth_ntlmssp_update(struct auth_ntlmssp_state *ans,
74                              TALLOC_CTX *mem_ctx,
75                              const DATA_BLOB request, DATA_BLOB *reply);
76
77 NTSTATUS auth_ntlmssp_client_start(TALLOC_CTX *mem_ctx,
78                                    const char *netbios_name,
79                                    const char *netbios_domain,
80                                    bool use_ntlmv2,
81                                    struct auth_ntlmssp_state **_ans);
82 #endif /* _NTLMSSP_WRAP_ */