2009-09-17 02:21:01 +04:00
/*
2004-06-19 12:15:41 +04:00
Unix SMB / CIFS implementation .
RFC2478 Compliant SPNEGO implementation
Copyright ( C ) Jim McDonough < jmcd @ us . ibm . com > 2003
This program is free software ; you can redistribute it and / or modify
it under the terms of the GNU General Public License as published by
2007-07-10 06:07:03 +04:00
the Free Software Foundation ; either version 3 of the License , or
2004-06-19 12:15:41 +04:00
( at your option ) any later version .
2009-09-17 02:21:01 +04:00
2004-06-19 12:15:41 +04:00
This program is distributed in the hope that it will be useful ,
but WITHOUT ANY WARRANTY ; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the
GNU General Public License for more details .
2009-09-17 02:21:01 +04:00
2004-06-19 12:15:41 +04:00
You should have received a copy of the GNU General Public License
2007-07-10 06:07:03 +04:00
along with this program . If not , see < http : //www.gnu.org/licenses/>.
2004-06-19 12:15:41 +04:00
*/
2009-09-17 02:21:01 +04:00
# define OID_SPNEGO "1.3.6.1.5.5.2"
# define OID_NTLMSSP "1.3.6.1.4.1.311.2.2.10"
# define OID_KERBEROS5_OLD "1.2.840.48018.1.2.2"
# define OID_KERBEROS5 "1.2.840.113554.1.2.2"
2010-12-04 07:23:44 +03:00
# define ADS_IGNORE_PRINCIPAL "not_defined_in_RFC4178@please_ignore"
2004-06-19 12:15:41 +04:00
# define SPNEGO_DELEG_FLAG 0x01
# define SPNEGO_MUTUAL_FLAG 0x02
# define SPNEGO_REPLAY_FLAG 0x04
# define SPNEGO_SEQUENCE_FLAG 0x08
# define SPNEGO_ANON_FLAG 0x10
# define SPNEGO_CONF_FLAG 0x20
# define SPNEGO_INTEG_FLAG 0x40
2010-07-01 01:47:03 +04:00
# define TOK_ID_KRB_AP_REQ ((const uint8_t *)"\x01\x00")
# define TOK_ID_KRB_AP_REP ((const uint8_t *)"\x02\x00")
# define TOK_ID_KRB_ERROR ((const uint8_t *)"\x03\x00")
# define TOK_ID_GSS_GETMIC ((const uint8_t *)"\x01\x01")
# define TOK_ID_GSS_WRAP ((const uint8_t *)"\x02\x01")
2004-07-06 04:15:39 +04:00
enum spnego_negResult {
2004-06-19 12:15:41 +04:00
SPNEGO_ACCEPT_COMPLETED = 0 ,
SPNEGO_ACCEPT_INCOMPLETE = 1 ,
2004-07-06 21:46:47 +04:00
SPNEGO_REJECT = 2 ,
2013-12-17 15:42:35 +04:00
SPNEGO_REQUEST_MIC = 3 ,
/*
* The max value is 0xff ( 255 ) on the wire
*/
SPNEGO_NONE_RESULT = 256
2004-07-06 04:15:39 +04:00
} ;
2004-06-19 12:15:41 +04:00
struct spnego_negTokenInit {
2013-08-05 12:46:47 +04:00
const char * const * mechTypes ;
2009-08-13 10:12:01 +04:00
DATA_BLOB reqFlags ;
uint8_t reqFlagsPadding ;
2004-06-19 12:15:41 +04:00
DATA_BLOB mechToken ;
DATA_BLOB mechListMIC ;
2004-07-11 14:20:42 +04:00
char * targetPrincipal ;
2004-06-19 12:15:41 +04:00
} ;
struct spnego_negTokenTarg {
2013-12-17 15:42:06 +04:00
enum spnego_negResult negResult ;
2004-06-19 12:15:41 +04:00
const char * supportedMech ;
DATA_BLOB responseToken ;
DATA_BLOB mechListMIC ;
} ;
struct spnego_data {
int type ;
struct spnego_negTokenInit negTokenInit ;
struct spnego_negTokenTarg negTokenTarg ;
} ;
2004-06-20 04:58:09 +04:00
enum spnego_message_type {
2009-09-17 02:21:01 +04:00
SPNEGO_NEG_TOKEN_INIT = 0 ,
2004-06-20 04:58:09 +04:00
SPNEGO_NEG_TOKEN_TARG = 1 ,
} ;
2009-09-17 03:39:12 +04:00
# include "../libcli/auth/spnego_proto.h"