From c07b2bdf9032c870f7f50a9671e8d9fb0a56739a Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Tue, 6 Oct 1998 22:03:04 +0000 Subject: dce/rpc (This used to be commit eb279cabd059603b6c8d9b74e4fd31c4ffe87593) --- source3/include/ntdomain.h | 5 ++- source3/include/proto.h | 32 ++++++++++++----- source3/include/rpc_dce.h | 87 ++++++++++++++++++++++++++++++++++------------ 3 files changed, 91 insertions(+), 33 deletions(-) (limited to 'source3/include') diff --git a/source3/include/ntdomain.h b/source3/include/ntdomain.h index 8362dcb73f..5fb7f8a089 100644 --- a/source3/include/ntdomain.h +++ b/source3/include/ntdomain.h @@ -67,6 +67,7 @@ typedef struct pipes_struct prs_struct rhdr; /* output header */ prs_struct rdata; /* output data */ prs_struct rauth; /* output authentication verifier */ + prs_struct rntlm; /* output ntlmssp */ RPC_HDR hdr; RPC_HDR_BA hdr_ba; @@ -74,7 +75,9 @@ typedef struct pipes_struct RPC_HDR_REQ hdr_req; RPC_HDR_RESP hdr_resp; - RPC_AUTH_NTLMSSP_REQ ntlmssp_req; + RPC_AUTH_VERIFIER auth_verifier; + RPC_AUTH_NTLMSSP_NEG ntlmssp_neg; + RPC_AUTH_NTLMSSP_CHAL ntlmssp_chal; RPC_AUTH_NTLMSSP_RESP ntlmssp_resp; uint32 file_offset; diff --git a/source3/include/proto.h b/source3/include/proto.h index 19aa51a1b7..e5b6c0b08e 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -70,6 +70,11 @@ void charset_initialise(void); void codepage_initialise(int client_codepage); void add_char_string(char *s); +/*The following definitions come from lib/crc32.c */ + +void crc32_build_table(void); +uint32 crc32_calc_buffer( uint32 count, uchar *buffer); + /*The following definitions come from lib/debug.c */ void sig_usr2( int sig ); @@ -1495,7 +1500,7 @@ BOOL prs_uninotstr2(BOOL charmode, char *name, prs_struct *ps, int depth, UNINOT BOOL prs_string2(BOOL charmode, char *name, prs_struct *ps, int depth, STRING2 *str); BOOL prs_unistr2(BOOL charmode, char *name, prs_struct *ps, int depth, UNISTR2 *str); BOOL prs_unistr(char *name, prs_struct *ps, int depth, UNISTR *str); -BOOL prs_string(char *name, prs_struct *ps, int depth, char *str, uint16 len); +BOOL prs_string(char *name, prs_struct *ps, int depth, char *str, uint16 len, uint16 max_buf_size); /*The following definitions come from rpc_parse/parse_reg.c */ @@ -1533,15 +1538,23 @@ void smb_io_rpc_hdr_ba(char *desc, RPC_HDR_BA *rpc, prs_struct *ps, int depth); void make_rpc_hdr_req(RPC_HDR_REQ *hdr, uint32 data_len, uint16 opnum); void smb_io_rpc_hdr_req(char *desc, RPC_HDR_REQ *rpc, prs_struct *ps, int depth); void smb_io_rpc_hdr_resp(char *desc, RPC_HDR_RESP *rpc, prs_struct *ps, int depth); -void make_rpc_auth_ntlmssp_req(RPC_AUTH_NTLMSSP_REQ *req, - fstring ntlmssp_str, uint32 ntlmssp_ver, - uint32 unknown_0, fstring myname, fstring domain); -void smb_io_rpc_auth_ntlmssp_req(char *desc, RPC_AUTH_NTLMSSP_REQ *req, prs_struct *ps, int depth); +void make_rpc_auth_ntlmssp_neg(RPC_AUTH_NTLMSSP_NEG *neg, + uint32 neg_flgs, + fstring myname, fstring domain); +void smb_io_rpc_auth_ntlmssp_neg(char *desc, RPC_AUTH_NTLMSSP_NEG *neg, prs_struct *ps, int depth); +void make_rpc_auth_verifier(RPC_AUTH_VERIFIER *rav, + uint8 auth_type, uint8 auth_level, + uint8 stub_type_len, + char *signature, uint32 msg_type); +void smb_io_rpc_auth_verifier(char *desc, RPC_AUTH_VERIFIER *rav, prs_struct *ps, int depth); +void make_rpc_auth_ntlmssp_chal(RPC_AUTH_NTLMSSP_CHAL *chl, + uint32 neg_flags, + uint8 challenge[8]); +void smb_io_rpc_auth_ntlmssp_chal(char *desc, RPC_AUTH_NTLMSSP_CHAL *chl, prs_struct *ps, int depth); void make_rpc_auth_ntlmssp_resp(RPC_AUTH_NTLMSSP_RESP *rsp, - uint8 auth_type, uint8 auth_level, uint8 stub_type_len, - fstring ntlmssp_str, uint32 ntlmssp_ver, - uint32 unknown_1, uint32 unknown_2, uint32 unknown_3, - uint8 data[16]); + uchar lm_resp[24], uchar nt_resp[24], + char *domain, char *user, char *wks, + uint32 neg_flags); void smb_io_rpc_auth_ntlmssp_resp(char *desc, RPC_AUTH_NTLMSSP_RESP *rsp, prs_struct *ps, int depth); /*The following definitions come from rpc_parse/parse_samr.c */ @@ -2318,6 +2331,7 @@ int smbw_chmod(const char *fname, mode_t newmode); off_t smbw_lseek(int fd, off_t offset, int whence); int smbw_dup(int fd); int smbw_dup2(int fd, int fd2); +int smbw_fork(void); /*The following definitions come from smbwrapper/smbw_dir.c */ diff --git a/source3/include/rpc_dce.h b/source3/include/rpc_dce.h index 2e3995e43d..31964d4f37 100644 --- a/source3/include/rpc_dce.h +++ b/source3/include/rpc_dce.h @@ -41,6 +41,28 @@ enum RPC_PKT_TYPE #define RPC_FLG_FIRST 0x01 #define RPC_FLG_LAST 0x02 +/* NTLMSSP message types */ +enum NTLM_MESSAGE_TYPE +{ + NTLMSSP_NEGOTIATE = 1, + NTLMSSP_CHALLENGE = 2, + NTLMSSP_AUTH = 3, + NTLMSSP_UNKNOWN = 4, +}; + +/* NTLMSSP negotiation flags */ +#define NTLMSSP_NEGOTIATE_UNICODE 0x00000001 +#define NTLMSSP_NEGOTIATE_OEM 0x00000002 +#define NTLMSSP_REQUEST_TARGET 0x00000004 +#define NTLMSSP_NEGOTIATE_SIGN 0x00000010 +#define NTLMSSP_NEGOTIATE_SEAL 0x00000020 +#define NTLMSSP_NEGOTIATE_LM_KEY 0x00000080 +#define NTLMSSP_NEGOTIATE_NTLM 0x00000200 +#define NTLMSSP_NEGOTIATE_ALWAYS_SIGN 0x00008000 +#define NTLMSSP_NEGOTIATE_NTLM2 0x00080000 +#define NTLMSSP_NEGOTIATE_TARGET_INFO 0x00800000 +#define NTLMSSP_NEGOTIATE_128 0x20000000 +#define NTLMSSP_NEGOTIATE_KEY_EXCH 0x40000000 /* RPC_IFACE */ typedef struct rpc_iface_info @@ -161,57 +183,76 @@ typedef struct rpc_hdr_ba_info /* RPC_AUTH_VERIFIER */ typedef struct rpc_auth_verif_info { - fstring ssp_str; - uint32 ssp_ver; + uint8 auth_type; /* 0x0a */ + uint8 auth_level; /* 0x06 */ + uint8 stub_type_len; /* don't know */ + uint8 padding; /* padding */ + + uint32 ptr_0; /* non-zero pointer to something */ + + fstring signature; /* "NTLMSSP" */ + uint32 msg_type; /* NTLMSSP_MESSAGE_TYPE (1,2,3) */ } RPC_AUTH_VERIFIER; /* this is TEMPORARILY coded up as a specific structure */ /* this structure comes after the bind request */ -/* RPC_AUTH_NTLMSSP_REQ */ -typedef struct rpc_auth_ntlmssp_req_info +/* RPC_AUTH_NTLMSSP_NEG */ +typedef struct rpc_auth_ntlmssp_neg_info { - fstring ntlmssp_str; /* "NTLMSSP" */ - uint32 ntlmssp_ver; /* 0x0000 0001 */ + uint32 neg_flgs; /* 0x0000 b2b3 */ - uint32 unknown_0; /* 0x00b2b3 */ STRHDR hdr_myname; /* offset is against START of this structure */ STRHDR hdr_domain; /* offset is against START of this structure */ fstring myname; /* calling workstation's name */ fstring domain; /* calling workstations's domain */ -} RPC_AUTH_NTLMSSP_REQ; +} RPC_AUTH_NTLMSSP_NEG; /* this is TEMPORARILY coded up as a specific structure */ /* this structure comes after the bind acknowledgement */ -/* RPC_AUTH_NTLMSSP_RESP */ -typedef struct rpc_auth_ntlmssp_resp_info +/* RPC_AUTH_NTLMSSP_CHAL */ +typedef struct rpc_auth_ntlmssp_chal_info { - uint8 auth_type; /* 0x0a */ - uint8 auth_level; /* 0x06 */ - uint8 stub_type_len; /* don't know */ - uint8 padding; /* padding */ + uint32 unknown_1; /* 0x0000 0000 */ + uint32 unknown_2; /* 0x0000 0028 */ + uint32 neg_flags; /* 0x0000 82b1 */ - uint32 ptr_0; /* non-zero pointer to something */ + uint8 challenge[8]; /* ntlm challenge */ + uint8 reserved [8]; /* zeros */ - fstring ntlmssp_str; /* "NTLMSSP" */ - uint32 ntlmssp_ver; /* 0x0000 0002 */ +} RPC_AUTH_NTLMSSP_CHAL; - uint32 unknown_1; /* 0x0000 0000 */ - uint32 unknown_2; /* 0x00b2b3 */ - uint32 unknown_3; /* 0x0082b1 */ - uint8 data[16]; /* 0x10 bytes of something */ +/* RPC_AUTH_NTLMSSP_RESP */ +typedef struct rpc_auth_ntlmssp_resp_info +{ + STRHDR hdr_lm_resp; /* 24 byte response */ + STRHDR hdr_nt_resp; /* 24 byte response */ + STRHDR hdr_domain; + UNIHDR hdr_usr; + UNIHDR hdr_wks; + UNIHDR hdr_sess_key; /* NULL unless negotiated */ + uint32 neg_flags; /* 0x0000 82b1 */ + + fstring uni_sess_key; + fstring uni_wks; + fstring uni_usr; + fstring uni_domain; + fstring str_nt_resp; + fstring str_lm_resp; } RPC_AUTH_NTLMSSP_RESP; + /* attached to the end of encrypted rpc requests and responses */ /* RPC_AUTH_NTLMSSP_CHK */ typedef struct rpc_auth_ntlmssp_chk_info { - uint32 ver; /* 0x1 */ - uint8 data[12]; + uint32 ver; /* 0x0000 0001 */ + uint8 crc32[8]; /* checksum using 0xEDB8 8320 as a polynomial */ + uint32 seq_num; } RPC_AUTH_NTLMSSP_CHK; -- cgit