s3-spoolss: add rpccli_spoolss_getprinterdriver convenience wrapper.
[ira/wip.git] / source3 / include / spnego.h
1 /* 
2    Unix SMB/CIFS implementation.
3
4    RFC2478 Compliant SPNEGO implementation
5
6    Copyright (C) Jim McDonough <jmcd@us.ibm.com>   2003
7
8    This program is free software; you can redistribute it and/or modify
9    it under the terms of the GNU General Public License as published by
10    the Free Software Foundation; either version 3 of the License, or
11    (at your option) any later version.
12    
13    This program is distributed in the hope that it will be useful,
14    but WITHOUT ANY WARRANTY; without even the implied warranty of
15    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16    GNU General Public License for more details.
17
18    
19    You should have received a copy of the GNU General Public License
20    along with this program.  If not, see <http://www.gnu.org/licenses/>.
21 */
22
23 #ifndef SAMBA_SPNEGO_H
24 #define SAMBA_SPNEGO_H
25
26 #define SPNEGO_DELEG_FLAG    0x01
27 #define SPNEGO_MUTUAL_FLAG   0x02
28 #define SPNEGO_REPLAY_FLAG   0x04
29 #define SPNEGO_SEQUENCE_FLAG 0x08
30 #define SPNEGO_ANON_FLAG     0x10
31 #define SPNEGO_CONF_FLAG     0x20
32 #define SPNEGO_INTEG_FLAG    0x40
33 #define SPNEGO_REQ_FLAG      0x80
34
35 #define SPNEGO_NEG_TOKEN_INIT 0
36 #define SPNEGO_NEG_TOKEN_TARG 1
37
38 /* some well known object IDs */
39 #define OID_SPNEGO "1.3.6.1.5.5.2"
40 #define OID_NTLMSSP "1.3.6.1.4.1.311.2.2.10"
41 #define OID_KERBEROS5_OLD "1.2.840.48018.1.2.2"
42 #define OID_KERBEROS5 "1.2.840.113554.1.2.2"
43
44 #define SPNEGO_NEG_RESULT_ACCEPT 0
45 #define SPNEGO_NEG_RESULT_INCOMPLETE 1
46 #define SPNEGO_NEG_RESULT_REJECT 2
47
48 /* not really ASN.1, but RFC 1964 */
49 #define TOK_ID_KRB_AP_REQ       (uchar*)"\x01\x00"
50 #define TOK_ID_KRB_AP_REP       (uchar*)"\x02\x00"
51 #define TOK_ID_KRB_ERROR        (uchar*)"\x03\x00"
52 #define TOK_ID_GSS_GETMIC       (uchar*)"\x01\x01"
53 #define TOK_ID_GSS_WRAP         (uchar*)"\x02\x01"
54
55 typedef enum _spnego_negResult {
56         SPNEGO_ACCEPT_COMPLETED = 0,
57         SPNEGO_ACCEPT_INCOMPLETE = 1,
58         SPNEGO_REJECT = 2
59 } negResult_t;
60
61 typedef struct spnego_negTokenInit {
62         const char **mechTypes;
63         int reqFlags;
64         DATA_BLOB mechToken;
65         DATA_BLOB mechListMIC;
66 } negTokenInit_t;
67
68 typedef struct spnego_negTokenTarg {
69         uint8 negResult;
70         char *supportedMech;
71         DATA_BLOB responseToken;
72         DATA_BLOB mechListMIC;
73 } negTokenTarg_t;
74
75 typedef struct spnego_spnego {
76         int type;
77         negTokenInit_t negTokenInit;
78         negTokenTarg_t negTokenTarg;
79 } SPNEGO_DATA;
80
81 #endif