s3-ntlmssp Use auth_ntlmssp_*() functions in more places
[amitay/samba.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 auth_ntlmssp_state {
25         /* used only by server implementation */
26         struct auth_context *auth_context;
27         struct auth_serversupplied_info *server_info;
28         struct tsocket_address *remote_address;
29
30         /* used by both client and server implementation */
31         struct ntlmssp_state *ntlmssp_state;
32 };
33
34 NTSTATUS auth_ntlmssp_sign_packet(struct auth_ntlmssp_state *ans,
35                                   TALLOC_CTX *sig_mem_ctx,
36                                   const uint8_t *data,
37                                   size_t length,
38                                   const uint8_t *whole_pdu,
39                                   size_t pdu_length,
40                                   DATA_BLOB *sig);
41 NTSTATUS auth_ntlmssp_check_packet(struct auth_ntlmssp_state *ans,
42                                    const uint8_t *data,
43                                    size_t length,
44                                    const uint8_t *whole_pdu,
45                                    size_t pdu_length,
46                                    const DATA_BLOB *sig);
47 NTSTATUS auth_ntlmssp_seal_packet(struct auth_ntlmssp_state *ans,
48                                   TALLOC_CTX *sig_mem_ctx,
49                                   uint8_t *data,
50                                   size_t length,
51                                   const uint8_t *whole_pdu,
52                                   size_t pdu_length,
53                                   DATA_BLOB *sig);
54 NTSTATUS auth_ntlmssp_unseal_packet(struct auth_ntlmssp_state *ans,
55                                     uint8_t *data,
56                                     size_t length,
57                                     const uint8_t *whole_pdu,
58                                     size_t pdu_length,
59                                     const DATA_BLOB *sig);
60 bool auth_ntlmssp_negotiated_sign(struct auth_ntlmssp_state *ans);
61 bool auth_ntlmssp_negotiated_seal(struct auth_ntlmssp_state *ans);
62 const char *auth_ntlmssp_get_username(struct auth_ntlmssp_state *ans);
63 const char *auth_ntlmssp_get_domain(struct auth_ntlmssp_state *ans);
64 const char *auth_ntlmssp_get_client(struct auth_ntlmssp_state *ans);
65 const uint8_t *auth_ntlmssp_get_nt_hash(struct auth_ntlmssp_state *ans);
66 NTSTATUS auth_ntlmssp_set_username(struct auth_ntlmssp_state *ans,
67                                    const char *user);
68 NTSTATUS auth_ntlmssp_set_domain(struct auth_ntlmssp_state *ans,
69                                  const char *domain);
70 NTSTATUS auth_ntlmssp_set_password(struct auth_ntlmssp_state *ans,
71                                    const char *password);
72 void auth_ntlmssp_and_flags(struct auth_ntlmssp_state *ans, uint32_t flags);
73 void auth_ntlmssp_or_flags(struct auth_ntlmssp_state *ans, uint32_t flags);
74 void auth_ntlmssp_want_feature(struct auth_ntlmssp_state *ans, uint32_t feature);
75 DATA_BLOB auth_ntlmssp_get_session_key(struct auth_ntlmssp_state *ans);
76
77 NTSTATUS auth_ntlmssp_update(struct auth_ntlmssp_state *ans,
78                              const DATA_BLOB request, DATA_BLOB *reply);
79
80 NTSTATUS auth_ntlmssp_client_start(TALLOC_CTX *mem_ctx,
81                                    const char *netbios_name,
82                                    const char *netbios_domain,
83                                    bool use_ntlmv2,
84                                    struct auth_ntlmssp_state **_ans);
85 #endif /* _NTLMSSP_WRAP_ */