r20124: clean up nested extern declaration warnings
authorHerb Lewis <herb@samba.org>
Tue, 12 Dec 2006 17:38:42 +0000 (17:38 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 17:16:26 +0000 (12:16 -0500)
(This used to be commit ac3eb7813e33b9a2e78c9158433f7ed62c3b62bb)

15 files changed:
source3/client/smbmount.c
source3/include/smb_macros.h
source3/libsmb/clientgen.c
source3/modules/vfs_expand_msdfs.c
source3/modules/vfs_full_audit.c
source3/nsswitch/winbindd_ads.c
source3/nsswitch/winbindd_cache.c
source3/nsswitch/winbindd_cm.c
source3/nsswitch/winbindd_dual.c
source3/nsswitch/winbindd_util.c
source3/printing/print_generic.c
source3/printing/printing.c
source3/smbd/blocking.c
source3/smbd/nttrans.c
source3/smbd/sesssetup.c

index 56b7e9e62340f97c3d46bedfaa041a20e346bc23..805245b634b40ff80d8f8690c9a935264c50377c 100644 (file)
@@ -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;
index 44f15734d9af50a3417ade09310df1833db4a804..4b4351347fc23dae644bc6b504450e93c838bbcf 100644 (file)
 #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)
 #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) \
index 24851961d03f09724331d9fececf02b692674626..68ecb131b11cdab4ab70ce64aea7c8d244031d03 100644 (file)
@@ -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) */
index fdd9ac6fbd80c5784d7e53ad588bb3fb0f63525b..2abab4dd2f7cc38b7cd56086d2e822db420d45cd 100644 (file)
@@ -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));
index beda82c00e45e5ae495745f18b7364939136bd64..f60a3b058545902bd21fc96a17b9e7217f0f650b 100644 (file)
@@ -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"));
index ad24b87a900cfbbc0d543ee76e498ebb9d22d062..3505f183f212dffd8ec0d8b28ee5778bebd9cfdc 100644 (file)
@@ -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;
index 7990068ee4e9b50dfcb54fcae7ec9e9b2624c1d0..0587d8b2b37ba36a33f2054740ed5d8309eed083 100644 (file)
 #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) {
index 2c341d5efa8d057d2507179d77216c41b3baf8da..c0a6aeb85d668ea0f777813b54e61723794bd0dc 100644 (file)
@@ -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",
index 71ab7a1ae203e0a2ac25e1953a5cf98f635cd70d..70af8333c52a46e7dcc6c9d9bf759145d3178680 100644 (file)
@@ -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",
index c0a19cd36fc2e10506ce70861566489a5b40c330..e4b51019aa79e84f98433a7a01c200b40f49880f 100644 (file)
@@ -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();
 
index aef4e50bfaac6b5503711cb959f9731b8c32cd21..1e55f712c5395fb57738d992f340586d7f0bfabd 100644 (file)
@@ -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;
index 0d9ae02545a51ae07b8d2ab3c91d7f9b2647d909..2f1d123a2001ea94bcfcef4982e8a5070b9cdc6f 100644 (file)
@@ -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;
index f489a8e96b2bf41f0c7a951ff091ceba3e420787..aeb2bd6b6bedfa12041da632e7c2323252789674 100644 (file)
@@ -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];
index d41125564c78a791008c0240b3822d97e25436c1..3ade5b01c6b47f1423f70c0518792796ebc017be 100644 (file)
@@ -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);
 
index 160349044143195f0b091c2c6c77419c7bbf6258..4d731f9c595bdf4447b063877a9c2b697cf12450 100644 (file)
 
 #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;