From e9ea36e4d2270bd7d32da12ef6d6e2299641582d Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sat, 5 Sep 1998 05:07:05 +0000 Subject: tridge the destroyer returns! prompted by the interpret_security() dead code that Jean-Francois pointed out I added a make target "finddead" that finds potentially dead (ie. unused) code. It spat out 304 function names ... I went through these are deleted many of them, making others static (finddead also reports functions that are used only in the local file). in doing this I have almost certainly deleted some useful code. I may have even prevented compilation with some compile options. I apologise. I decided it was better to get rid of this code now and add back the one or two functions that are needed than to keep all this baggage. So, if I have done a bit too much "destroying" then let me know. Keep the swearing to a minimum :) One bit I didn't do is the ubibt code. Chris, can you look at that? Heaps of unused functions there. Can they be made static? (This used to be commit 2204475c87f3024ea8fd1fbd7385b2def617a46f) --- source3/rpc_parse/parse_net.c | 135 ++++-------------------------------------- 1 file changed, 12 insertions(+), 123 deletions(-) (limited to 'source3/rpc_parse/parse_net.c') diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index 182b3495db..12d6aca264 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -29,7 +29,7 @@ extern int DEBUGLEVEL; /******************************************************************* reads or writes a structure. ********************************************************************/ -void net_io_neg_flags(char *desc, NEG_FLAGS *neg, prs_struct *ps, int depth) +static void net_io_neg_flags(char *desc, NEG_FLAGS *neg, prs_struct *ps, int depth) { if (neg == NULL) return; @@ -44,7 +44,7 @@ void net_io_neg_flags(char *desc, NEG_FLAGS *neg, prs_struct *ps, int depth) /******************************************************************* creates a NETLOGON_INFO_3 structure. ********************************************************************/ -void make_netinfo_3(NETLOGON_INFO_3 *info, uint32 flags, uint32 logon_attempts) +static void make_netinfo_3(NETLOGON_INFO_3 *info, uint32 flags, uint32 logon_attempts) { info->flags = flags; info->logon_attempts = logon_attempts; @@ -58,7 +58,7 @@ void make_netinfo_3(NETLOGON_INFO_3 *info, uint32 flags, uint32 logon_attempts) /******************************************************************* reads or writes a NETLOGON_INFO_3 structure. ********************************************************************/ -void net_io_netinfo_3(char *desc, NETLOGON_INFO_3 *info, prs_struct *ps, int depth) +static void net_io_netinfo_3(char *desc, NETLOGON_INFO_3 *info, prs_struct *ps, int depth) { if (info == NULL) return; @@ -80,7 +80,7 @@ void net_io_netinfo_3(char *desc, NETLOGON_INFO_3 *info, prs_struct *ps, int de /******************************************************************* creates a NETLOGON_INFO_1 structure. ********************************************************************/ -void make_netinfo_1(NETLOGON_INFO_1 *info, uint32 flags, uint32 pdc_status) +static void make_netinfo_1(NETLOGON_INFO_1 *info, uint32 flags, uint32 pdc_status) { info->flags = flags; info->pdc_status = pdc_status; @@ -89,7 +89,7 @@ void make_netinfo_1(NETLOGON_INFO_1 *info, uint32 flags, uint32 pdc_status) /******************************************************************* reads or writes a NETLOGON_INFO_1 structure. ********************************************************************/ -void net_io_netinfo_1(char *desc, NETLOGON_INFO_1 *info, prs_struct *ps, int depth) +static void net_io_netinfo_1(char *desc, NETLOGON_INFO_1 *info, prs_struct *ps, int depth) { if (info == NULL) return; @@ -105,7 +105,7 @@ void net_io_netinfo_1(char *desc, NETLOGON_INFO_1 *info, prs_struct *ps, int de /******************************************************************* creates a NETLOGON_INFO_2 structure. ********************************************************************/ -void make_netinfo_2(NETLOGON_INFO_2 *info, uint32 flags, uint32 pdc_status, +static void make_netinfo_2(NETLOGON_INFO_2 *info, uint32 flags, uint32 pdc_status, uint32 tc_status, char *trusted_dc_name) { int len_dc_name = strlen(trusted_dc_name); @@ -127,7 +127,7 @@ void make_netinfo_2(NETLOGON_INFO_2 *info, uint32 flags, uint32 pdc_status, /******************************************************************* reads or writes a NETLOGON_INFO_2 structure. ********************************************************************/ -void net_io_netinfo_2(char *desc, NETLOGON_INFO_2 *info, prs_struct *ps, int depth) +static void net_io_netinfo_2(char *desc, NETLOGON_INFO_2 *info, prs_struct *ps, int depth) { if (info == NULL) return; @@ -149,24 +149,6 @@ void net_io_netinfo_2(char *desc, NETLOGON_INFO_2 *info, prs_struct *ps, int de prs_align(ps); } -/******************************************************************* -makes an NET_Q_LOGON_CTRL2 structure. -********************************************************************/ -void make_q_logon_ctrl2(NET_Q_LOGON_CTRL2 *q_l, char *server_name, - uint32 function_code) -{ - if (q_l == NULL) return; - - DEBUG(5,("make_q_logon_ctrl2\n")); - - q_l->ptr = 1; /* undocumented pointer */ - make_unistr2 (&(q_l->uni_server_name), server_name, strlen(server_name)); - - q_l->function_code = function_code; /* should only be 0x1 */ - q_l->query_level = function_code; /* should only be 0x1 */ - q_l->switch_value = function_code; /* should only be 0x1 */ -} - /******************************************************************* reads or writes an NET_Q_LOGON_CTRL2 structure. ********************************************************************/ @@ -340,20 +322,6 @@ void net_io_r_trust_dom(char *desc, NET_R_TRUST_DOM_LIST *r_t, prs_struct *ps, prs_uint32("status", ps, depth, &(r_t->status)); } -/******************************************************************* -makes an NET_Q_TRUST_DOM_LIST structure. -********************************************************************/ -void make_q_trust_dom(NET_Q_TRUST_DOM_LIST *q_l, char *server_name, - uint32 function_code) -{ - if (q_l == NULL) return; - - DEBUG(5,("make_q_trust_dom\n")); - - make_unistr2 (&(q_l->uni_server_name), server_name, strlen(server_name)); - - q_l->function_code = function_code; /* should only be 0x31 */ -} /******************************************************************* reads or writes an NET_Q_TRUST_DOM_LIST structure. @@ -570,89 +538,10 @@ static int make_dom_sid2s(char *sids_str, DOM_SID2 *sids, int max_sids) return count; } -/******************************************************************* -makes a NET_ID_INFO_1 structure. - -This is an interactive logon packet. The log_id parameters -are what an NT server would generate for LUID once the -user is logged on. I don't think we care about them. - -Note that this passes the actual NT and LM hashed passwords -over the secure channel. This is not the preferred logon -method from a Samba domain client as it exposes the password -hashes to anyone who has compromised the secure channel. JRA. -********************************************************************/ - -void make_id_info1(NET_ID_INFO_1 *id, char *domain_name, - uint32 param_ctrl, uint32 log_id_low, uint32 log_id_high, - char *user_name, char *wksta_name, - char sess_key[16], - unsigned char lm_cypher[16], unsigned char nt_cypher[16]) -{ - int len_domain_name = strlen(domain_name); - int len_user_name = strlen(user_name ); - int len_wksta_name = strlen(wksta_name ); - - unsigned char lm_owf[16]; - unsigned char nt_owf[16]; - - if (id == NULL) return; - - DEBUG(5,("make_id_info1: %d\n", __LINE__)); - - id->ptr_id_info1 = 1; - - make_uni_hdr(&(id->hdr_domain_name), len_domain_name, len_domain_name, 4); - - id->param_ctrl = param_ctrl; - make_logon_id(&(id->logon_id), log_id_low, log_id_high); - - make_uni_hdr(&(id->hdr_user_name ), len_user_name , len_user_name , 4); - make_uni_hdr(&(id->hdr_wksta_name ), len_wksta_name , len_wksta_name , 4); - - if (lm_cypher && nt_cypher) - { - void arcfour(uint8 key[16], uint8 out[16], uint8 in[16]); - unsigned char owf_key[16]; -#ifdef DEBUG_PASSWORD - DEBUG(100,("lm cypher:")); - dump_data(100, lm_cypher, 16); - - DEBUG(100,("nt cypher:")); - dump_data(100, nt_cypher, 16); -#endif - - memcpy(owf_key, sess_key, 16); - - memcpy(lm_owf, lm_cypher, 16); - memcpy(nt_owf, nt_cypher, 16); - SamOEMhash(lm_owf, owf_key, False); - SamOEMhash(nt_owf, owf_key, False); - -#ifdef DEBUG_PASSWORD - DEBUG(100,("hash of lm owf password:")); - dump_data(100, lm_owf, 16); - - DEBUG(100,("hash of nt owf password:")); - dump_data(100, nt_owf, 16); -#endif - /* set up pointers to blocks */ - lm_cypher = lm_owf; - nt_cypher = nt_owf; - } - - make_owf_info(&(id->lm_owf), lm_cypher); - make_owf_info(&(id->nt_owf), nt_cypher); - - make_unistr2(&(id->uni_domain_name), domain_name, len_domain_name); - make_unistr2(&(id->uni_user_name ), user_name , len_user_name ); - make_unistr2(&(id->uni_wksta_name ), wksta_name , len_wksta_name ); -} - /******************************************************************* reads or writes an NET_ID_INFO_1 structure. ********************************************************************/ -void net_io_id_info1(char *desc, NET_ID_INFO_1 *id, prs_struct *ps, int depth) +static void net_io_id_info1(char *desc, NET_ID_INFO_1 *id, prs_struct *ps, int depth) { if (id == NULL) return; @@ -754,7 +643,7 @@ void make_id_info2(NET_ID_INFO_2 *id, char *domain_name, /******************************************************************* reads or writes an NET_ID_INFO_2 structure. ********************************************************************/ -void net_io_id_info2(char *desc, NET_ID_INFO_2 *id, prs_struct *ps, int depth) +static void net_io_id_info2(char *desc, NET_ID_INFO_2 *id, prs_struct *ps, int depth) { if (id == NULL) return; @@ -821,7 +710,7 @@ void make_sam_info(DOM_SAM_INFO *sam, /******************************************************************* reads or writes a DOM_SAM_INFO structure. ********************************************************************/ -void net_io_id_info_ctr(char *desc, NET_ID_INFO_CTR *ctr, prs_struct *ps, int depth) +static void net_io_id_info_ctr(char *desc, NET_ID_INFO_CTR *ctr, prs_struct *ps, int depth) { if (ctr == NULL) return; @@ -856,7 +745,7 @@ void net_io_id_info_ctr(char *desc, NET_ID_INFO_CTR *ctr, prs_struct *ps, int d /******************************************************************* reads or writes a DOM_SAM_INFO structure. ********************************************************************/ -void smb_io_sam_info(char *desc, DOM_SAM_INFO *sam, prs_struct *ps, int depth) +static void smb_io_sam_info(char *desc, DOM_SAM_INFO *sam, prs_struct *ps, int depth) { if (sam == NULL) return; @@ -1004,7 +893,7 @@ void make_net_user_info3(NET_USER_INFO_3 *usr, /******************************************************************* reads or writes a structure. ********************************************************************/ -void net_io_user_info3(char *desc, NET_USER_INFO_3 *usr, prs_struct *ps, int depth) +static void net_io_user_info3(char *desc, NET_USER_INFO_3 *usr, prs_struct *ps, int depth) { int i; -- cgit