r10510: Decrease the amount of data included by includes.h a bit
[samba.git] / source / include / credentials.h
1 /* 
2    samba -- Unix SMB/CIFS implementation.
3
4    Client credentials structure
5
6    Copyright (C) Jelmer Vernooij 2004-2005
7    Copyright (C) Andrew Bartlett <abartlet@samba.org> 2005
8
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.
13    
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.
18    
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.
22 */
23
24 struct ccache_container;
25
26 /* In order of priority */
27 enum credentials_obtained { 
28         CRED_UNINITIALISED = 0,  /* We don't even have a guess yet */
29         CRED_GUESS_ENV,          /* Current value should be used, which was guessed */
30         CRED_CALLBACK,           /* Callback should be used to obtain value */
31         CRED_GUESS_FILE,         /* A guess from a file (or file pointed at in env variable) */
32         CRED_SPECIFIED           /* Was explicitly specified on the command-line */
33 };
34
35 struct cli_credentials {
36         /* Preferred methods, NULL means default */
37         const char **preferred_methods;
38
39         enum credentials_obtained workstation_obtained;
40         enum credentials_obtained username_obtained;
41         enum credentials_obtained password_obtained;
42         enum credentials_obtained domain_obtained;
43         enum credentials_obtained realm_obtained;
44         enum credentials_obtained ccache_obtained;
45         enum credentials_obtained principal_obtained;
46
47         const char *workstation;
48         const char *username;
49         const char *password;
50         const char *domain;
51         const char *realm;
52         const char *principal;
53
54         struct samr_Password *nt_hash;
55
56         struct ccache_container *ccache;
57
58         const char *(*workstation_cb) (struct cli_credentials *);
59         const char *(*password_cb) (struct cli_credentials *);
60         const char *(*username_cb) (struct cli_credentials *);
61         const char *(*domain_cb) (struct cli_credentials *);
62         const char *(*realm_cb) (struct cli_credentials *);
63         const char *(*principal_cb) (struct cli_credentials *);
64
65         /* Private handle for the callback routines to use */
66         void *priv_data;
67
68         struct creds_CredentialState *netlogon_creds;
69         enum netr_SchannelType secure_channel_type;
70         int kvno;
71
72         /* We are flagged to get machine account details from the
73          * secrets.ldb when we are asked for a username or password */
74
75         BOOL machine_account_pending;
76 };