From 9930b0b0650ae3e38c033c28672398425dd8228c Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 1 Jul 2002 09:12:41 +0000 Subject: used findstatic.pl to make some variables static and remove some dead code (This used to be commit 91ad9041e9507d36eb3f40c23c5d4df61f139ef0) --- source3/client/client.c | 26 ++++----- source3/client/clitar.c | 24 ++++----- source3/include/md5.h | 1 - source3/lib/genrand.c | 4 +- source3/lib/interface.c | 27 ---------- source3/lib/md5.c | 4 +- source3/lib/talloc.c | 2 +- source3/lib/time.c | 5 -- source3/lib/util_sid.c | 28 ++-------- source3/lib/util_sock.c | 105 +++++++------------------------------ source3/libads/disp_sec.c | 18 ++----- source3/libsmb/namequery.c | 99 ---------------------------------- source3/nsswitch/wb_common.c | 2 +- source3/passdb/pdb_ldap.c | 2 +- source3/printing/printing.c | 2 +- source3/rpc_parse/parse_lsa.c | 12 ++--- source3/rpc_server/srv_srvsvc.c | 2 +- source3/rpc_server/srv_srvsvc_nt.c | 2 +- source3/rpc_server/srv_wkssvc.c | 2 +- source3/rpcclient/rpcclient.c | 2 +- source3/script/findstatic.pl | 5 ++ source3/smbd/fileio.c | 4 +- source3/smbd/vfs.c | 6 +-- 23 files changed, 80 insertions(+), 304 deletions(-) diff --git a/source3/client/client.c b/source3/client/client.c index 5b5910b49f..0eb264a853 100644 --- a/source3/client/client.c +++ b/source3/client/client.c @@ -34,7 +34,7 @@ extern BOOL in_client; extern BOOL AllowDebugChange; static int port = 0; pstring cur_dir = "\\"; -pstring cd_path = ""; +static pstring cd_path = ""; static pstring service; static pstring desthost; extern pstring global_myname; @@ -61,9 +61,9 @@ static int cmd_help(void); #define FID_UNUSED (0xFFFF) time_t newer_than = 0; -int archive_level = 0; +static int archive_level = 0; -BOOL translation = False; +static BOOL translation = False; static BOOL have_ip; @@ -74,30 +74,30 @@ extern BOOL tar_reset; /* clitar bits end */ -mode_t myumask = 0755; +static mode_t myumask = 0755; -BOOL prompt = True; +static BOOL prompt = True; -int printmode = 1; +static int printmode = 1; static BOOL recurse = False; BOOL lowercase = False; -struct in_addr dest_ip; +static struct in_addr dest_ip; #define SEPARATORS " \t\n\r" -BOOL abort_mget = True; +static BOOL abort_mget = True; -pstring fileselection = ""; +static pstring fileselection = ""; extern file_info def_finfo; /* timing globals */ int get_total_size = 0; int get_total_time_ms = 0; -int put_total_size = 0; -int put_total_time_ms = 0; +static int put_total_size = 0; +static int put_total_time_ms = 0; /* totals globals */ static double dir_total; @@ -1958,7 +1958,7 @@ static BOOL list_servers(char *wk_grp) * field is NULL, and NULL in that field is used in process_tok() * (below) to indicate the end of the list. crh */ -struct +static struct { char *name; int (*fn)(void); @@ -2238,7 +2238,7 @@ static void process_stdin(void) /***************************************************** return a connection to a server *******************************************************/ -struct cli_state *do_connect(const char *server, const char *share) +static struct cli_state *do_connect(const char *server, const char *share) { struct cli_state *c; struct nmb_name called, calling; diff --git a/source3/client/clitar.c b/source3/client/clitar.c index 10a00efb51..1d9d09066b 100644 --- a/source3/client/clitar.c +++ b/source3/client/clitar.c @@ -66,7 +66,7 @@ typedef struct } stack; -stack dir_stack = {NULL, 0}; /* Want an empty stack */ +static stack dir_stack = {NULL, 0}; /* Want an empty stack */ #define SEPARATORS " \t\n\r" extern struct cli_state *cli; @@ -86,25 +86,25 @@ static char *tarbuf, *buffer_p; static int tp, ntarf, tbufsiz; static double ttarf; /* Incremental mode */ -BOOL tar_inc=False; +static BOOL tar_inc=False; /* Reset archive bit */ -BOOL tar_reset=False; +static BOOL tar_reset=False; /* Include / exclude mode (true=include, false=exclude) */ -BOOL tar_excl=True; +static BOOL tar_excl=True; /* use regular expressions for search on file names */ -BOOL tar_re_search=False; +static BOOL tar_re_search=False; #ifdef HAVE_REGEX_H regex_t *preg; #endif /* Do not dump anything, just calculate sizes */ -BOOL dry_run=False; +static BOOL dry_run=False; /* Dump files with System attribute */ -BOOL tar_system=True; +static BOOL tar_system=True; /* Dump files with Hidden attribute */ -BOOL tar_hidden=True; +static BOOL tar_hidden=True; /* Be noisy - make a catalogue */ -BOOL tar_noisy=True; -BOOL tar_real_noisy=False; /* Don't want to be really noisy by default */ +static BOOL tar_noisy=True; +static BOOL tar_real_noisy=False; /* Don't want to be really noisy by default */ char tar_type='\0'; static char **cliplist=NULL; @@ -120,8 +120,8 @@ extern pstring cur_dir; extern int get_total_time_ms; extern int get_total_size; -int blocksize=20; -int tarhandle; +static int blocksize=20; +static int tarhandle; static void writetarheader(int f, char *aname, int size, time_t mtime, char *amode, unsigned char ftype); diff --git a/source3/include/md5.h b/source3/include/md5.h index dc2f2dd207..6665171e7c 100644 --- a/source3/include/md5.h +++ b/source3/include/md5.h @@ -15,7 +15,6 @@ void MD5Init(struct MD5Context *context); void MD5Update(struct MD5Context *context, unsigned char const *buf, unsigned len); void MD5Final(unsigned char digest[16], struct MD5Context *context); -void MD5Transform(uint32 buf[4], uint32 const in[16]); /* * This is needed to make RSAREF happy on some MS-DOS compilers. diff --git a/source3/lib/genrand.c b/source3/lib/genrand.c index 6296ead726..ee8bc0b1d5 100644 --- a/source3/lib/genrand.c +++ b/source3/lib/genrand.c @@ -24,8 +24,8 @@ static unsigned char hash[258]; static uint32 counter; -unsigned char *reseed_data; -size_t reseed_data_size; +static unsigned char *reseed_data; +static size_t reseed_data_size; /**************************************************************** Copy any user given reseed data. diff --git a/source3/lib/interface.c b/source3/lib/interface.c index 2704397fb2..0d751a9c7c 100644 --- a/source3/lib/interface.c +++ b/source3/lib/interface.c @@ -318,38 +318,11 @@ struct in_addr *iface_n_bcast(int n) } -/**************************************************************************** -this function provides a simple hash of the configured interfaces. It is -used to detect a change in interfaces to tell us whether to discard -the current wins.dat file. -Note that the result is independent of the order of the interfaces - **************************************************************************/ -unsigned iface_hash(void) -{ - unsigned ret = 0; - struct interface *i; - - for (i=local_interfaces;i;i=i->next) { - unsigned x1 = (unsigned)str_checksum(inet_ntoa(i->ip)); - unsigned x2 = (unsigned)str_checksum(inet_ntoa(i->nmask)); - ret ^= (x1 ^ x2); - } - - return ret; -} - - /* these 3 functions return the ip/bcast/nmask for the interface most appropriate for the given ip address. If they can't find an appropriate interface they return the requested field of the first known interface. */ -struct in_addr *iface_bcast(struct in_addr ip) -{ - struct interface *i = iface_find(ip, True); - return(i ? &i->bcast : &local_interfaces->bcast); -} - struct in_addr *iface_ip(struct in_addr ip) { struct interface *i = iface_find(ip, True); diff --git a/source3/lib/md5.c b/source3/lib/md5.c index 627725bb25..0d8f8e74d9 100644 --- a/source3/lib/md5.c +++ b/source3/lib/md5.c @@ -22,6 +22,8 @@ #include "md5.h" +void MD5Transform(uint32 buf[4], uint32 const in[16]); + /* * Note: this code is harmless on little-endian machines. */ @@ -161,7 +163,7 @@ void MD5Final(unsigned char digest[16], struct MD5Context *ctx) * reflect the addition of 16 longwords of new data. MD5Update blocks * the data and converts bytes into longwords for this routine. */ -void MD5Transform(uint32 buf[4], uint32 const in[16]) +static void MD5Transform(uint32 buf[4], uint32 const in[16]) { register uint32 a, b, c, d; diff --git a/source3/lib/talloc.c b/source3/lib/talloc.c index d81528588c..0f293e1725 100644 --- a/source3/lib/talloc.c +++ b/source3/lib/talloc.c @@ -82,7 +82,7 @@ struct talloc_ctx { * @todo We should turn the global list off when using Insure++, * otherwise all the memory will be seen as still reachable. **/ -TALLOC_CTX *list_head = NULL; +static TALLOC_CTX *list_head = NULL; /** diff --git a/source3/lib/time.c b/source3/lib/time.c index 9df4763b4c..9d87414aea 100644 --- a/source3/lib/time.c +++ b/source3/lib/time.c @@ -44,11 +44,6 @@ int extra_time_offset = 0; External access to time_t_min and time_t_max. ********************************************************************/ -time_t get_time_t_min(void) -{ - return TIME_T_MIN; -} - time_t get_time_t_max(void) { return TIME_T_MAX; diff --git a/source3/lib/util_sid.c b/source3/lib/util_sid.c index b27040b658..7d3bd848ef 100644 --- a/source3/lib/util_sid.c +++ b/source3/lib/util_sid.c @@ -34,16 +34,16 @@ DOM_SID global_sid_Builtin; /* Local well-known domain */ DOM_SID global_sid_World_Domain; /* Everyone domain */ DOM_SID global_sid_World; /* Everyone */ DOM_SID global_sid_Creator_Owner_Domain; /* Creator Owner domain */ -DOM_SID global_sid_Creator_Owner; /* Creator Owner */ -DOM_SID global_sid_Creator_Group; /* Creator Group */ DOM_SID global_sid_NT_Authority; /* NT Authority */ DOM_SID global_sid_NULL; /* NULL sid */ DOM_SID global_sid_Builtin_Guests; /* Builtin guest users */ DOM_SID global_sid_Authenticated_Users; /* All authenticated rids */ DOM_SID global_sid_Network; /* Network rids */ -DOM_SID global_sid_Anonymous; /* Anonymous login */ -const DOM_SID *global_sid_everyone = &global_sid_World; +static DOM_SID global_sid_Creator_Owner; /* Creator Owner */ +static DOM_SID global_sid_Creator_Group; /* Creator Group */ +static DOM_SID global_sid_Anonymous; /* Anonymous login */ +static const DOM_SID *global_sid_everyone = &global_sid_World; /* * An NT compatible anonymous token. @@ -302,24 +302,6 @@ void sid_copy(DOM_SID *dst, const DOM_SID *src) dst->sub_auths[i] = src->sub_auths[i]; } -/***************************************************************** - Duplicates a sid - mallocs the target. -*****************************************************************/ - -DOM_SID *sid_dup(DOM_SID *src) -{ - DOM_SID *dst; - - if(!src) - return NULL; - - if((dst = malloc(sizeof(DOM_SID))) != NULL) { - memset(dst, '\0', sizeof(DOM_SID)); - sid_copy( dst, src); - } - - return dst; -} /***************************************************************** Write a sid out into on-the-wire format. @@ -361,7 +343,7 @@ BOOL sid_parse(char *inbuf, size_t len, DOM_SID *sid) /***************************************************************** Compare the auth portion of two sids. *****************************************************************/ -int sid_compare_auth(const DOM_SID *sid1, const DOM_SID *sid2) +static int sid_compare_auth(const DOM_SID *sid1, const DOM_SID *sid2) { int i; diff --git a/source3/lib/util_sock.c b/source3/lib/util_sock.c index f72c4638dc..b16d34e1f4 100644 --- a/source3/lib/util_sock.c +++ b/source3/lib/util_sock.c @@ -50,7 +50,7 @@ typedef struct smb_socket_option { int opttype; } smb_socket_option; -smb_socket_option socket_options[] = { +static const smb_socket_option socket_options[] = { {"SO_KEEPALIVE", SOL_SOCKET, SO_KEEPALIVE, 0, OPT_BOOL}, {"SO_REUSEADDR", SOL_SOCKET, SO_REUSEADDR, 0, OPT_BOOL}, {"SO_BROADCAST", SOL_SOCKET, SO_BROADCAST, 0, OPT_BOOL}, @@ -189,7 +189,7 @@ ssize_t read_udp_socket(int fd,char *buf,size_t len) /******************************************************************* checks if read data is outstanding. ********************************************************************/ -int read_data_outstanding(int fd, unsigned int time_out) +static int read_data_outstanding(int fd, unsigned int time_out) { int selrtn; fd_set fds; @@ -364,20 +364,6 @@ ssize_t read_with_timeout(int fd, char *buf, size_t mincnt, size_t maxcnt, return((ssize_t)nread); } -/**************************************************************************** -send a keepalive packet (rfc1002) -****************************************************************************/ - -BOOL send_keepalive(int client) -{ - unsigned char buf[4]; - - buf[0] = SMBkeepalive; - buf[1] = buf[2] = buf[3] = 0; - - return(write_socket_data(client,(char *)buf,4) == 4); -} - /**************************************************************************** read data from the client, reading exactly N bytes. ****************************************************************************/ @@ -466,7 +452,7 @@ ssize_t write_data(int fd,char *buffer,size_t N) Write data to a socket - use send rather than write. ****************************************************************************/ -ssize_t write_socket_data(int fd,char *buffer,size_t N) +static ssize_t write_socket_data(int fd,char *buffer,size_t N) { size_t total=0; ssize_t ret; @@ -505,6 +491,21 @@ ssize_t write_socket(int fd,char *buf,size_t len) return(ret); } +/**************************************************************************** +send a keepalive packet (rfc1002) +****************************************************************************/ + +BOOL send_keepalive(int client) +{ + unsigned char buf[4]; + + buf[0] = SMBkeepalive; + buf[1] = buf[2] = buf[3] = 0; + + return(write_socket_data(client,(char *)buf,4) == 4); +} + + /**************************************************************************** read 4 bytes of a smb packet and return the smb length of the packet store the result in the buffer @@ -655,45 +656,6 @@ BOOL send_smb(int fd,char *buffer) return True; } -/**************************************************************************** -send a single packet to a port on another machine -****************************************************************************/ - -BOOL send_one_packet(char *buf,int len,struct in_addr ip,int port,int type) -{ - BOOL ret; - int out_fd; - struct sockaddr_in sock_out; - - /* create a socket to write to */ - out_fd = socket(AF_INET, type, 0); - if (out_fd == -1) - { - DEBUG(0,("socket failed")); - return False; - } - - /* set the address and port */ - memset((char *)&sock_out,'\0',sizeof(sock_out)); - putip((char *)&sock_out.sin_addr,(char *)&ip); - sock_out.sin_port = htons( port ); - sock_out.sin_family = AF_INET; - - if (DEBUGLEVEL > 0) - DEBUG(3,("sending a packet of len %d to (%s) on port %d of type %s\n", - len,inet_ntoa(ip),port,type==SOCK_DGRAM?"DGRAM":"STREAM")); - - /* send it */ - ret = (sys_sendto(out_fd,buf,len,0,(struct sockaddr *)&sock_out,sizeof(sock_out)) >= 0); - - if (!ret) - DEBUG(0,("Packet send to %s(%d) failed ERRNO=%s\n", - inet_ntoa(ip),port,strerror(errno))); - - close(out_fd); - return(ret); -} - /**************************************************************************** Open a socket of the specified type, port, and address for incoming data. ****************************************************************************/ @@ -1002,37 +964,6 @@ char *get_socket_addr(int fd) return addr_buf; } -/******************************************************************* - opens and connects to a unix pipe socket - ******************************************************************/ -int open_pipe_sock(char *path) -{ - int sock; - struct sockaddr_un sa; - - sock = socket(AF_UNIX, SOCK_STREAM, 0); - - if (sock < 0) - { - DEBUG(0, ("unix socket open failed\n")); - return sock; - } - - ZERO_STRUCT(sa); - sa.sun_family = AF_UNIX; - safe_strcpy(sa.sun_path, path, sizeof(sa.sun_path)-1); - - DEBUG(10, ("socket open succeeded. file name: %s\n", sa.sun_path)); - - if (connect(sock, (struct sockaddr*) &sa, sizeof(sa)) < 0) - { - DEBUG(0,("socket connect to %s failed\n", sa.sun_path)); - close(sock); - return -1; - } - - return sock; -} /******************************************************************* Create protected unix domain socket. diff --git a/source3/libads/disp_sec.c b/source3/libads/disp_sec.c index 35a7af7b36..a930fd6fe0 100644 --- a/source3/libads/disp_sec.c +++ b/source3/libads/disp_sec.c @@ -52,7 +52,7 @@ static struct perm_mask_str { }; /* convert a security permissions into a string */ -void ads_disp_perms(uint32 type) +static void ads_disp_perms(uint32 type) { int i = 0; int j = 0; @@ -82,20 +82,8 @@ void ads_disp_perms(uint32 type) puts(""); } -/* Check if ACE has OBJECT type */ -BOOL ads_ace_object(uint8 type) -{ - if (type == SEC_ACE_TYPE_ACCESS_ALLOWED_OBJECT || - type == SEC_ACE_TYPE_ACCESS_DENIED_OBJECT || - type == SEC_ACE_TYPE_SYSTEM_AUDIT_OBJECT || - type == SEC_ACE_TYPE_SYSTEM_ALARM_OBJECT) { - return True; - } - return False; -} - /* display ACE */ -void ads_disp_ace(SEC_ACE *sec_ace) +static void ads_disp_ace(SEC_ACE *sec_ace) { char *access_type = "UNKNOWN"; @@ -135,7 +123,7 @@ void ads_disp_ace(SEC_ACE *sec_ace) } /* display ACL */ -void ads_disp_acl(SEC_ACL *sec_acl, char *type) +static void ads_disp_acl(SEC_ACL *sec_acl, char *type) { if (!sec_acl) printf("------- (%s) ACL not present\n", type); diff --git a/source3/libsmb/namequery.c b/source3/libsmb/namequery.c index 2bf72fbaac..68c09751bd 100644 --- a/source3/libsmb/namequery.c +++ b/source3/libsmb/namequery.c @@ -207,97 +207,6 @@ BOOL name_status_find(const char *q_name, int q_type, int type, struct in_addr t return result; } -/**************************************************************************** - Do a NetBIOS name registation to try to claim a name ... -***************************************************************************/ -BOOL name_register(int fd, const char *name, int name_type, - struct in_addr name_ip, int opcode, - BOOL bcast, - struct in_addr to_ip, int *count) -{ - int retries = 3; - struct timeval tval; - struct packet_struct p; - struct packet_struct *p2; - struct nmb_packet *nmb = &p.packet.nmb; - struct in_addr register_ip; - - DEBUG(4, ("name_register: %s as %s on %s\n", name, inet_ntoa(name_ip), inet_ntoa(to_ip))); - - register_ip.s_addr = name_ip.s_addr; /* Fix this ... */ - - memset((char *)&p, '\0', sizeof(p)); - - *count = 0; - - nmb->header.name_trn_id = generate_trn_id(); - nmb->header.opcode = opcode; - nmb->header.response = False; - nmb->header.nm_flags.bcast = False; - nmb->header.nm_flags.recursion_available = False; - nmb->header.nm_flags.recursion_desired = True; /* ? */ - nmb->header.nm_flags.trunc = False; - nmb->header.nm_flags.authoritative = True; - - nmb->header.qdcount = 1; - nmb->header.ancount = 0; - nmb->header.nscount = 0; - nmb->header.arcount = 1; - - make_nmb_name(&nmb->question.question_name, name, name_type); - - nmb->question.question_type = 0x20; - nmb->question.question_class = 0x1; - - /* Now, create the additional stuff for a registration request */ - - if ((nmb->additional = (struct res_rec *)malloc(sizeof(struct res_rec))) == NULL) { - - DEBUG(0, ("name_register: malloc fail for additional record.\n")); - return False; - - } - - memset((char *)nmb->additional, '\0', sizeof(struct res_rec)); - - nmb->additional->rr_name = nmb->question.question_name; - nmb->additional->rr_type = RR_TYPE_NB; - nmb->additional->rr_class = RR_CLASS_IN; - - /* See RFC 1002, sections 5.1.1.1, 5.1.1.2 and 5.1.1.3 */ - if (nmb->header.nm_flags.bcast) - nmb->additional->ttl = PERMANENT_TTL; - else - nmb->additional->ttl = lp_max_ttl(); - - nmb->additional->rdlength = 6; - - nmb->additional->rdata[0] = NB_MFLAG & 0xFF; - - /* Set the address for the name we are registering. */ - putip(&nmb->additional->rdata[2], ®ister_ip); - - p.ip = to_ip; - p.port = NMB_PORT; - p.fd = fd; - p.timestamp = time(NULL); - p.packet_type = NMB_PACKET; - - GetTimeOfDay(&tval); - - if (!send_packet(&p)) - return False; - - retries--; - - if ((p2 = receive_nmb_packet(fd, 10, nmb->header.name_trn_id))) { - debug_nmb_packet(p2); - SAFE_FREE(p2); /* No memory leaks ... */ - } - - return True; -} - /* comparison function used by sort_ip_list @@ -1248,14 +1157,6 @@ NT GETDC call, UNICODE, NT domain SID and uncle tom cobbley and all... #endif /* defined(I_HATE_WINDOWS_REPLY_CODE) */ } -/******************************************************** - Get the IP address list of the Local Master Browsers - ********************************************************/ - -BOOL get_lmb_list(struct in_addr **ip_list, int *count) -{ - return internal_resolve_name( MSBROWSE, 0x1, ip_list, count); -} /******************************************************** Get the IP address list of the PDC/BDC's of a Domain. diff --git a/source3/nsswitch/wb_common.c b/source3/nsswitch/wb_common.c index 928b70d8b1..89dd625241 100644 --- a/source3/nsswitch/wb_common.c +++ b/source3/nsswitch/wb_common.c @@ -86,7 +86,7 @@ void init_response(struct winbindd_response *response) /* Close established socket */ -void close_sock(void) +static void close_sock(void) { if (winbindd_fd != -1) { close(winbindd_fd); diff --git a/source3/passdb/pdb_ldap.c b/source3/passdb/pdb_ldap.c index aef366fe7e..8e8e8f1574 100644 --- a/source3/passdb/pdb_ldap.c +++ b/source3/passdb/pdb_ldap.c @@ -136,7 +136,7 @@ static BOOL fetch_ldapsam_pw(char **dn, char** pw) return True; } -char *attr[] = {"uid", "pwdLastSet", "logonTime", +static const char *attr[] = {"uid", "pwdLastSet", "logonTime", "logoffTime", "kickoffTime", "cn", "pwdCanChange", "pwdMustChange", "dislplayName", "homeDrive", diff --git a/source3/printing/printing.c b/source3/printing/printing.c index f8b3c9cef0..654d79365b 100644 --- a/source3/printing/printing.c +++ b/source3/printing/printing.c @@ -22,7 +22,7 @@ #include "printing.h" /* Current printer interface */ -struct printif *current_printif = &generic_printif; +static struct printif *current_printif = &generic_printif; /* the printing backend revolves around a tdb database that stores the diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index 0cf7ea38f2..a6aecb7967 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -192,7 +192,7 @@ static BOOL lsa_io_sec_qos(char *desc, LSA_SEC_QOS *qos, prs_struct *ps, Inits an LSA_OBJ_ATTR structure. ********************************************************************/ -void init_lsa_obj_attr(LSA_OBJ_ATTR *attr, uint32 attributes, LSA_SEC_QOS *qos) +static void init_lsa_obj_attr(LSA_OBJ_ATTR *attr, uint32 attributes, LSA_SEC_QOS *qos) { DEBUG(5, ("init_lsa_obj_attr\n")); @@ -729,7 +729,7 @@ static BOOL lsa_io_dom_query_3(char *desc, DOM_QUERY_3 *d_q, prs_struct *ps, int Reads or writes a dom query structure. ********************************************************************/ -BOOL lsa_io_dom_query_5(char *desc, DOM_QUERY_5 *d_q, prs_struct *ps, int depth) +static BOOL lsa_io_dom_query_5(char *desc, DOM_QUERY_5 *d_q, prs_struct *ps, int depth) { return lsa_io_dom_query("", d_q, ps, depth); } @@ -808,7 +808,7 @@ BOOL lsa_io_r_query(char *desc, LSA_R_QUERY_INFO *r_q, prs_struct *ps, Inits a LSA_SID_ENUM structure. ********************************************************************/ -void init_lsa_sid_enum(TALLOC_CTX *mem_ctx, LSA_SID_ENUM *sen, +static void init_lsa_sid_enum(TALLOC_CTX *mem_ctx, LSA_SID_ENUM *sen, int num_entries, DOM_SID *sids) { int i; @@ -1753,7 +1753,7 @@ BOOL lsa_io_q_enum_privsaccount(char *desc, LSA_Q_ENUMPRIVSACCOUNT *r_c, prs_str Reads or writes an LUID structure. ********************************************************************/ -BOOL lsa_io_luid(char *desc, LUID *r_c, prs_struct *ps, int depth) +static BOOL lsa_io_luid(char *desc, LUID *r_c, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "lsa_io_luid"); depth++; @@ -1774,7 +1774,7 @@ BOOL lsa_io_luid(char *desc, LUID *r_c, prs_struct *ps, int depth) Reads or writes an LUID_ATTR structure. ********************************************************************/ -BOOL lsa_io_luid_attr(char *desc, LUID_ATTR *r_c, prs_struct *ps, int depth) +static BOOL lsa_io_luid_attr(char *desc, LUID_ATTR *r_c, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "lsa_io_luid_attr"); depth++; @@ -1795,7 +1795,7 @@ BOOL lsa_io_luid_attr(char *desc, LUID_ATTR *r_c, prs_struct *ps, int depth) Reads or writes an PRIVILEGE_SET structure. ********************************************************************/ -BOOL lsa_io_privilege_set(char *desc, PRIVILEGE_SET *r_c, prs_struct *ps, int depth) +static BOOL lsa_io_privilege_set(char *desc, PRIVILEGE_SET *r_c, prs_struct *ps, int depth) { uint32 i; diff --git a/source3/rpc_server/srv_srvsvc.c b/source3/rpc_server/srv_srvsvc.c index 96e6172366..5e1c005d54 100644 --- a/source3/rpc_server/srv_srvsvc.c +++ b/source3/rpc_server/srv_srvsvc.c @@ -495,7 +495,7 @@ static BOOL api_srv_net_file_set_secdesc(pipes_struct *p) \PIPE\srvsvc commands ********************************************************************/ -struct api_struct api_srv_cmds[] = +static const struct api_struct api_srv_cmds[] = { { "SRV_NET_CONN_ENUM" , SRV_NET_CONN_ENUM , api_srv_net_conn_enum }, { "SRV_NET_SESS_ENUM" , SRV_NET_SESS_ENUM , api_srv_net_sess_enum }, diff --git a/source3/rpc_server/srv_srvsvc_nt.c b/source3/rpc_server/srv_srvsvc_nt.c index d99b45f3e6..e8fe603ed8 100644 --- a/source3/rpc_server/srv_srvsvc_nt.c +++ b/source3/rpc_server/srv_srvsvc_nt.c @@ -1824,7 +1824,7 @@ WERROR _srv_net_file_set_secdesc(pipes_struct *p, SRV_Q_NET_FILE_SET_SECDESC *q_ "Nigel Williams" . ***********************************************************************************/ -const char *server_disks[] = {"C:"}; +static const char *server_disks[] = {"C:"}; static uint32 get_server_disk_count(void) { diff --git a/source3/rpc_server/srv_wkssvc.c b/source3/rpc_server/srv_wkssvc.c index 0138848440..c783becbbe 100644 --- a/source3/rpc_server/srv_wkssvc.c +++ b/source3/rpc_server/srv_wkssvc.c @@ -58,7 +58,7 @@ static BOOL api_wks_query_info(pipes_struct *p) /******************************************************************* \PIPE\wkssvc commands ********************************************************************/ -struct api_struct api_wks_cmds[] = +static struct api_struct api_wks_cmds[] = { { "WKS_Q_QUERY_INFO", WKS_QUERY_INFO, api_wks_query_info }, { NULL , 0 , NULL } diff --git a/source3/rpcclient/rpcclient.c b/source3/rpcclient/rpcclient.c index 42fb71abee..3ef5da1fef 100644 --- a/source3/rpcclient/rpcclient.c +++ b/source3/rpcclient/rpcclient.c @@ -186,7 +186,7 @@ static void get_username (char *username) /* Fetch the SID for this computer */ -void fetch_machine_sid(struct cli_state *cli) +static void fetch_machine_sid(struct cli_state *cli) { POLICY_HND pol; NTSTATUS result = NT_STATUS_OK; diff --git a/source3/script/findstatic.pl b/source3/script/findstatic.pl index d2d1b4d924..43a4916435 100755 --- a/source3/script/findstatic.pl +++ b/source3/script/findstatic.pl @@ -45,6 +45,7 @@ for (my($i)=0; $i <= $#{@lines}; $i++) { # are defined foreach my $f (keys %def) { print "Checking $f\n"; + my($found_one) = 0; foreach my $s (@{$def{$f}}) { my($found) = 0; foreach my $f2 (keys %undef) { @@ -52,6 +53,7 @@ foreach my $f (keys %def) { foreach my $s2 (@{$undef{$f2}}) { if ($s2 eq $s) { $found = 1; + $found_one = 1; } } } @@ -61,5 +63,8 @@ foreach my $f (keys %def) { print " '$s' is unique to $f ($t)\n"; } } + if ($found_one == 0) { + print " all symbols in '$f' are unused (main program?)\n"; + } } diff --git a/source3/smbd/fileio.c b/source3/smbd/fileio.c index fd660f40d0..710ba396d8 100644 --- a/source3/smbd/fileio.c +++ b/source3/smbd/fileio.c @@ -28,7 +28,7 @@ static BOOL setup_write_cache(files_struct *, SMB_OFF_T); Seek a file. Try to avoid the seek if possible. ****************************************************************************/ -SMB_OFF_T seek_file(files_struct *fsp,SMB_OFF_T pos) +static SMB_OFF_T seek_file(files_struct *fsp,SMB_OFF_T pos) { SMB_OFF_T offset = 0; SMB_OFF_T seek_ret; @@ -58,7 +58,7 @@ SMB_OFF_T seek_file(files_struct *fsp,SMB_OFF_T pos) ****************************************************************************/ -BOOL read_from_write_cache(files_struct *fsp,char *data,SMB_OFF_T pos,size_t n) +static BOOL read_from_write_cache(files_struct *fsp,char *data,SMB_OFF_T pos,size_t n) { write_cache *wcp = fsp->wcp; diff --git a/source3/smbd/vfs.c b/source3/smbd/vfs.c index 1d1e1e45fc..5e1dc68bdb 100644 --- a/source3/smbd/vfs.c +++ b/source3/smbd/vfs.c @@ -32,7 +32,7 @@ struct vfs_syminfo { very important. They must be in the same order as defined in vfs.h. Change at your own peril. */ -struct vfs_ops default_vfs_ops = { +static struct vfs_ops default_vfs_ops = { /* Disk operations */ @@ -222,7 +222,7 @@ BOOL vfs_directory_exist(connection_struct *conn, const char *dname, SMB_STRUCT_ /******************************************************************* vfs getwd wrapper ********************************************************************/ -char *vfs_getwd(connection_struct *conn, char *path) +static char *vfs_getwd(connection_struct *conn, char *path) { return conn->vfs_ops.getwd(conn,path); } @@ -562,7 +562,7 @@ int vfs_ChDir(connection_struct *conn, char *path) /* number of list structures for a caching GetWd function. */ #define MAX_GETWDCACHE (50) -struct { +static struct { SMB_DEV_T dev; /* These *must* be compatible with the types returned in a stat() call. */ SMB_INO_T inode; /* These *must* be compatible with the types returned in a stat() call. */ char *dos_path; /* The pathname in DOS format. */ -- cgit