From ac3eb7813e33b9a2e78c9158433f7ed62c3b62bb Mon Sep 17 00:00:00 2001 From: Herb Lewis Date: Tue, 12 Dec 2006 17:38:42 +0000 Subject: [PATCH] r20124: clean up nested extern declaration warnings --- source/client/smbmount.c | 5 ++--- source/include/smb_macros.h | 4 ++-- source/libsmb/clientgen.c | 3 ++- source/modules/vfs_expand_msdfs.c | 3 ++- source/modules/vfs_full_audit.c | 3 ++- source/nsswitch/winbindd_ads.c | 3 ++- source/nsswitch/winbindd_cache.c | 13 ++++++------- source/nsswitch/winbindd_cm.c | 3 ++- source/nsswitch/winbindd_dual.c | 3 ++- source/nsswitch/winbindd_util.c | 6 +++--- source/printing/print_generic.c | 5 ++--- source/printing/printing.c | 4 ++-- source/smbd/blocking.c | 3 ++- source/smbd/nttrans.c | 1 - source/smbd/sesssetup.c | 12 ++++++------ 15 files changed, 37 insertions(+), 34 deletions(-) diff --git a/source/client/smbmount.c b/source/client/smbmount.c index 56b7e9e6234..805245b634b 100644 --- a/source/client/smbmount.c +++ b/source/client/smbmount.c @@ -26,6 +26,8 @@ extern BOOL in_client; extern pstring user_socket_options; +extern char *optarg; +extern int optind; static pstring credentials; static pstring my_netbios_name; @@ -712,7 +714,6 @@ static void parse_mount_smb(int argc, char **argv) int opt; char *opts; char *opteq; - extern char *optarg; int val; char *p; @@ -862,8 +863,6 @@ static void parse_mount_smb(int argc, char **argv) ****************************************************************************/ int main(int argc,char *argv[]) { - extern char *optarg; - extern int optind; char *p; DEBUGLEVEL = 1; diff --git a/source/include/smb_macros.h b/source/include/smb_macros.h index 44f15734d9a..4b4351347fc 100644 --- a/source/include/smb_macros.h +++ b/source/include/smb_macros.h @@ -86,10 +86,10 @@ #define IS_IPC(conn) ((conn) && (conn)->ipc) #define IS_PRINT(conn) ((conn) && (conn)->printer) /* you must add the following extern declaration to files using this macro + * (do not add it to the macro as that causes nested extern declaration warnings) * extern struct current_user current_user; */ #define FSP_BELONGS_CONN(fsp,conn) do {\ - extern struct current_user current_user;\ if (!((fsp) && (conn) && ((conn)==(fsp)->conn) && (current_user.vuid==(fsp)->vuid))) \ return ERROR_NT(NT_STATUS_INVALID_HANDLE); \ } while(0) @@ -97,10 +97,10 @@ #define FNUM_OK(fsp,c) ((fsp) && !(fsp)->is_directory && (c)==(fsp)->conn && current_user.vuid==(fsp)->vuid) /* you must add the following extern declaration to files using this macro + * (do not add it to the macro as that causes nested extern declaration warnings) * extern struct current_user current_user; */ #define CHECK_FSP(fsp,conn) do {\ - extern struct current_user current_user;\ if (!(fsp) || !(conn)) \ return ERROR_NT(NT_STATUS_INVALID_HANDLE); \ else if (((conn) != (fsp)->conn) || current_user.vuid != (fsp)->vuid) \ diff --git a/source/libsmb/clientgen.c b/source/libsmb/clientgen.c index 24851961d03..68ecb131b11 100644 --- a/source/libsmb/clientgen.c +++ b/source/libsmb/clientgen.c @@ -20,6 +20,8 @@ #include "includes.h" +extern int smb_read_error; + /**************************************************************************** Change the timeout (in milliseconds). ****************************************************************************/ @@ -79,7 +81,6 @@ static BOOL client_receive_smb(int fd,char *buffer, unsigned int timeout) BOOL cli_receive_smb(struct cli_state *cli) { - extern int smb_read_error; BOOL ret; /* fd == -1 causes segfaults -- Tom (tom@ninja.nl) */ diff --git a/source/modules/vfs_expand_msdfs.c b/source/modules/vfs_expand_msdfs.c index fdd9ac6fbd8..2abab4dd2f7 100644 --- a/source/modules/vfs_expand_msdfs.c +++ b/source/modules/vfs_expand_msdfs.c @@ -23,6 +23,8 @@ #undef DBGC_CLASS #define DBGC_CLASS DBGC_VFS +extern userdom_struct current_user_info; + /********************************************************** Under mapfile we expect a table of the following format: @@ -110,7 +112,6 @@ static BOOL expand_msdfs_target(connection_struct* conn, pstring target) int filename_len; pstring targethost; pstring new_target; - extern userdom_struct current_user_info; if (filename_start == NULL) { DEBUG(10, ("No filename start in %s\n", target)); diff --git a/source/modules/vfs_full_audit.c b/source/modules/vfs_full_audit.c index beda82c00e4..f60a3b05854 100644 --- a/source/modules/vfs_full_audit.c +++ b/source/modules/vfs_full_audit.c @@ -60,6 +60,8 @@ #include "includes.h" +extern userdom_struct current_user_info; + static int vfs_full_audit_debug_level = DBGC_VFS; struct vfs_full_audit_private_data { @@ -647,7 +649,6 @@ static int audit_syslog_priority(vfs_handle_struct *handle) static char *audit_prefix(connection_struct *conn) { static pstring prefix; - extern userdom_struct current_user_info; pstrcpy(prefix, lp_parm_const_string(SNUM(conn), "full_audit", "prefix", "%u|%I")); diff --git a/source/nsswitch/winbindd_ads.c b/source/nsswitch/winbindd_ads.c index ad24b87a900..3505f183f21 100644 --- a/source/nsswitch/winbindd_ads.c +++ b/source/nsswitch/winbindd_ads.c @@ -30,6 +30,8 @@ #undef DBGC_CLASS #define DBGC_CLASS DBGC_WINBIND +extern struct winbindd_methods reconnect_methods; + /* return our ads connections structure for a domain. We keep the connection open to make things faster @@ -117,7 +119,6 @@ static ADS_STRUCT *ads_cached_connection(struct winbindd_domain *domain) server, fall back to MSRPC */ if (status.error_type == ENUM_ADS_ERROR_SYSTEM && status.err.rc == ECONNREFUSED) { - extern struct winbindd_methods reconnect_methods; /* 'reconnect_methods' is the MS-RPC backend. */ DEBUG(1,("Trying MSRPC methods\n")); domain->backend = &reconnect_methods; diff --git a/source/nsswitch/winbindd_cache.c b/source/nsswitch/winbindd_cache.c index 7990068ee4e..0587d8b2b37 100644 --- a/source/nsswitch/winbindd_cache.c +++ b/source/nsswitch/winbindd_cache.c @@ -29,6 +29,12 @@ #undef DBGC_CLASS #define DBGC_CLASS DBGC_WINBIND +extern struct winbindd_methods reconnect_methods; +extern BOOL opt_nocache; +#ifdef HAVE_ADS +extern struct winbindd_methods ads_methods; +#endif + /* Global online/offline state - False when online. winbindd starts up online and sets this to true if the first query fails and there's an entry in the cache tdb telling us to stay offline. */ @@ -112,10 +118,7 @@ static struct winbind_cache *get_cache(struct winbindd_domain *domain) */ if (!domain->backend) { - extern struct winbindd_methods reconnect_methods; #ifdef HAVE_ADS - extern struct winbindd_methods ads_methods; - /* find our domain first so we can figure out if we are joined to a kerberized domain */ @@ -558,8 +561,6 @@ static struct cache_entry *wcache_fetch(struct winbind_cache *cache, char *kstr; struct cache_entry *centry; - extern BOOL opt_nocache; - if (opt_nocache) { return NULL; } @@ -2359,8 +2360,6 @@ static int traverse_fn_cleanup(TDB_CONTEXT *the_tdb, TDB_DATA kbuf, /* flush the cache */ void wcache_flush_cache(void) { - extern BOOL opt_nocache; - if (!wcache) return; if (wcache->tdb) { diff --git a/source/nsswitch/winbindd_cm.c b/source/nsswitch/winbindd_cm.c index 2c341d5efa8..c0a6aeb85d6 100644 --- a/source/nsswitch/winbindd_cm.c +++ b/source/nsswitch/winbindd_cm.c @@ -65,6 +65,8 @@ #undef DBGC_CLASS #define DBGC_CLASS DBGC_WINBIND +extern struct winbindd_methods reconnect_methods; + static NTSTATUS init_dc_connection_network(struct winbindd_domain *domain); static void set_dc_type_and_flags( struct winbindd_domain *domain ); @@ -196,7 +198,6 @@ void set_domain_offline(struct winbindd_domain *domain) static void set_domain_online(struct winbindd_domain *domain) { - extern struct winbindd_methods reconnect_methods; struct timeval now; DEBUG(10,("set_domain_online: called for domain %s\n", diff --git a/source/nsswitch/winbindd_dual.c b/source/nsswitch/winbindd_dual.c index 71ab7a1ae20..70af8333c52 100644 --- a/source/nsswitch/winbindd_dual.c +++ b/source/nsswitch/winbindd_dual.c @@ -34,6 +34,8 @@ #undef DBGC_CLASS #define DBGC_CLASS DBGC_WINBIND +extern BOOL override_logfile; + /* Read some data from a client connection */ static void child_read_request(struct winbindd_cli_state *state) @@ -759,7 +761,6 @@ static BOOL fork_domain_child(struct winbindd_child *child) int fdpair[2]; struct winbindd_cli_state state; struct winbindd_domain *domain; - extern BOOL override_logfile; if (socketpair(AF_UNIX, SOCK_STREAM, 0, fdpair) != 0) { DEBUG(0, ("Could not open child pipe: %s\n", diff --git a/source/nsswitch/winbindd_util.c b/source/nsswitch/winbindd_util.c index c0a19cd36fc..e4b51019aa7 100644 --- a/source/nsswitch/winbindd_util.c +++ b/source/nsswitch/winbindd_util.c @@ -27,6 +27,9 @@ #undef DBGC_CLASS #define DBGC_CLASS DBGC_WINBIND +extern struct winbindd_methods cache_methods; +extern struct winbindd_methods passdb_methods; + /** * @file winbindd_util.c * @@ -225,7 +228,6 @@ static void add_trusted_domains( struct winbindd_domain *domain ) static void trustdom_recv(void *private_data, BOOL success) { - extern struct winbindd_methods cache_methods; struct trustdom_state *state = talloc_get_type_abort(private_data, struct trustdom_state); struct winbindd_response *response = state->response; @@ -493,8 +495,6 @@ enum winbindd_result winbindd_dual_init_connection(struct winbindd_domain *domai /* Look up global info for the winbind daemon */ BOOL init_domain_list(void) { - extern struct winbindd_methods cache_methods; - extern struct winbindd_methods passdb_methods; struct winbindd_domain *domain; int role = lp_server_role(); diff --git a/source/printing/print_generic.c b/source/printing/print_generic.c index aef4e50bfaa..1e55f712c53 100644 --- a/source/printing/print_generic.c +++ b/source/printing/print_generic.c @@ -21,6 +21,8 @@ #include "includes.h" #include "printing.h" +extern struct current_user current_user; +extern userdom_struct current_user_info; /**************************************************************************** run a given print command @@ -30,9 +32,6 @@ for local substitution strings static int print_run_command(int snum, const char* printername, BOOL do_sub, const char *command, int *outfd, ...) { - extern struct current_user current_user; - extern userdom_struct current_user_info; - pstring syscmd; char *arg; int ret; diff --git a/source/printing/printing.c b/source/printing/printing.c index 0d9ae02545a..2f1d123a200 100644 --- a/source/printing/printing.c +++ b/source/printing/printing.c @@ -25,6 +25,8 @@ extern SIG_ATOMIC_T got_sig_term; extern SIG_ATOMIC_T reload_after_sighup; +extern struct current_user current_user; +extern userdom_struct current_user_info; /* Current printer interface */ static BOOL remove_from_jobs_changed(const char* sharename, uint32 jobid); @@ -1438,8 +1440,6 @@ update the internal database from the system print queue for a queue static void print_queue_update(int snum, BOOL force) { - extern struct current_user current_user; - extern userdom_struct current_user_info; fstring key; fstring sharename; pstring lpqcommand, lprmcommand; diff --git a/source/smbd/blocking.c b/source/smbd/blocking.c index f489a8e96b2..aeb2bd6b6be 100644 --- a/source/smbd/blocking.c +++ b/source/smbd/blocking.c @@ -22,6 +22,8 @@ #undef DBGC_CLASS #define DBGC_CLASS DBGC_LOCKING +extern int max_send; + /**************************************************************************** This is the structure to queue to implement blocking locks. notify. It consists of the requesting SMB and the expiry time. @@ -425,7 +427,6 @@ Waiting....\n", static BOOL process_trans2(blocking_lock_record *blr) { - extern int max_send; char *inbuf = blr->inbuf; char *outbuf; char params[2]; diff --git a/source/smbd/nttrans.c b/source/smbd/nttrans.c index d41125564c7..3ade5b01c6b 100644 --- a/source/smbd/nttrans.c +++ b/source/smbd/nttrans.c @@ -2345,7 +2345,6 @@ static int call_nt_transact_get_user_quota(connection_struct *conn, char *inbuf, SMB_NTQUOTA_STRUCT qt; SMB_NTQUOTA_LIST *tmp_list; SMB_NTQUOTA_HANDLE *qt_handle = NULL; - extern struct current_user current_user; ZERO_STRUCT(qt); diff --git a/source/smbd/sesssetup.c b/source/smbd/sesssetup.c index 16034904414..4d731f9c595 100644 --- a/source/smbd/sesssetup.c +++ b/source/smbd/sesssetup.c @@ -23,6 +23,12 @@ #include "includes.h" +extern struct auth_context *negprot_global_auth_context; +extern BOOL global_encrypted_passwords_negotiated; +extern BOOL global_spnego_negotiated; +extern enum protocol_types Protocol; +extern int max_send; + uint32 global_client_caps = 0; /* @@ -840,13 +846,7 @@ int reply_sesssetup_and_X(connection_struct *conn, char *inbuf,char *outbuf, fstring native_lanman; fstring primary_domain; static BOOL done_sesssetup = False; - extern BOOL global_encrypted_passwords_negotiated; - extern BOOL global_spnego_negotiated; - extern enum protocol_types Protocol; - extern int max_send; - auth_usersupplied_info *user_info = NULL; - extern struct auth_context *negprot_global_auth_context; auth_serversupplied_info *server_info = NULL; NTSTATUS nt_status;