diff options
-rw-r--r-- | source3/include/rpc_netlogon.h | 81 | ||||
-rw-r--r-- | source3/rpc_client/cli_netlogon.c | 32 | ||||
-rw-r--r-- | source3/rpc_parse/parse_net.c | 432 |
3 files changed, 0 insertions, 545 deletions
diff --git a/source3/include/rpc_netlogon.h b/source3/include/rpc_netlogon.h index f2802b8e72..f8c9fc5c7f 100644 --- a/source3/include/rpc_netlogon.h +++ b/source3/include/rpc_netlogon.h @@ -317,87 +317,6 @@ typedef struct netlogon_3_info { ********************************************************/ -/* NET_Q_LOGON_CTRL - LSA Netr Logon Control */ - -typedef struct net_q_logon_ctrl_info { - uint32 ptr; - UNISTR2 uni_server_name; - uint32 function_code; - uint32 query_level; -} NET_Q_LOGON_CTRL; - -/* NET_R_LOGON_CTRL - LSA Netr Logon Control */ - -typedef struct net_r_logon_ctrl_info { - uint32 switch_value; - uint32 ptr; - - union { - NETLOGON_INFO_1 info1; - } logon; - - NTSTATUS status; -} NET_R_LOGON_CTRL; - - -typedef struct ctrl_data_info_5 { - uint32 function_code; - - uint32 ptr_domain; - UNISTR2 domain; -} CTRL_DATA_INFO_5; - -typedef struct ctrl_data_info_6 { - uint32 function_code; - - uint32 ptr_domain; - UNISTR2 domain; -} CTRL_DATA_INFO_6; - - -/******************************************************** - Logon Control2 Query - - query_level 0x1 - pdc status - query_level 0x3 - number of logon attempts. - - ********************************************************/ - -/* NET_Q_LOGON_CTRL2 - LSA Netr Logon Control 2 */ -typedef struct net_q_logon_ctrl2_info { - uint32 ptr; /* undocumented buffer pointer */ - UNISTR2 uni_server_name; /* server name, starting with two '\'s */ - - uint32 function_code; - uint32 query_level; - union { - CTRL_DATA_INFO_5 info5; - CTRL_DATA_INFO_6 info6; - } info; -} NET_Q_LOGON_CTRL2; - -/******************************************************* - Logon Control Response - - switch_value is same as query_level in request - *******************************************************/ - -/* NET_R_LOGON_CTRL2 - response to LSA Logon Control2 */ -typedef struct net_r_logon_ctrl2_info { - uint32 switch_value; /* 0x1, 0x3 */ - uint32 ptr; - - union - { - NETLOGON_INFO_1 info1; - NETLOGON_INFO_2 info2; - NETLOGON_INFO_3 info3; - - } logon; - - NTSTATUS status; /* return code */ -} NET_R_LOGON_CTRL2; - /* NEG_FLAGS */ typedef struct neg_flags_info { uint32 neg_flags; /* negotiated flags */ diff --git a/source3/rpc_client/cli_netlogon.c b/source3/rpc_client/cli_netlogon.c index a6167bb851..d28df3c164 100644 --- a/source3/rpc_client/cli_netlogon.c +++ b/source3/rpc_client/cli_netlogon.c @@ -347,38 +347,6 @@ NTSTATUS rpccli_netlogon_setup_creds(struct rpc_pipe_client *cli, return NT_STATUS_OK; } -/* Logon Control 2 */ - -NTSTATUS rpccli_netlogon_logon_ctrl2(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, - uint32 query_level) -{ - prs_struct qbuf, rbuf; - NET_Q_LOGON_CTRL2 q; - NET_R_LOGON_CTRL2 r; - NTSTATUS result = NT_STATUS_UNSUCCESSFUL; - fstring server; - - ZERO_STRUCT(q); - ZERO_STRUCT(r); - - /* Initialise input parameters */ - - slprintf(server, sizeof(fstring)-1, "\\\\%s", cli->cli->desthost); - init_net_q_logon_ctrl2(&q, server, query_level); - - /* Marshall data and send request */ - - CLI_DO_RPC(cli, mem_ctx, PI_NETLOGON, NET_LOGON_CTRL2, - q, r, - qbuf, rbuf, - net_io_q_logon_ctrl2, - net_io_r_logon_ctrl2, - NT_STATUS_UNSUCCESSFUL); - - result = r.status; - return result; -} - /* Sam synchronisation */ NTSTATUS rpccli_netlogon_sam_sync(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index 257f461d7c..8105ac5470 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -47,438 +47,6 @@ static bool net_io_neg_flags(const char *desc, NEG_FLAGS *neg, prs_struct *ps, i } /******************************************************************* - Inits a NETLOGON_INFO_3 structure. -********************************************************************/ - -static void init_netinfo_3(NETLOGON_INFO_3 *info, uint32 flags, uint32 logon_attempts) -{ - info->flags = flags; - info->logon_attempts = logon_attempts; - info->reserved_1 = 0x0; - info->reserved_2 = 0x0; - info->reserved_3 = 0x0; - info->reserved_4 = 0x0; - info->reserved_5 = 0x0; -} - -/******************************************************************* - Reads or writes a NETLOGON_INFO_3 structure. -********************************************************************/ - -static bool net_io_netinfo_3(const char *desc, NETLOGON_INFO_3 *info, prs_struct *ps, int depth) -{ - if (info == NULL) - return False; - - prs_debug(ps, depth, desc, "net_io_netinfo_3"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("flags ", ps, depth, &info->flags)) - return False; - if(!prs_uint32("logon_attempts", ps, depth, &info->logon_attempts)) - return False; - if(!prs_uint32("reserved_1 ", ps, depth, &info->reserved_1)) - return False; - if(!prs_uint32("reserved_2 ", ps, depth, &info->reserved_2)) - return False; - if(!prs_uint32("reserved_3 ", ps, depth, &info->reserved_3)) - return False; - if(!prs_uint32("reserved_4 ", ps, depth, &info->reserved_4)) - return False; - if(!prs_uint32("reserved_5 ", ps, depth, &info->reserved_5)) - return False; - - return True; -} - - -/******************************************************************* - Inits a NETLOGON_INFO_1 structure. -********************************************************************/ - -static void init_netinfo_1(NETLOGON_INFO_1 *info, uint32 flags, uint32 pdc_status) -{ - info->flags = flags; - info->pdc_status = pdc_status; -} - -/******************************************************************* - Reads or writes a NETLOGON_INFO_1 structure. -********************************************************************/ - -static bool net_io_netinfo_1(const char *desc, NETLOGON_INFO_1 *info, prs_struct *ps, int depth) -{ - if (info == NULL) - return False; - - prs_debug(ps, depth, desc, "net_io_netinfo_1"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("flags ", ps, depth, &info->flags)) - return False; - if(!prs_uint32("pdc_status", ps, depth, &info->pdc_status)) - return False; - - return True; -} - -/******************************************************************* - Inits a NETLOGON_INFO_2 structure. -********************************************************************/ - -static void init_netinfo_2(NETLOGON_INFO_2 *info, uint32 flags, uint32 pdc_status, - uint32 tc_status, const char *trusted_dc_name) -{ - info->flags = flags; - info->pdc_status = pdc_status; - info->ptr_trusted_dc_name = 1; - info->tc_status = tc_status; - - if (trusted_dc_name != NULL) - init_unistr2(&info->uni_trusted_dc_name, trusted_dc_name, UNI_STR_TERMINATE); - else - init_unistr2(&info->uni_trusted_dc_name, "", UNI_STR_TERMINATE); -} - -/******************************************************************* - Reads or writes a NETLOGON_INFO_2 structure. -********************************************************************/ - -static bool net_io_netinfo_2(const char *desc, NETLOGON_INFO_2 *info, prs_struct *ps, int depth) -{ - if (info == NULL) - return False; - - prs_debug(ps, depth, desc, "net_io_netinfo_2"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("flags ", ps, depth, &info->flags)) - return False; - if(!prs_uint32("pdc_status ", ps, depth, &info->pdc_status)) - return False; - if(!prs_uint32("ptr_trusted_dc_name", ps, depth, &info->ptr_trusted_dc_name)) - return False; - if(!prs_uint32("tc_status ", ps, depth, &info->tc_status)) - return False; - - if (info->ptr_trusted_dc_name != 0) { - if(!smb_io_unistr2("unistr2", &info->uni_trusted_dc_name, info->ptr_trusted_dc_name, ps, depth)) - return False; - } - - if(!prs_align(ps)) - return False; - - return True; -} - -static bool net_io_ctrl_data_info_5(const char *desc, CTRL_DATA_INFO_5 *info, prs_struct *ps, int depth) -{ - if (info == NULL) - return False; - - prs_debug(ps, depth, desc, "net_io_ctrl_data_info_5"); - depth++; - - if ( !prs_uint32( "function_code", ps, depth, &info->function_code ) ) - return False; - - if(!prs_uint32("ptr_domain", ps, depth, &info->ptr_domain)) - return False; - - if ( info->ptr_domain ) { - if(!smb_io_unistr2("domain", &info->domain, info->ptr_domain, ps, depth)) - return False; - } - - return True; -} - -static bool net_io_ctrl_data_info_6(const char *desc, CTRL_DATA_INFO_6 *info, prs_struct *ps, int depth) -{ - if (info == NULL) - return False; - - prs_debug(ps, depth, desc, "net_io_ctrl_data_info_6"); - depth++; - - if ( !prs_uint32( "function_code", ps, depth, &info->function_code ) ) - return False; - - if(!prs_uint32("ptr_domain", ps, depth, &info->ptr_domain)) - return False; - - if ( info->ptr_domain ) { - if(!smb_io_unistr2("domain", &info->domain, info->ptr_domain, ps, depth)) - return False; - } - - return True; -} - -/******************************************************************* - Reads or writes an NET_Q_LOGON_CTRL2 structure. -********************************************************************/ - -bool net_io_q_logon_ctrl2(const char *desc, NET_Q_LOGON_CTRL2 *q_l, prs_struct *ps, int depth) -{ - if (q_l == NULL) - return False; - - prs_debug(ps, depth, desc, "net_io_q_logon_ctrl2"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("ptr ", ps, depth, &q_l->ptr)) - return False; - - if(!smb_io_unistr2 ("", &q_l->uni_server_name, q_l->ptr, ps, depth)) - return False; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("function_code", ps, depth, &q_l->function_code)) - return False; - if(!prs_uint32("query_level ", ps, depth, &q_l->query_level)) - return False; - switch ( q_l->function_code ) { - case NETLOGON_CONTROL_REDISCOVER: - if ( !net_io_ctrl_data_info_5( "ctrl_data_info5", &q_l->info.info5, ps, depth) ) - return False; - break; - - case NETLOGON_CONTROL_TC_QUERY: - if ( !net_io_ctrl_data_info_6( "ctrl_data_info6", &q_l->info.info6, ps, depth) ) - return False; - break; - - default: - DEBUG(0,("net_io_q_logon_ctrl2: unknown function_code [%d]\n", - q_l->function_code)); - return False; - } - - return True; -} - -/******************************************************************* - Inits an NET_Q_LOGON_CTRL2 structure. -********************************************************************/ - -void init_net_q_logon_ctrl2(NET_Q_LOGON_CTRL2 *q_l, const char *srv_name, - uint32 query_level) -{ - DEBUG(5,("init_q_logon_ctrl2\n")); - - q_l->function_code = 0x01; - q_l->query_level = query_level; - - init_unistr2(&q_l->uni_server_name, srv_name, UNI_STR_TERMINATE); -} - -/******************************************************************* - Inits an NET_R_LOGON_CTRL2 structure. -********************************************************************/ - -void init_net_r_logon_ctrl2(NET_R_LOGON_CTRL2 *r_l, uint32 query_level, - uint32 flags, uint32 pdc_status, - uint32 logon_attempts, uint32 tc_status, - const char *trusted_domain_name) -{ - r_l->switch_value = query_level; - - switch (query_level) { - case 1: - r_l->ptr = 1; /* undocumented pointer */ - init_netinfo_1(&r_l->logon.info1, flags, pdc_status); - r_l->status = NT_STATUS_OK; - break; - case 2: - r_l->ptr = 1; /* undocumented pointer */ - init_netinfo_2(&r_l->logon.info2, flags, pdc_status, - tc_status, trusted_domain_name); - r_l->status = NT_STATUS_OK; - break; - case 3: - r_l->ptr = 1; /* undocumented pointer */ - init_netinfo_3(&r_l->logon.info3, flags, logon_attempts); - r_l->status = NT_STATUS_OK; - break; - default: - DEBUG(2,("init_r_logon_ctrl2: unsupported switch value %d\n", - r_l->switch_value)); - r_l->ptr = 0; /* undocumented pointer */ - - /* take a guess at an error code... */ - r_l->status = NT_STATUS_INVALID_INFO_CLASS; - break; - } -} - -/******************************************************************* - Reads or writes an NET_R_LOGON_CTRL2 structure. -********************************************************************/ - -bool net_io_r_logon_ctrl2(const char *desc, NET_R_LOGON_CTRL2 *r_l, prs_struct *ps, int depth) -{ - if (r_l == NULL) - return False; - - prs_debug(ps, depth, desc, "net_io_r_logon_ctrl2"); - depth++; - - if(!prs_uint32("switch_value ", ps, depth, &r_l->switch_value)) - return False; - if(!prs_uint32("ptr ", ps, depth, &r_l->ptr)) - return False; - - if (r_l->ptr != 0) { - switch (r_l->switch_value) { - case 1: - if(!net_io_netinfo_1("", &r_l->logon.info1, ps, depth)) - return False; - break; - case 2: - if(!net_io_netinfo_2("", &r_l->logon.info2, ps, depth)) - return False; - break; - case 3: - if(!net_io_netinfo_3("", &r_l->logon.info3, ps, depth)) - return False; - break; - default: - DEBUG(2,("net_io_r_logon_ctrl2: unsupported switch value %d\n", - r_l->switch_value)); - break; - } - } - - if(!prs_ntstatus("status ", ps, depth, &r_l->status)) - return False; - - return True; -} - -/******************************************************************* - Reads or writes an NET_Q_LOGON_CTRL structure. -********************************************************************/ - -bool net_io_q_logon_ctrl(const char *desc, NET_Q_LOGON_CTRL *q_l, prs_struct *ps, - int depth) -{ - prs_debug(ps, depth, desc, "net_io_q_logon_ctrl"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("ptr ", ps, depth, &q_l->ptr)) - return False; - - if(!smb_io_unistr2 ("", &q_l->uni_server_name, q_l->ptr, ps, depth)) - return False; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("function_code", ps, depth, &q_l->function_code)) - return False; - if(!prs_uint32("query_level ", ps, depth, &q_l->query_level)) - return False; - - return True; -} - -/******************************************************************* - Inits an NET_Q_LOGON_CTRL structure. -********************************************************************/ - -void init_net_q_logon_ctrl(NET_Q_LOGON_CTRL *q_l, const char *srv_name, - uint32 query_level) -{ - DEBUG(5,("init_q_logon_ctrl\n")); - - q_l->function_code = 0x01; /* ??? */ - q_l->query_level = query_level; - - init_unistr2(&q_l->uni_server_name, srv_name, UNI_STR_TERMINATE); -} - -/******************************************************************* - Inits an NET_R_LOGON_CTRL structure. -********************************************************************/ - -void init_net_r_logon_ctrl(NET_R_LOGON_CTRL *r_l, uint32 query_level, - uint32 flags, uint32 pdc_status) -{ - DEBUG(5,("init_r_logon_ctrl\n")); - - r_l->switch_value = query_level; /* should only be 0x1 */ - - switch (query_level) { - case 1: - r_l->ptr = 1; /* undocumented pointer */ - init_netinfo_1(&r_l->logon.info1, flags, pdc_status); - r_l->status = NT_STATUS_OK; - break; - default: - DEBUG(2,("init_r_logon_ctrl: unsupported switch value %d\n", - r_l->switch_value)); - r_l->ptr = 0; /* undocumented pointer */ - - /* take a guess at an error code... */ - r_l->status = NT_STATUS_INVALID_INFO_CLASS; - break; - } -} - -/******************************************************************* - Reads or writes an NET_R_LOGON_CTRL structure. -********************************************************************/ - -bool net_io_r_logon_ctrl(const char *desc, NET_R_LOGON_CTRL *r_l, prs_struct *ps, - int depth) -{ - prs_debug(ps, depth, desc, "net_io_r_logon_ctrl"); - depth++; - - if(!prs_uint32("switch_value ", ps, depth, &r_l->switch_value)) - return False; - if(!prs_uint32("ptr ", ps, depth, &r_l->ptr)) - return False; - - if (r_l->ptr != 0) { - switch (r_l->switch_value) { - case 1: - if(!net_io_netinfo_1("", &r_l->logon.info1, ps, depth)) - return False; - break; - default: - DEBUG(2,("net_io_r_logon_ctrl: unsupported switch value %d\n", - r_l->switch_value)); - break; - } - } - - if(!prs_ntstatus("status ", ps, depth, &r_l->status)) - return False; - - return True; -} - -/******************************************************************* Inits an NET_Q_REQ_CHAL structure. ********************************************************************/ |