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/nmbd/nmbd_become_dmb.c | 108 ---------------------------------- source3/nmbd/nmbd_become_lmb.c | 4 +- source3/nmbd/nmbd_browserdb.c | 34 ----------- source3/nmbd/nmbd_namelistdb.c | 15 ----- source3/nmbd/nmbd_packets.c | 15 +++-- source3/nmbd/nmbd_responserecordsdb.c | 2 +- 6 files changed, 10 insertions(+), 168 deletions(-) (limited to 'source3/nmbd') diff --git a/source3/nmbd/nmbd_become_dmb.c b/source3/nmbd/nmbd_become_dmb.c index fe02f18f06..cfaec3378d 100644 --- a/source3/nmbd/nmbd_become_dmb.c +++ b/source3/nmbd/nmbd_become_dmb.c @@ -37,114 +37,6 @@ extern uint16 samba_nb_type; /* Samba's NetBIOS type. */ static void become_domain_master_browser_bcast(char *); -/******************************************************************* - Unbecome a domain master browser - name release success function. - ******************************************************************/ - -static void unbecome_dmb_success(struct subnet_record *subrec, - struct userdata_struct *userdata, - struct nmb_name *released_name, - struct in_addr released_ip) -{ - struct work_record *work = find_workgroup_on_subnet(subrec, released_name->name); - struct server_record *servrec; - - if(!work) - { - DEBUG(0,("unbecome_dmb_success: Cannot find workgroup %s on subnet %s\n", - released_name->name, subrec->subnet_name)); - return; - } - - if((servrec = find_server_in_workgroup( work, global_myname)) == NULL) - { - DEBUG(0,("unbecome_dmb_success: Error - cannot find server %s \ -in workgroup %s on subnet %s\n", - global_myname, released_name->name, subrec->subnet_name)); - return; - } - - /* Set the state in the workgroup structure. */ - work->dom_state = DOMAIN_NONE; - - /* Update our server status. */ - servrec->serv.type &= ~SV_TYPE_DOMAIN_MASTER; - - /* Tell the namelist writer to write out a change. */ - subrec->work_changed = True; - - /* Remove any list of local master browsers we are syncing with. */ - remove_workgroup_lmb_browsers(released_name->name); - - /* Delete the known domain master browser name from the workgroup - struct. */ - bzero((char *)&work->dmb_name, sizeof(work->dmb_name)); - putip((char *)&work->dmb_addr, &ipzero); - - if( DEBUGLVL( 0 ) ) - { - dbgtext( "*****\n\nSamba server %s ", global_myname ); - dbgtext( "has stopped being a domain master browser " ); - dbgtext( "for workgroup %s ", work->work_group ); - dbgtext( "on subnet %s.\n\n*****\n", subrec->subnet_name ); - } - -} - -/******************************************************************* - Unbecome a domain master browser - name release fail function. - ******************************************************************/ - -static void unbecome_dmb_fail(struct subnet_record *subrec, - struct response_record *rrec, - struct nmb_name *released_name) -{ - if( DEBUGLVL( 0 ) ) - { - dbgtext( "unbecome_dmb_fail: Failed to unbecome domain master browser " ); - dbgtext( "for workgroup %s ", released_name->name ); - dbgtext( "on subnet %s.\n", subrec->subnet_name ); - } -} - -/******************************************************************* - Unbecome a domain master browser. - ******************************************************************/ - -void unbecome_domain_master(char *workgroup_name) -{ - struct subnet_record *subrec; - - for (subrec = FIRST_SUBNET; subrec; subrec = NEXT_SUBNET_INCLUDING_UNICAST(subrec)) - { - struct work_record *work = find_workgroup_on_subnet(subrec, workgroup_name); - - if(work && (work->dom_state == DOMAIN_MST)) - { - struct name_record *namerec; - struct nmb_name nmbname; - make_nmb_name(&nmbname,workgroup_name,0x1b,scope); - - /* We can only do this if we are a domain master already. */ - DEBUG(2,("unbecome_domain_master: attempting to stop being a domain \ -master browser for workgroup %s on subnet %s\n", - work->work_group, subrec->subnet_name)); - - /* Find the WORKGROUP<1b> name on the subnet namelist. */ - if((namerec = find_name_on_subnet(subrec, &nmbname, FIND_SELF_NAME))==NULL) - { - DEBUG(0,("unbecome_domain_master: Cannot find name %s on subnet %s.\n", - namestr(&nmbname), subrec->subnet_name)); - continue; - } - release_name(subrec, namerec, - unbecome_dmb_success, - unbecome_dmb_fail, - NULL); - } - } -} - /**************************************************************************** Fail to become a Domain Master Browser on a subnet. ****************************************************************************/ diff --git a/source3/nmbd/nmbd_become_lmb.c b/source3/nmbd/nmbd_become_lmb.c index 3fe6f596fa..1e4f070271 100644 --- a/source3/nmbd/nmbd_become_lmb.c +++ b/source3/nmbd/nmbd_become_lmb.c @@ -138,7 +138,7 @@ in workgroup %s on subnet %s\n", Unbecome the local master browser name release success function. ******************************************************************/ -void unbecome_local_master_success(struct subnet_record *subrec, +static void unbecome_local_master_success(struct subnet_record *subrec, struct userdata_struct *userdata, struct nmb_name *released_name, struct in_addr released_ip) @@ -168,7 +168,7 @@ void unbecome_local_master_success(struct subnet_record *subrec, Unbecome the local master browser name release fail function. ******************************************************************/ -void unbecome_local_master_fail(struct subnet_record *subrec, struct response_record *rrec, +static void unbecome_local_master_fail(struct subnet_record *subrec, struct response_record *rrec, struct nmb_name *fail_name) { struct name_record *namerec; diff --git a/source3/nmbd/nmbd_browserdb.c b/source3/nmbd/nmbd_browserdb.c index 8e32dbd570..12ce00df4f 100644 --- a/source3/nmbd/nmbd_browserdb.c +++ b/source3/nmbd/nmbd_browserdb.c @@ -183,37 +183,3 @@ void expire_lmb_browsers( time_t t ) } } } /* expire_lmb_browsers */ - -/* ************************************************************************** ** - * Remove browsers from a named workgroup in the browserlist. - * - * Input: work_group - The name of the work group which is to be removed - * from the browse list. - * Output: none. - * - * ************************************************************************** ** - */ -void remove_workgroup_lmb_browsers( char *work_group ) -{ - struct browse_cache_record *browc; - struct browse_cache_record *nextbrowc; - - for( browc = (struct browse_cache_record *)ubi_dlFirst( lmb_browserlist ); - browc; - browc = nextbrowc ) - { - nextbrowc = (struct browse_cache_record *)ubi_dlNext( browc ); - - if( strequal( work_group, browc->work_group ) ) - { - if( DEBUGLVL( 3 ) ) - { - Debug1( "nmbd_browserdb:remove_workgroup_browsers()\n" ); - Debug1( "Removing lmb entry %s\n", browc->lmb_name ); - } - remove_lmb_browser_entry(browc); - } - } - } /* remove_workgroup_lmb_browsers */ - -/* ========================================================================== */ diff --git a/source3/nmbd/nmbd_namelistdb.c b/source3/nmbd/nmbd_namelistdb.c index 498cbcfdcf..f9b2e3da9a 100644 --- a/source3/nmbd/nmbd_namelistdb.c +++ b/source3/nmbd/nmbd_namelistdb.c @@ -44,21 +44,6 @@ void set_samba_nb_type(void) samba_nb_type = NB_BFLAG; /* samba is broadcast-only node type. */ } /* set_samba_nb_type */ -/* ************************************************************************** ** - * Returns True if the netbios name is ^1^2__MSBROWSE__^2^1. - * - * Note: This name is registered if as a master browser or backup browser - * you are responsible for a workgroup (when you announce a domain by - * broadcasting on your local subnet, you announce it as coming from this - * name: see announce_host()). - * - * ************************************************************************** ** - */ -BOOL ms_browser_name( char *name, int type ) - { - return( strequal( name, MSBROWSE ) && (type == 0x01) ); - } /* ms_browser_name */ - /* ************************************************************************** ** * Convert a NetBIOS name to upper case. * ************************************************************************** ** diff --git a/source3/nmbd/nmbd_packets.c b/source3/nmbd/nmbd_packets.c index 816695833a..10ce2da0c1 100644 --- a/source3/nmbd/nmbd_packets.c +++ b/source3/nmbd/nmbd_packets.c @@ -35,6 +35,8 @@ extern int num_response_packets; extern pstring scope; extern struct in_addr loopback_ip; +static void queue_packet(struct packet_struct *packet); + /******************************************************************* The global packet linked-list. Incoming entries are added to the end of this list. It is supposed to remain fairly @@ -963,8 +965,7 @@ for id %hu\n", /******************************************************************* Queue a packet into a packet queue ******************************************************************/ - -void queue_packet(struct packet_struct *packet) +static void queue_packet(struct packet_struct *packet) { struct packet_struct *p; @@ -1013,8 +1014,7 @@ static struct subnet_record *find_subnet_for_dgram_browse_packet(struct packet_s /**************************************************************************** Dispatch a browse frame from port 138 to the correct processing function. ****************************************************************************/ - -void process_browse_packet(struct packet_struct *p, char *buf,int len) +static void process_browse_packet(struct packet_struct *p, char *buf,int len) { struct dgram_packet *dgram = &p->packet.dgram; int command = CVAL(buf,0); @@ -1135,8 +1135,7 @@ command code %d from %s IP %s to %s\n", /**************************************************************************** Dispatch a LanMan browse frame from port 138 to the correct processing function. ****************************************************************************/ - -void process_lanman_packet(struct packet_struct *p, char *buf,int len) +static void process_lanman_packet(struct packet_struct *p, char *buf,int len) { struct dgram_packet *dgram = &p->packet.dgram; int command = SVAL(buf,0); @@ -1284,7 +1283,7 @@ static void process_dgram(struct packet_struct *p) Validate a response nmb packet. ****************************************************************************/ -BOOL validate_nmb_response_packet( struct nmb_packet *nmb ) +static BOOL validate_nmb_response_packet( struct nmb_packet *nmb ) { BOOL ignore = False; @@ -1338,7 +1337,7 @@ BOOL validate_nmb_response_packet( struct nmb_packet *nmb ) Validate a request nmb packet. ****************************************************************************/ -BOOL validate_nmb_packet( struct nmb_packet *nmb ) +static BOOL validate_nmb_packet( struct nmb_packet *nmb ) { BOOL ignore = False; diff --git a/source3/nmbd/nmbd_responserecordsdb.c b/source3/nmbd/nmbd_responserecordsdb.c index 21defa970c..3edca69981 100644 --- a/source3/nmbd/nmbd_responserecordsdb.c +++ b/source3/nmbd/nmbd_responserecordsdb.c @@ -37,7 +37,7 @@ int num_response_packets = 0; Add an expected response record into the list **************************************************************************/ -void add_response_record(struct subnet_record *subrec, +static void add_response_record(struct subnet_record *subrec, struct response_record *rrec) { struct response_record *rrec2; -- cgit