From 2f68d6f5ec925f07a387f784db6de0cfbaa53278 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jean-Fran=C3=A7ois=20Micouleau?= Date: Wed, 21 Aug 2002 23:08:28 +0000 Subject: [PATCH] NETLOGON NetServerAuthenticate3 include and parser file J.F. --- source/include/rpc_netlogon.h | 41 +++++++++++++----- source/rpc_parse/parse_net.c | 81 ++++++++++++++++++++++++++++++++++- 2 files changed, 110 insertions(+), 12 deletions(-) diff --git a/source/include/rpc_netlogon.h b/source/include/rpc_netlogon.h index 80b00fbaad4..3c19c574f06 100644 --- a/source/include/rpc_netlogon.h +++ b/source/include/rpc_netlogon.h @@ -4,6 +4,7 @@ Copyright (C) Andrew Tridgell 1992-1997 Copyright (C) Luke Kenneth Casson Leighton 1996-1997 Copyright (C) Paul Ashton 1997 + Copyright (C) Jean François Micouleau 2002 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 @@ -25,17 +26,18 @@ /* NETLOGON pipe */ -#define NET_SAMLOGON 0x02 -#define NET_SAMLOGOFF 0x03 -#define NET_REQCHAL 0x04 -#define NET_AUTH 0x05 -#define NET_SRVPWSET 0x06 -#define NET_SAM_DELTAS 0x07 -#define NET_LOGON_CTRL 0x0c -#define NET_AUTH2 0x0f -#define NET_LOGON_CTRL2 0x0e -#define NET_SAM_SYNC 0x10 -#define NET_TRUST_DOM_LIST 0x13 +#define NET_SAMLOGON 0x02 +#define NET_SAMLOGOFF 0x03 +#define NET_REQCHAL 0x04 +#define NET_AUTH 0x05 +#define NET_SRVPWSET 0x06 +#define NET_SAM_DELTAS 0x07 +#define NET_LOGON_CTRL 0x0c +#define NET_AUTH2 0x0f +#define NET_LOGON_CTRL2 0x0e +#define NET_SAM_SYNC 0x10 +#define NET_TRUST_DOM_LIST 0x13 +#define NET_AUTH3 0x1a /* Secure Channel types. used in NetrServerAuthenticate negotiation */ #define SEC_CHAN_WKSTA 2 @@ -370,6 +372,23 @@ typedef struct net_r_auth2_info NTSTATUS status; /* return code */ } NET_R_AUTH_2; +/* NET_Q_AUTH_3 */ +typedef struct net_q_auth3_info +{ + DOM_LOG_INFO clnt_id; /* client identification info */ + DOM_CHAL clnt_chal; /* client-calculated credentials */ + NEG_FLAGS clnt_flgs; /* usually 0x6007 ffff */ +} NET_Q_AUTH_3; + +/* NET_R_AUTH_3 */ +typedef struct net_r_auth3_info +{ + DOM_CHAL srv_chal; /* server-calculated credentials */ + NEG_FLAGS srv_flgs; /* usually 0x6007 ffff */ + uint32 unknown; /* 0x0000045b */ + NTSTATUS status; /* return code */ +} NET_R_AUTH_3; + /* NET_Q_SRV_PWSET */ typedef struct net_q_srv_pwset_info diff --git a/source/rpc_parse/parse_net.c b/source/rpc_parse/parse_net.c index da49a6531d0..7f8d1953d1a 100644 --- a/source/rpc_parse/parse_net.c +++ b/source/rpc_parse/parse_net.c @@ -4,7 +4,8 @@ * Copyright (C) Andrew Tridgell 1992-1997, * Copyright (C) Luke Kenneth Casson Leighton 1996-1997, * Copyright (C) Paul Ashton 1997. - * + * Copyright (C) Jean François Micouleau 2002. + * * 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 * the Free Software Foundation; either version 2 of the License, or @@ -740,6 +741,84 @@ BOOL net_io_r_auth_2(char *desc, NET_R_AUTH_2 *r_a, prs_struct *ps, int depth) return True; } +/******************************************************************* + Inits a NET_Q_AUTH_3 struct. +********************************************************************/ + +void init_q_auth_3(NET_Q_AUTH_3 *q_a, + const char *logon_srv, const char *acct_name, uint16 sec_chan, const char *comp_name, + DOM_CHAL *clnt_chal, uint32 clnt_flgs) +{ + DEBUG(5,("init_q_auth_3: %d\n", __LINE__)); + + init_log_info(&q_a->clnt_id, logon_srv, acct_name, sec_chan, comp_name); + memcpy(q_a->clnt_chal.data, clnt_chal->data, sizeof(clnt_chal->data)); + q_a->clnt_flgs.neg_flags = clnt_flgs; + + DEBUG(5,("init_q_auth_3: %d\n", __LINE__)); +} + +/******************************************************************* + Reads or writes a structure. +********************************************************************/ + +BOOL net_io_q_auth_3(char *desc, NET_Q_AUTH_3 *q_a, prs_struct *ps, int depth) +{ + int old_align; + if (q_a == NULL) + return False; + + prs_debug(ps, depth, desc, "net_io_q_auth_3"); + depth++; + + if(!prs_align(ps)) + return False; + + if(!smb_io_log_info ("", &q_a->clnt_id, ps, depth)) /* client identification info */ + return False; + /* client challenge is _not_ aligned */ + old_align = ps->align; + ps->align = 0; + if(!smb_io_chal("", &q_a->clnt_chal, ps, depth)) { + /* client-calculated credentials */ + ps->align = old_align; + return False; + } + ps->align = old_align; + if(!net_io_neg_flags("", &q_a->clnt_flgs, ps, depth)) + return False; + + return True; +} + +/******************************************************************* + Reads or writes a structure. +********************************************************************/ + +BOOL net_io_r_auth_3(char *desc, NET_R_AUTH_3 *r_a, prs_struct *ps, int depth) +{ + if (r_a == NULL) + return False; + + prs_debug(ps, depth, desc, "net_io_r_auth_3"); + depth++; + + if(!prs_align(ps)) + return False; + + if(!smb_io_chal("srv_chal", &r_a->srv_chal, ps, depth)) /* server challenge */ + return False; + if(!net_io_neg_flags("srv_flgs", &r_a->srv_flgs, ps, depth)) + return False; + if (!prs_uint32("unknown", ps, depth, &r_a->unknown)) + return False; + + if(!prs_ntstatus("status", ps, depth, &r_a->status)) + return False; + + return True; +} + /******************************************************************* Inits a NET_Q_SRV_PWSET. -- 2.34.1