summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHerb Lewis <herb@samba.org>2005-04-06 16:28:04 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 10:56:30 -0500
commit978ca8486031e43754a3c23757f361bf3a85f335 (patch)
tree109bd3ff560afcbd74296990d9554859cb2fb78f
parent60dd0d0f9c277eb9852924aea81fee06b7395832 (diff)
downloadsamba-978ca8486031e43754a3c23757f361bf3a85f335.tar.gz
samba-978ca8486031e43754a3c23757f361bf3a85f335.tar.bz2
samba-978ca8486031e43754a3c23757f361bf3a85f335.zip
r6225: get rid of warnings from my compiler about nested externs
(This used to be commit efea76ac71412f8622cd233912309e91b9ea52da)
-rw-r--r--source3/auth/auth_compat.c5
-rw-r--r--source3/auth/auth_sam.c3
-rw-r--r--source3/client/client.c6
-rw-r--r--source3/client/clitar.c2
-rw-r--r--source3/groupdb/mapping.c4
-rw-r--r--source3/include/smb_macros.h8
-rw-r--r--source3/lib/substitute.c3
-rw-r--r--source3/lib/util.c9
-rw-r--r--source3/lib/util_seaccess.c4
-rw-r--r--source3/lib/wins_srv.c3
-rw-r--r--source3/libsmb/cliconnect.c3
-rw-r--r--source3/libsmb/clientgen.c3
-rw-r--r--source3/libsmb/clilist.c4
-rw-r--r--source3/libsmb/nmblib.c5
-rw-r--r--source3/modules/vfs_fake_perms.c6
-rw-r--r--source3/nmbd/nmbd.c4
-rw-r--r--source3/nmbd/nmbd_subnetdb.c2
-rw-r--r--source3/nmbd/nmbd_synclists.c3
-rw-r--r--source3/nsswitch/winbindd_ads.c3
-rw-r--r--source3/nsswitch/winbindd_cache.c12
-rw-r--r--source3/nsswitch/winbindd_util.c10
-rw-r--r--source3/param/loadparm.c2
-rw-r--r--source3/param/params.c3
-rw-r--r--source3/passdb/pdb_ldap.c3
-rw-r--r--source3/printing/nt_printing.c2
-rw-r--r--source3/printing/printfsp.c3
-rw-r--r--source3/rpc_server/srv_lsa_nt.c4
-rw-r--r--source3/rpc_server/srv_netlog_nt.c5
-rw-r--r--source3/rpc_server/srv_pipe.c5
-rw-r--r--source3/rpc_server/srv_samr_nt.c2
-rw-r--r--source3/rpc_server/srv_spoolss_nt.c3
-rw-r--r--source3/rpc_server/srv_srvsvc_nt.c6
-rw-r--r--source3/smbd/dir.c4
-rw-r--r--source3/smbd/error.c2
-rw-r--r--source3/smbd/fake_file.c3
-rw-r--r--source3/smbd/lanman.c6
-rw-r--r--source3/smbd/negprot.c2
-rw-r--r--source3/smbd/nttrans.c4
-rw-r--r--source3/smbd/open.c4
-rw-r--r--source3/smbd/oplock.c8
-rw-r--r--source3/smbd/oplock_linux.c32
-rw-r--r--source3/smbd/posix_acls.c28
-rw-r--r--source3/smbd/process.c9
-rw-r--r--source3/smbd/reply.c4
-rw-r--r--source3/smbd/server.c4
-rw-r--r--source3/smbd/service.c2
-rw-r--r--source3/smbd/sesssetup.c11
-rw-r--r--source3/smbd/trans2.c2
-rw-r--r--source3/tdb/tdbbackup.c5
-rw-r--r--source3/utils/net.c2
-rw-r--r--source3/web/diagnose.c4
51 files changed, 138 insertions, 138 deletions
diff --git a/source3/auth/auth_compat.c b/source3/auth/auth_compat.c
index a70f1e98b7..2ac70d7354 100644
--- a/source3/auth/auth_compat.c
+++ b/source3/auth/auth_compat.c
@@ -20,6 +20,9 @@
#include "includes.h"
+extern struct auth_context *negprot_global_auth_context;
+extern BOOL global_encrypted_passwords_negotiated;
+
#undef DBGC_CLASS
#define DBGC_CLASS DBGC_AUTH
@@ -68,7 +71,6 @@ static NTSTATUS pass_check_smb(const char *smb_name,
{
NTSTATUS nt_status;
- extern struct auth_context *negprot_global_auth_context;
auth_serversupplied_info *server_info = NULL;
if (encrypted) {
auth_usersupplied_info *user_info = NULL;
@@ -94,7 +96,6 @@ BOOL password_ok(char *smb_name, DATA_BLOB password_blob)
{
DATA_BLOB null_password = data_blob(NULL, 0);
- extern BOOL global_encrypted_passwords_negotiated;
BOOL encrypted = (global_encrypted_passwords_negotiated && password_blob.length == 24);
if (encrypted) {
diff --git a/source3/auth/auth_sam.c b/source3/auth/auth_sam.c
index 9da59f220a..023e441e24 100644
--- a/source3/auth/auth_sam.c
+++ b/source3/auth/auth_sam.c
@@ -23,6 +23,8 @@
#include "includes.h"
+extern struct timeval smb_last_time;
+
#undef DBGC_CLASS
#define DBGC_CLASS DBGC_AUTH
@@ -74,7 +76,6 @@ static NTSTATUS sam_password_ok(const struct auth_context *auth_context,
static BOOL logon_hours_ok(SAM_ACCOUNT *sampass)
{
/* In logon hours first bit is Sunday from 12AM to 1AM */
- extern struct timeval smb_last_time;
const uint8 *hours;
struct tm *utctime;
uint8 bitmask, bitpos;
diff --git a/source3/client/client.c b/source3/client/client.c
index d739f84b38..204e51d4cc 100644
--- a/source3/client/client.c
+++ b/source3/client/client.c
@@ -29,6 +29,9 @@
#define REGISTER 0
#endif
+extern BOOL AllowDebugChange;
+extern BOOL override_logfile;
+extern char tar_type;
extern BOOL in_client;
static int port = 0;
pstring cur_dir = "\\";
@@ -3286,13 +3289,10 @@ static int do_message_op(void)
int main(int argc,char *argv[])
{
- extern BOOL AllowDebugChange;
- extern BOOL override_logfile;
pstring base_directory;
int opt;
pstring query_host;
BOOL message = False;
- extern char tar_type;
pstring term_code;
static const char *new_name_resolve_order = NULL;
poptContext pc;
diff --git a/source3/client/clitar.c b/source3/client/clitar.c
index 919545291f..b241bd0ec2 100644
--- a/source3/client/clitar.c
+++ b/source3/client/clitar.c
@@ -63,6 +63,7 @@ typedef struct {
} stack;
#define SEPARATORS " \t\n\r"
+extern time_t newer_than;
extern struct cli_state *cli;
/* These defines are for the do_setrattr routine, to indicate
@@ -1621,7 +1622,6 @@ int tar_parseargs(int argc, char *argv[], const char *Optarg, int Optind)
return 0;
} else {
SMB_STRUCT_STAT stbuf;
- extern time_t newer_than;
if (sys_stat(argv[Optind], &stbuf) == 0) {
newer_than = stbuf.st_mtime;
diff --git a/source3/groupdb/mapping.c b/source3/groupdb/mapping.c
index 244cbd8fe7..d02c512054 100644
--- a/source3/groupdb/mapping.c
+++ b/source3/groupdb/mapping.c
@@ -21,6 +21,8 @@
#include "includes.h"
+extern DOM_SID global_sid_Builtin;
+
static TDB_CONTEXT *tdb; /* used for driver files */
#define DATABASE_VERSION_V1 1 /* native byte format. */
@@ -1253,8 +1255,6 @@ NTSTATUS pdb_default_enum_aliases(struct pdb_methods *methods,
uint32 *num_aliases,
struct acct_info **info)
{
- extern DOM_SID global_sid_Builtin;
-
GROUP_MAP *map;
int i, num_maps;
enum SID_NAME_USE type = SID_NAME_UNKNOWN;
diff --git a/source3/include/smb_macros.h b/source3/include/smb_macros.h
index e19c51884f..1076bd53e8 100644
--- a/source3/include/smb_macros.h
+++ b/source3/include/smb_macros.h
@@ -76,16 +76,20 @@
#define OPEN_CONN(conn) ((conn) && (conn)->open)
#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
+ * 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_DOS(ERRDOS,ERRbadfid));\
} while(0)
#define FNUM_OK(fsp,c) (OPEN_FSP(fsp) && (c)==(fsp)->conn && current_user.vuid==(fsp)->vuid)
+/* you must add the following extern declaration to files using this macro
+ * extern struct current_user current_user;
+ */
#define CHECK_FSP(fsp,conn) do {\
- extern struct current_user current_user;\
if (!FNUM_OK(fsp,conn)) \
return(ERROR_DOS(ERRDOS,ERRbadfid)); \
else if((fsp)->fd == -1) \
diff --git a/source3/lib/substitute.c b/source3/lib/substitute.c
index 615a8d73b0..af30e900ac 100644
--- a/source3/lib/substitute.c
+++ b/source3/lib/substitute.c
@@ -21,6 +21,8 @@
#include "includes.h"
+extern struct current_user current_user;
+
fstring local_machine="";
fstring remote_arch="UNKNOWN";
userdom_struct current_user_info;
@@ -800,7 +802,6 @@ char *alloc_sub_conn(connection_struct *conn, const char *str)
void standard_sub_snum(int snum, char *str, size_t len)
{
- extern struct current_user current_user;
static uid_t cached_uid = -1;
static fstring cached_user;
/* calling uidtoname() on every substitute would be too expensive, so
diff --git a/source3/lib/util.c b/source3/lib/util.c
index b76d561ccd..d244e390d2 100644
--- a/source3/lib/util.c
+++ b/source3/lib/util.c
@@ -23,6 +23,11 @@
#include "includes.h"
+extern fstring local_machine;
+extern char *global_clobber_region_function;
+extern unsigned int global_clobber_region_line;
+extern fstring remote_arch;
+
/* Max allowable allococation - 256mb - 0x10000000 */
#define MAX_ALLOC_SIZE (1024*1024*256)
@@ -230,7 +235,6 @@ BOOL set_netbios_aliases(const char **str_array)
BOOL init_names(void)
{
- extern fstring local_machine;
char *p;
int n;
@@ -1453,8 +1457,6 @@ void smb_panic2(const char *why, BOOL decrement_pid_count )
#ifdef DEVELOPER
{
- extern char *global_clobber_region_function;
- extern unsigned int global_clobber_region_line;
if (global_clobber_region_function) {
DEBUG(0,("smb_panic: clobber_region() last called from [%s(%u)]\n",
@@ -1919,7 +1921,6 @@ void ra_lanman_string( const char *native_lanman )
void set_remote_arch(enum remote_arch_types type)
{
- extern fstring remote_arch;
ra_type = type;
switch( type ) {
case RA_WFWG:
diff --git a/source3/lib/util_seaccess.c b/source3/lib/util_seaccess.c
index cb0f46e2f9..362504e46b 100644
--- a/source3/lib/util_seaccess.c
+++ b/source3/lib/util_seaccess.c
@@ -22,6 +22,8 @@
#include "includes.h"
extern DOM_SID global_sid_Builtin;
+extern DOM_SID global_sid_World;
+extern NT_USER_TOKEN anonymous_token;
/*********************************************************************************
Check an ACE against a SID. We return the remaining needed permission
@@ -214,7 +216,6 @@ BOOL se_access_check(const SEC_DESC *sd, const NT_USER_TOKEN *token,
uint32 acc_desired, uint32 *acc_granted,
NTSTATUS *status)
{
- extern NT_USER_TOKEN anonymous_token;
size_t i;
SEC_ACL *the_acl;
fstring sid_str;
@@ -323,7 +324,6 @@ BOOL se_access_check(const SEC_DESC *sd, const NT_USER_TOKEN *token,
NTSTATUS samr_make_sam_obj_sd(TALLOC_CTX *ctx, SEC_DESC **psd, size_t *sd_size)
{
- extern DOM_SID global_sid_World;
DOM_SID adm_sid;
DOM_SID act_sid;
diff --git a/source3/lib/wins_srv.c b/source3/lib/wins_srv.c
index b82e04e13c..c139f427ca 100644
--- a/source3/lib/wins_srv.c
+++ b/source3/lib/wins_srv.c
@@ -22,6 +22,8 @@
#include "includes.h"
+extern struct in_addr loopback_ip;
+
/*
This is pretty much a complete rewrite of the earlier code. The main
aim of the rewrite is to add support for having multiple wins server
@@ -280,7 +282,6 @@ struct in_addr wins_srv_ip_tag(const char *tag, struct in_addr src_ip)
/* if we are a wins server then we always just talk to ourselves */
if (lp_wins_support()) {
- extern struct in_addr loopback_ip;
return loopback_ip;
}
diff --git a/source3/libsmb/cliconnect.c b/source3/libsmb/cliconnect.c
index 4208d6378d..5a9992d4e0 100644
--- a/source3/libsmb/cliconnect.c
+++ b/source3/libsmb/cliconnect.c
@@ -23,6 +23,7 @@
#include "includes.h"
+extern pstring user_socket_options;
static const struct {
int prot;
@@ -1200,7 +1201,6 @@ BOOL cli_session_request(struct cli_state *cli,
{
char *p;
int len = 4;
- extern pstring user_socket_options;
memcpy(&(cli->calling), calling, sizeof(*calling));
memcpy(&(cli->called ), called , sizeof(*called ));
@@ -1290,7 +1290,6 @@ BOOL cli_session_request(struct cli_state *cli,
BOOL cli_connect(struct cli_state *cli, const char *host, struct in_addr *ip)
{
- extern pstring user_socket_options;
int name_type = 0x20;
char *p;
diff --git a/source3/libsmb/clientgen.c b/source3/libsmb/clientgen.c
index b7bc780a1a..e787650c2f 100644
--- a/source3/libsmb/clientgen.c
+++ b/source3/libsmb/clientgen.c
@@ -22,6 +22,8 @@
#include "includes.h"
+extern int smb_read_error;
+
/****************************************************************************
Change the timeout (in milliseconds).
****************************************************************************/
@@ -81,7 +83,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/source3/libsmb/clilist.c b/source3/libsmb/clilist.c
index 0f1b9efed0..79c2ef66a1 100644
--- a/source3/libsmb/clilist.c
+++ b/source3/libsmb/clilist.c
@@ -22,6 +22,8 @@
#include "includes.h"
+extern file_info def_finfo;
+
/****************************************************************************
Interpret a long filename structure - this is mostly guesses at the moment.
The length of the structure is returned
@@ -32,7 +34,6 @@
static size_t interpret_long_filename(struct cli_state *cli,
int level,char *p,file_info *finfo)
{
- extern file_info def_finfo;
file_info finfo2;
int len;
char *base = p;
@@ -332,7 +333,6 @@ int cli_list_new(struct cli_state *cli,const char *Mask,uint16 attribute,
static int interpret_short_filename(struct cli_state *cli, char *p,file_info *finfo)
{
- extern file_info def_finfo;
*finfo = def_finfo;
diff --git a/source3/libsmb/nmblib.c b/source3/libsmb/nmblib.c
index 1c93f7b1e2..164f85be7b 100644
--- a/source3/libsmb/nmblib.c
+++ b/source3/libsmb/nmblib.c
@@ -21,6 +21,9 @@
#include "includes.h"
+extern struct in_addr lastip;
+extern int lastport;
+
int num_good_sends = 0;
int num_good_receives = 0;
@@ -692,8 +695,6 @@ void free_packet(struct packet_struct *packet)
struct packet_struct *parse_packet(char *buf,int length,
enum packet_type packet_type)
{
- extern struct in_addr lastip;
- extern int lastport;
struct packet_struct *p;
BOOL ok=False;
diff --git a/source3/modules/vfs_fake_perms.c b/source3/modules/vfs_fake_perms.c
index 740218dcd4..4d10ea5f33 100644
--- a/source3/modules/vfs_fake_perms.c
+++ b/source3/modules/vfs_fake_perms.c
@@ -24,6 +24,8 @@
#include "includes.h"
+extern struct current_user current_user;
+
#undef DBGC_CLASS
#define DBGC_CLASS DBGC_VFS
@@ -33,8 +35,6 @@ static int fake_perms_stat(vfs_handle_struct *handle, connection_struct *conn, c
ret = SMB_VFS_NEXT_STAT(handle, conn, fname, sbuf);
if (ret == 0) {
- extern struct current_user current_user;
-
if (S_ISDIR(sbuf->st_mode)) {
sbuf->st_mode = S_IFDIR | S_IRWXU;
} else {
@@ -53,8 +53,6 @@ static int fake_perms_fstat(vfs_handle_struct *handle, files_struct *fsp, int fd
ret = SMB_VFS_NEXT_FSTAT(handle, fsp, fd, sbuf);
if (ret == 0) {
- extern struct current_user current_user;
-
if (S_ISDIR(sbuf->st_mode)) {
sbuf->st_mode = S_IFDIR | S_IRWXU;
} else {
diff --git a/source3/nmbd/nmbd.c b/source3/nmbd/nmbd.c
index f8006a22a9..532b578f3c 100644
--- a/source3/nmbd/nmbd.c
+++ b/source3/nmbd/nmbd.c
@@ -27,6 +27,8 @@ int ClientNMB = -1;
int ClientDGRAM = -1;
int global_nmb_port = -1;
+extern BOOL rescan_listen_set;
+extern struct in_addr loopback_ip;
extern BOOL global_in_nmbd;
extern BOOL override_logfile;
@@ -196,8 +198,6 @@ static BOOL reload_interfaces(time_t t)
static time_t lastt;
int n;
struct subnet_record *subrec;
- extern BOOL rescan_listen_set;
- extern struct in_addr loopback_ip;
if (t && ((t - lastt) < NMBD_INTERFACES_RELOAD)) return False;
lastt = t;
diff --git a/source3/nmbd/nmbd_subnetdb.c b/source3/nmbd/nmbd_subnetdb.c
index ecfd92719b..b53a6d7328 100644
--- a/source3/nmbd/nmbd_subnetdb.c
+++ b/source3/nmbd/nmbd_subnetdb.c
@@ -25,6 +25,7 @@
#include "includes.h"
+extern struct in_addr loopback_ip;
extern int ClientNMB;
extern int ClientDGRAM;
extern int global_nmb_port;
@@ -211,7 +212,6 @@ BOOL create_subnets(void)
int num_interfaces = iface_count();
int i;
struct in_addr unicast_ip, ipzero;
- extern struct in_addr loopback_ip;
if(num_interfaces == 0) {
DEBUG(0,("create_subnets: No local interfaces !\n"));
diff --git a/source3/nmbd/nmbd_synclists.c b/source3/nmbd/nmbd_synclists.c
index c6bcb3e574..33690133bf 100644
--- a/source3/nmbd/nmbd_synclists.c
+++ b/source3/nmbd/nmbd_synclists.c
@@ -29,6 +29,8 @@
#include "includes.h"
+extern fstring local_machine;
+
struct sync_record {
struct sync_record *next, *prev;
unstring workgroup;
@@ -65,7 +67,6 @@ static void sync_child(char *name, int nm_type,
struct in_addr ip, BOOL local, BOOL servers,
char *fname)
{
- extern fstring local_machine;
fstring unix_workgroup;
static struct cli_state cli;
uint32 local_type = local ? SV_TYPE_LOCAL_LIST_ONLY : 0;
diff --git a/source3/nsswitch/winbindd_ads.c b/source3/nsswitch/winbindd_ads.c
index 88a7d3ed3b..4daf4ba989 100644
--- a/source3/nsswitch/winbindd_ads.c
+++ b/source3/nsswitch/winbindd_ads.c
@@ -27,6 +27,8 @@
#ifdef HAVE_ADS
+extern struct winbindd_methods msrpc_methods, cache_methods;
+
#undef DBGC_CLASS
#define DBGC_CLASS DBGC_WINBIND
@@ -76,7 +78,6 @@ static ADS_STRUCT *ads_cached_connection(struct winbindd_domain *domain)
status = ads_connect(ads);
if (!ADS_ERR_OK(status) || !ads->config.realm) {
- extern struct winbindd_methods msrpc_methods, cache_methods;
DEBUG(1,("ads_connect for domain %s failed: %s\n",
domain->name, ads_errstr(status)));
ads_destroy(&ads);
diff --git a/source3/nsswitch/winbindd_cache.c b/source3/nsswitch/winbindd_cache.c
index 3fc62df005..cc385a1dd7 100644
--- a/source3/nsswitch/winbindd_cache.c
+++ b/source3/nsswitch/winbindd_cache.c
@@ -26,6 +26,12 @@
#include "includes.h"
#include "winbindd.h"
+extern BOOL opt_nocache;
+extern struct winbindd_methods msrpc_methods;
+extern struct winbindd_methods ads_methods;
+extern BOOL opt_dual_daemon;
+extern BOOL background_process;
+
#undef DBGC_CLASS
#define DBGC_CLASS DBGC_WINBIND
@@ -47,8 +53,6 @@ static struct winbind_cache *wcache;
/* flush the cache */
void wcache_flush_cache(void)
{
- extern BOOL opt_nocache;
-
if (!wcache)
return;
if (wcache->tdb) {
@@ -102,11 +106,9 @@ static struct winbind_cache *get_cache(struct winbindd_domain *domain)
struct winbind_cache *ret = wcache;
if (!domain->backend) {
- extern struct winbindd_methods msrpc_methods;
switch (lp_security()) {
#ifdef HAVE_ADS
case SEC_ADS: {
- extern struct winbindd_methods ads_methods;
/* always obey the lp_security parameter for our domain */
if (domain->primary) {
domain->backend = &ads_methods;
@@ -469,13 +471,11 @@ static struct cache_entry *wcache_fetch(struct winbind_cache *cache,
centry->sequence_number = centry_uint32(centry);
if (centry_expired(domain, kstr, centry)) {
- extern BOOL opt_dual_daemon;
DEBUG(10,("wcache_fetch: entry %s expired for domain %s\n",
kstr, domain->name ));
if (opt_dual_daemon) {
- extern BOOL background_process;
background_process = True;
DEBUG(10,("wcache_fetch: background processing expired entry %s for domain %s\n",
kstr, domain->name ));
diff --git a/source3/nsswitch/winbindd_util.c b/source3/nsswitch/winbindd_util.c
index 9ae24e401f..b9fb49ea7f 100644
--- a/source3/nsswitch/winbindd_util.c
+++ b/source3/nsswitch/winbindd_util.c
@@ -24,6 +24,10 @@
#include "includes.h"
#include "winbindd.h"
+extern DOM_SID global_sid_Builtin;
+extern struct winbindd_methods cache_methods;
+extern struct winbindd_methods passdb_methods;
+
#undef DBGC_CLASS
#define DBGC_CLASS DBGC_WINBIND
@@ -85,8 +89,6 @@ void free_domain_list(void)
static BOOL is_internal_domain(const DOM_SID *sid)
{
- extern DOM_SID global_sid_Builtin;
-
if (sid == NULL)
return False;
@@ -183,7 +185,6 @@ static struct winbindd_domain *add_trusted_domain(const char *domain_name, const
static void add_trusted_domains( struct winbindd_domain *domain )
{
- extern struct winbindd_methods cache_methods;
TALLOC_CTX *mem_ctx;
NTSTATUS result;
time_t t;
@@ -284,9 +285,6 @@ void rescan_trusted_domains( void )
/* Look up global info for the winbind daemon */
BOOL init_domain_list(void)
{
- extern DOM_SID global_sid_Builtin;
- extern struct winbindd_methods cache_methods;
- extern struct winbindd_methods passdb_methods;
struct winbindd_domain *domain;
/* Free existing list */
diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c
index 8ec7efddcd..ad952b6362 100644
--- a/source3/param/loadparm.c
+++ b/source3/param/loadparm.c
@@ -58,6 +58,7 @@ BOOL bLoaded = False;
extern userdom_struct current_user_info;
extern pstring user_socket_options;
+extern enum protocol_types Protocol;
#ifndef GLOBAL_NAME
#define GLOBAL_NAME "global"
@@ -4359,7 +4360,6 @@ const char *lp_printcapname(void)
BOOL lp_use_sendfile(int snum)
{
- extern enum protocol_types Protocol;
/* Using sendfile blows the brains out of any DOS or Win9x TCP stack... JRA. */
if (Protocol < PROTOCOL_NT1) {
return False;
diff --git a/source3/param/params.c b/source3/param/params.c
index 9d21d25a24..3b736113be 100644
--- a/source3/param/params.c
+++ b/source3/param/params.c
@@ -81,6 +81,8 @@
#include "includes.h"
+extern BOOL in_client;
+
/* -------------------------------------------------------------------------- **
* Constants...
*/
@@ -523,7 +525,6 @@ static BOOL Parse( myFILE *InFile,
static myFILE *OpenConfFile( const char *FileName )
{
const char *func = "params.c:OpenConfFile() -";
- extern BOOL in_client;
int lvl = in_client?1:0;
myFILE *ret;
diff --git a/source3/passdb/pdb_ldap.c b/source3/passdb/pdb_ldap.c
index 6597dc0fb2..090621666f 100644
--- a/source3/passdb/pdb_ldap.c
+++ b/source3/passdb/pdb_ldap.c
@@ -45,6 +45,8 @@
#include "includes.h"
+extern DOM_SID global_sid_NULL;
+
#undef DBGC_CLASS
#define DBGC_CLASS DBGC_PASSDB
@@ -2436,7 +2438,6 @@ static NTSTATUS ldapsam_enum_group_memberships(struct pdb_methods *methods,
LDAPMessage *entry;
NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
int num_sids, num_gids;
- extern DOM_SID global_sid_NULL;
if (!lp_parm_bool(-1, "ldapsam", "trusted", False))
return pdb_default_enum_group_memberships(methods, username,
diff --git a/source3/printing/nt_printing.c b/source3/printing/nt_printing.c
index 7faeb60efa..97d01d43a5 100644
--- a/source3/printing/nt_printing.c
+++ b/source3/printing/nt_printing.c
@@ -22,6 +22,7 @@
#include "includes.h"
+extern struct current_user current_user;
extern DOM_SID global_sid_World;
static TDB_CONTEXT *tdb_forms; /* used for forms files */
@@ -5115,7 +5116,6 @@ BOOL print_access_check(struct current_user *user, int snum, int access_type)
BOOL result;
const char *pname;
TALLOC_CTX *mem_ctx = NULL;
- extern struct current_user current_user;
SE_PRIV se_printop = SE_PRINT_OPERATOR;
/* If user is NULL then use the current_user structure */
diff --git a/source3/printing/printfsp.c b/source3/printing/printfsp.c
index 7c5de46870..25f4d9bd46 100644
--- a/source3/printing/printfsp.c
+++ b/source3/printing/printfsp.c
@@ -21,6 +21,8 @@
#include "includes.h"
+extern struct current_user current_user;
+
/***************************************************************************
open a print file and setup a fsp for it. This is a wrapper around
print_job_start().
@@ -30,7 +32,6 @@ files_struct *print_fsp_open(connection_struct *conn, char *fname)
{
int jobid;
SMB_STRUCT_STAT sbuf;
- extern struct current_user current_user;
files_struct *fsp = file_new(conn);
fstring name;
diff --git a/source3/rpc_server/srv_lsa_nt.c b/source3/rpc_server/srv_lsa_nt.c
index db1aa57ea9..58189fec78 100644
--- a/source3/rpc_server/srv_lsa_nt.c
+++ b/source3/rpc_server/srv_lsa_nt.c
@@ -33,6 +33,8 @@
#define DBGC_CLASS DBGC_RPC_SRV
extern PRIVS privs[];
+extern DOM_SID global_sid_World;
+extern DOM_SID global_sid_Builtin;
struct lsa_info {
DOM_SID sid;
@@ -314,8 +316,6 @@ static void init_reply_lookup_sids(LSA_R_LOOKUP_SIDS *r_l,
static NTSTATUS lsa_get_generic_sd(TALLOC_CTX *mem_ctx, SEC_DESC **sd, size_t *sd_size)
{
- extern DOM_SID global_sid_World;
- extern DOM_SID global_sid_Builtin;
DOM_SID local_adm_sid;
DOM_SID adm_sid;
diff --git a/source3/rpc_server/srv_netlog_nt.c b/source3/rpc_server/srv_netlog_nt.c
index 2bc0cf301e..c8ffa18c5a 100644
--- a/source3/rpc_server/srv_netlog_nt.c
+++ b/source3/rpc_server/srv_netlog_nt.c
@@ -26,6 +26,9 @@
#include "includes.h"
+extern struct dcinfo last_dcinfo;
+extern userdom_struct current_user_info;
+
#undef DBGC_CLASS
#define DBGC_CLASS DBGC_RPC_SRV
@@ -424,7 +427,6 @@ NTSTATUS _net_auth_2(pipes_struct *p, NET_Q_AUTH_2 *q_u, NET_R_AUTH_2 *r_u)
init_net_r_auth_2(r_u, &srv_cred, &srv_flgs, status);
if (NT_STATUS_IS_OK(status)) {
- extern struct dcinfo last_dcinfo;
last_dcinfo = p->dc;
}
@@ -575,7 +577,6 @@ NTSTATUS _net_sam_logon(pipes_struct *p, NET_Q_SAM_LOGON *q_u, NET_R_SAM_LOGON *
fstring nt_username, nt_domain, nt_workstation;
auth_usersupplied_info *user_info = NULL;
auth_serversupplied_info *server_info = NULL;
- extern userdom_struct current_user_info;
SAM_ACCOUNT *sampw;
struct auth_context *auth_context = NULL;
diff --git a/source3/rpc_server/srv_pipe.c b/source3/rpc_server/srv_pipe.c
index ab21f60902..ee6c42bd88 100644
--- a/source3/rpc_server/srv_pipe.c
+++ b/source3/rpc_server/srv_pipe.c
@@ -40,6 +40,9 @@
#include "includes.h"
+extern struct pipe_id_info pipe_names[];
+extern struct current_user current_user;
+
#undef DBGC_CLASS
#define DBGC_CLASS DBGC_RPC_SRV
@@ -751,7 +754,6 @@ BOOL setup_fault_pdu(pipes_struct *p, NTSTATUS status)
BOOL check_bind_req(struct pipes_struct *p, RPC_IFACE* abstract,
RPC_IFACE* transfer, uint32 context_id)
{
- extern struct pipe_id_info pipe_names[];
char *pipe_name = p->name;
int i=0;
fstring pname;
@@ -1427,7 +1429,6 @@ struct current_user *get_current_user(struct current_user *user, pipes_struct *p
if (p->ntlmssp_auth_validated) {
memcpy(user, &p->pipe_user, sizeof(struct current_user));
} else {
- extern struct current_user current_user;
memcpy(user, &current_user, sizeof(struct current_user));
}
diff --git a/source3/rpc_server/srv_samr_nt.c b/source3/rpc_server/srv_samr_nt.c
index 7294a46d75..24ff6f1f2c 100644
--- a/source3/rpc_server/srv_samr_nt.c
+++ b/source3/rpc_server/srv_samr_nt.c
@@ -39,6 +39,7 @@
SA_RIGHT_USER_CHANGE_PASSWORD | \
SA_RIGHT_USER_SET_LOC_COM )
+extern DOM_SID global_sid_World;
extern DOM_SID global_sid_Builtin;
extern rid_name domain_group_rids[];
@@ -80,7 +81,6 @@ static NTSTATUS make_samr_object_sd( TALLOC_CTX *ctx, SEC_DESC **psd, size_t *sd
struct generic_mapping *map,
DOM_SID *sid, uint32 sid_access )
{
- extern DOM_SID global_sid_World;
DOM_SID adm_sid, act_sid, domadmin_sid;
SEC_ACE ace[5]; /* at most 5 entries */
SEC_ACCESS mask;
diff --git a/source3/rpc_server/srv_spoolss_nt.c b/source3/rpc_server/srv_spoolss_nt.c
index 2e84a7b909..0f33fd7dec 100644
--- a/source3/rpc_server/srv_spoolss_nt.c
+++ b/source3/rpc_server/srv_spoolss_nt.c
@@ -28,6 +28,8 @@
#include "includes.h"
+extern userdom_struct current_user_info;
+
#undef DBGC_CLASS
#define DBGC_CLASS DBGC_RPC_SRV
@@ -6027,7 +6029,6 @@ static BOOL check_printer_ok(NT_PRINTER_INFO_LEVEL_2 *info, int snum)
static BOOL add_printer_hook(NT_USER_TOKEN *token, NT_PRINTER_INFO_LEVEL *printer)
{
- extern userdom_struct current_user_info;
char *cmd = lp_addprinter_cmd();
char **qlines;
pstring command;
diff --git a/source3/rpc_server/srv_srvsvc_nt.c b/source3/rpc_server/srv_srvsvc_nt.c
index a71f0f1c29..d806dcdc5a 100644
--- a/source3/rpc_server/srv_srvsvc_nt.c
+++ b/source3/rpc_server/srv_srvsvc_nt.c
@@ -24,6 +24,9 @@
#include "includes.h"
+extern DOM_SID global_sid_World;
+extern struct generic_mapping file_generic_mapping;
+
#undef DBGC_CLASS
#define DBGC_CLASS DBGC_RPC_SRV
@@ -170,8 +173,6 @@ BOOL share_info_db_init(void)
static SEC_DESC *get_share_security_default( TALLOC_CTX *ctx, int snum, size_t *psize)
{
- extern DOM_SID global_sid_World;
- extern struct generic_mapping file_generic_mapping;
SEC_ACCESS sa;
SEC_ACE ace;
SEC_ACL *psa = NULL;
@@ -293,7 +294,6 @@ static BOOL delete_share_security(int snum)
void map_generic_share_sd_bits(SEC_DESC *psd)
{
- extern struct generic_mapping file_generic_mapping;
int i;
SEC_ACL *ps_dacl = NULL;
diff --git a/source3/smbd/dir.c b/source3/smbd/dir.c
index 27ec003fb8..0f32dddd2d 100644
--- a/source3/smbd/dir.c
+++ b/source3/smbd/dir.c
@@ -24,6 +24,8 @@
This module implements directory related functions for Samba.
*/
+extern struct current_user current_user;
+
/* Make directory handle internals available. */
#define NAME_CACHE_SIZE 100
@@ -785,7 +787,6 @@ BOOL get_dir_entry(connection_struct *conn,char *mask,int dirtype, pstring fname
static BOOL user_can_read_file(connection_struct *conn, char *name, SMB_STRUCT_STAT *pst)
{
- extern struct current_user current_user;
SEC_DESC *psd = NULL;
size_t sd_size;
files_struct *fsp;
@@ -838,7 +839,6 @@ static BOOL user_can_read_file(connection_struct *conn, char *name, SMB_STRUCT_S
static BOOL user_can_write_file(connection_struct *conn, char *name, SMB_STRUCT_STAT *pst)
{
- extern struct current_user current_user;
SEC_DESC *psd = NULL;
size_t sd_size;
files_struct *fsp;
diff --git a/source3/smbd/error.c b/source3/smbd/error.c
index 6988d74f91..090a2f6d81 100644
--- a/source3/smbd/error.c
+++ b/source3/smbd/error.c
@@ -23,6 +23,7 @@
/* From lib/error.c */
extern struct unix_error_map unix_dos_nt_errmap[];
+extern uint32 global_client_caps;
/* these can be set by some functions to override the error codes */
static int override_ERR_class;
static int override_ERR_code;
@@ -114,7 +115,6 @@ int unix_error_packet(char *outbuf,int def_class,uint32 def_code, NTSTATUS def_s
int error_packet(char *outbuf, uint8 eclass, uint32 ecode, NTSTATUS ntstatus, int line, const char *file)
{
int outsize = set_message(outbuf,0,0,True);
- extern uint32 global_client_caps;
BOOL force_nt_status = False;
BOOL force_dos_status = False;
diff --git a/source3/smbd/fake_file.c b/source3/smbd/fake_file.c
index 53aac1e036..ee510eb003 100644
--- a/source3/smbd/fake_file.c
+++ b/source3/smbd/fake_file.c
@@ -20,6 +20,8 @@
#include "includes.h"
+extern struct current_user current_user;
+
/****************************************************************************
Open a file with a share mode.
****************************************************************************/
@@ -29,7 +31,6 @@ files_struct *open_fake_file_shared1(enum FAKE_FILE_TYPE fake_file_type, connect
int share_mode,int ofun, uint32 new_dos_attr, int oplock_request,
int *Access,int *action)
{
- extern struct current_user current_user;
int flags=0;
files_struct *fsp = NULL;
diff --git a/source3/smbd/lanman.c b/source3/smbd/lanman.c
index d8c5201ce6..f2794d2901 100644
--- a/source3/smbd/lanman.c
+++ b/source3/smbd/lanman.c
@@ -27,6 +27,9 @@
#include "includes.h"
+extern struct current_user current_user;
+extern userdom_struct current_user_info;
+
#ifdef CHECK_TYPES
#undef CHECK_TYPES
#endif
@@ -2116,7 +2119,6 @@ static BOOL api_RDosPrintJobDel(connection_struct *conn,uint16 vuid, char *param
int snum;
fstring sharename;
int errcode;
- extern struct current_user current_user;
WERROR werr = WERR_OK;
if(!rap_to_pjobid(SVAL(p,0), sharename, &jobid))
@@ -2183,7 +2185,6 @@ static BOOL api_WPrintQueueCtrl(connection_struct *conn,uint16 vuid, char *param
int errcode = NERR_notsupported;
int snum;
WERROR werr = WERR_OK;
- extern struct current_user current_user;
/* check it's a supported varient */
if (!(strcsequal(str1,"z") && strcsequal(str2,"")))
@@ -2435,7 +2436,6 @@ static BOOL api_NetWkstaGetInfo(connection_struct *conn,uint16 vuid, char *param
char *str2 = skip_string(str1,1);
char *p = skip_string(str2,1);
char *p2;
- extern userdom_struct current_user_info;
int level = SVAL(p,0);
DEBUG(4,("NetWkstaGetInfo level %d\n",level));
diff --git a/source3/smbd/negprot.c b/source3/smbd/negprot.c
index bdb15cb3f7..054afac683 100644
--- a/source3/smbd/negprot.c
+++ b/source3/smbd/negprot.c
@@ -20,6 +20,7 @@
#include "includes.h"
+extern fstring remote_proto;
extern enum protocol_types Protocol;
extern int max_recv;
BOOL global_encrypted_passwords_negotiated = False;
@@ -549,7 +550,6 @@ int reply_negprot(connection_struct *conn,
SSVAL(outbuf,smb_vwv0,choice);
if(choice != -1) {
- extern fstring remote_proto;
fstrcpy(remote_proto,supported_protocols[protocol].short_name);
reload_services(True);
outsize = supported_protocols[protocol].proto_reply_fn(inbuf, outbuf);
diff --git a/source3/smbd/nttrans.c b/source3/smbd/nttrans.c
index d878df6636..69b83fe3da 100644
--- a/source3/smbd/nttrans.c
+++ b/source3/smbd/nttrans.c
@@ -21,6 +21,8 @@
#include "includes.h"
+extern DOM_SID global_sid_World;
+extern int max_send;
extern enum protocol_types Protocol;
extern int smb_read_error;
extern int global_oplock_break;
@@ -83,7 +85,6 @@ static char *nttrans_realloc(char **ptr, size_t size)
static int send_nt_replies(char *inbuf, char *outbuf, int bufsize, NTSTATUS nt_error, char *params,
int paramsize, char *pdata, int datasize)
{
- extern int max_send;
int data_to_send = datasize;
int params_to_send = paramsize;
int useable_space;
@@ -2020,7 +2021,6 @@ static int call_nt_transact_rename(connection_struct *conn, char *inbuf, char *o
static size_t get_null_nt_acl(TALLOC_CTX *mem_ctx, SEC_DESC **ppsd)
{
- extern DOM_SID global_sid_World;
size_t sd_size;
*ppsd = make_standard_sec_desc( mem_ctx, &global_sid_World, &global_sid_World, NULL, &sd_size);
diff --git a/source3/smbd/open.c b/source3/smbd/open.c
index 5b349e2e44..559994ca46 100644
--- a/source3/smbd/open.c
+++ b/source3/smbd/open.c
@@ -21,6 +21,7 @@
#include "includes.h"
+extern struct current_user current_user;
extern userdom_struct current_user_info;
extern uint16 global_oplock_port;
extern uint16 global_smbpid;
@@ -172,7 +173,6 @@ Error was %s\n",
static BOOL open_file(files_struct *fsp,connection_struct *conn,
const char *fname,SMB_STRUCT_STAT *psbuf,int flags,mode_t mode, uint32 desired_access)
{
- extern struct current_user current_user;
int accmode = (flags & O_ACCMODE);
int local_flags = flags;
@@ -1606,7 +1606,6 @@ int close_file_fchmod(files_struct *fsp)
files_struct *open_directory(connection_struct *conn, const char *fname, SMB_STRUCT_STAT *psbuf,
uint32 desired_access, int share_mode, int smb_ofun, int *action)
{
- extern struct current_user current_user;
BOOL got_stat = False;
files_struct *fsp = file_new(conn);
BOOL delete_on_close = GET_DELETE_ON_CLOSE_FLAG(share_mode);
@@ -1744,7 +1743,6 @@ files_struct *open_directory(connection_struct *conn, const char *fname, SMB_STR
files_struct *open_file_stat(connection_struct *conn, char *fname, SMB_STRUCT_STAT *psbuf)
{
- extern struct current_user current_user;
files_struct *fsp = NULL;
if (!VALID_STAT(*psbuf))
diff --git a/source3/smbd/oplock.c b/source3/smbd/oplock.c
index ea3ac43744..858092407f 100644
--- a/source3/smbd/oplock.c
+++ b/source3/smbd/oplock.c
@@ -31,6 +31,9 @@ static int32 level_II_oplocks_open = 0;
BOOL global_client_failed_oplock_break = False;
BOOL global_oplock_break = False;
+extern struct timeval smb_last_time;
+extern uint32 global_client_caps;
+extern struct current_user current_user;
extern int smb_read_error;
static struct kernel_oplocks *koplocks;
@@ -518,8 +521,6 @@ static void prepare_break_message(char *outbuf, files_struct *fsp, BOOL level2)
static void wait_before_sending_break(BOOL local_request)
{
- extern struct timeval smb_last_time;
-
if(local_request) {
struct timeval cur_tv;
long wait_left = (long)lp_oplock_break_wait_time();
@@ -603,7 +604,6 @@ static files_struct *initial_break_processing(SMB_DEV_T dev, SMB_INO_T inode, un
static BOOL oplock_break_level2(files_struct *fsp, BOOL local_request)
{
- extern uint32 global_client_caps;
char outbuf[128];
SMB_DEV_T dev = fsp->dev;
SMB_INO_T inode = fsp->inode;
@@ -676,8 +676,6 @@ static BOOL oplock_break_level2(files_struct *fsp, BOOL local_request)
static BOOL oplock_break(SMB_DEV_T dev, SMB_INO_T inode, unsigned long file_id, BOOL local_request)
{
- extern uint32 global_client_caps;
- extern struct current_user current_user;
char *inbuf = NULL;
char *outbuf = NULL;
files_struct *fsp = NULL;
diff --git a/source3/smbd/oplock_linux.c b/source3/smbd/oplock_linux.c
index fe324577e1..5d6bdb9883 100644
--- a/source3/smbd/oplock_linux.c
+++ b/source3/smbd/oplock_linux.c
@@ -22,6 +22,22 @@
#if HAVE_KERNEL_OPLOCKS_LINUX
+/* these can be removed when they are in glibc headers */
+struct cap_user_header {
+ uint32 version;
+ int pid;
+} header;
+struct cap_user_data {
+ uint32 effective;
+ uint32 permitted;
+ uint32 inheritable;
+} data;
+
+extern int capget(struct cap_user_header * hdrp,
+ struct cap_user_data * datap);
+extern int capset(struct cap_user_header * hdrp,
+ const struct cap_user_data * datap);
+
static SIG_ATOMIC_T signals_received;
#define FD_PENDING_SIZE 100
static SIG_ATOMIC_T fd_pending_array[FD_PENDING_SIZE];
@@ -68,22 +84,6 @@ static void set_capability(unsigned capability)
#ifndef _LINUX_CAPABILITY_VERSION
#define _LINUX_CAPABILITY_VERSION 0x19980330
#endif
- /* these can be removed when they are in glibc headers */
- struct cap_user_header {
- uint32 version;
- int pid;
- } header;
- struct cap_user_data {
- uint32 effective;
- uint32 permitted;
- uint32 inheritable;
- } data;
-
- extern int capget(struct cap_user_header * hdrp,
- struct cap_user_data * datap);
- extern int capset(struct cap_user_header * hdrp,
- const struct cap_user_data * datap);
-
header.version = _LINUX_CAPABILITY_VERSION;
header.pid = 0;
diff --git a/source3/smbd/posix_acls.c b/source3/smbd/posix_acls.c
index 87173fca3b..31135f0907 100644
--- a/source3/smbd/posix_acls.c
+++ b/source3/smbd/posix_acls.c
@@ -21,6 +21,14 @@
#include "includes.h"
+extern struct current_user current_user;
+extern DOM_SID global_sid_Creator_Owner;
+extern DOM_SID global_sid_Creator_Group;
+extern DOM_SID global_sid_World;
+extern DOM_SID global_sid_Builtin_Administrators;
+extern DOM_SID global_sid_Builtin_Users;
+extern struct generic_mapping file_generic_mapping;
+
#undef DBGC_CLASS
#define DBGC_CLASS DBGC_ACLS
@@ -916,7 +924,6 @@ static BOOL unpack_nt_owners(int snum, SMB_STRUCT_STAT *psbuf, uid_t *puser, gid
if (lp_force_unknown_acl_user(snum)) {
/* this allows take ownership to work
* reasonably */
- extern struct current_user current_user;
*puser = current_user.uid;
} else {
DEBUG(3,("unpack_nt_owners: unable to validate"
@@ -938,7 +945,6 @@ static BOOL unpack_nt_owners(int snum, SMB_STRUCT_STAT *psbuf, uid_t *puser, gid
if (lp_force_unknown_acl_user(snum)) {
/* this allows take group ownership to work
* reasonably */
- extern struct current_user current_user;
*pgrp = current_user.gid;
} else {
DEBUG(3,("unpack_nt_owners: unable to validate"
@@ -1003,10 +1009,8 @@ static void apply_default_perms(files_struct *fsp, canon_ace *pace, mode_t type)
static BOOL uid_entry_in_group( canon_ace *uid_ace, canon_ace *group_ace )
{
- extern DOM_SID global_sid_World;
fstring u_name;
fstring g_name;
- extern struct current_user current_user;
/* "Everyone" always matches every uid. */
@@ -1046,7 +1050,6 @@ static BOOL ensure_canon_entry_valid(canon_ace **pp_ace,
SMB_STRUCT_STAT *pst,
BOOL setting_acl)
{
- extern DOM_SID global_sid_World;
canon_ace *pace;
BOOL got_user = False;
BOOL got_grp = False;
@@ -1220,10 +1223,6 @@ static BOOL create_canon_ace_lists(files_struct *fsp, SMB_STRUCT_STAT *pst,
canon_ace **ppfile_ace, canon_ace **ppdir_ace,
SEC_ACL *dacl)
{
- extern DOM_SID global_sid_Creator_Owner;
- extern DOM_SID global_sid_Creator_Group;
- extern DOM_SID global_sid_World;
- extern struct generic_mapping file_generic_mapping;
BOOL all_aces_are_inherit_only = (fsp->is_directory ? True : False);
canon_ace *file_ace = NULL;
canon_ace *dir_ace = NULL;
@@ -1647,7 +1646,6 @@ Deny entry after Allow entry. Failing to set on file %s.\n", fsp->fsp_name ));
static void process_deny_list( canon_ace **pp_ace_list )
{
- extern DOM_SID global_sid_World;
canon_ace *ace_list = *pp_ace_list;
canon_ace *curr_ace = NULL;
canon_ace *curr_ace_next = NULL;
@@ -2067,7 +2065,6 @@ static void arrange_posix_perms( char *filename, canon_ace **pp_list_head)
static canon_ace *canonicalise_acl( files_struct *fsp, SMB_ACL_T posix_acl, SMB_STRUCT_STAT *psbuf,
DOM_SID *powner, DOM_SID *pgroup, struct pai_val *pal, SMB_ACL_TYPE_T the_acl_type)
{
- extern DOM_SID global_sid_World;
connection_struct *conn = fsp->conn;
mode_t acl_mask = (S_IRUSR|S_IWUSR|S_IXUSR);
canon_ace *list_head = NULL;
@@ -2629,10 +2626,6 @@ static size_t merge_default_aces( SEC_ACE *nt_ace_list, size_t num_aces)
size_t get_nt_acl(files_struct *fsp, uint32 security_info, SEC_DESC **ppdesc)
{
- extern DOM_SID global_sid_Builtin_Administrators;
- extern DOM_SID global_sid_Builtin_Users;
- extern DOM_SID global_sid_Creator_Owner;
- extern DOM_SID global_sid_Creator_Group;
connection_struct *conn = fsp->conn;
SMB_STRUCT_STAT sbuf;
SEC_ACE *nt_ace_list = NULL;
@@ -2920,7 +2913,6 @@ size_t get_nt_acl(files_struct *fsp, uint32 security_info, SEC_DESC **ppdesc)
static int try_chown(connection_struct *conn, const char *fname, uid_t uid, gid_t gid)
{
int ret;
- extern struct current_user current_user;
files_struct *fsp;
SMB_STRUCT_STAT st;
@@ -2976,7 +2968,6 @@ BOOL set_nt_acl(files_struct *fsp, uint32 security_info_sent, SEC_DESC *psd)
uid_t orig_uid;
gid_t orig_gid;
BOOL need_chown = False;
- extern struct current_user current_user;
DEBUG(10,("set_nt_acl: called for file %s\n", fsp->fsp_name ));
@@ -3760,7 +3751,6 @@ BOOL set_unix_posix_acl(connection_struct *conn, files_struct *fsp, const char *
static int check_posix_acl_group_write(connection_struct *conn, const char *fname, SMB_STRUCT_STAT *psbuf)
{
- extern struct current_user current_user;
SMB_ACL_T posix_acl = NULL;
int entry_id = SMB_ACL_FIRST_ENTRY;
SMB_ACL_ENTRY_T entry;
@@ -3922,7 +3912,6 @@ failed to match on user or group in token.\n", fname ));
BOOL can_delete_file_in_directory(connection_struct *conn, const char *fname)
{
- extern struct current_user current_user;
SMB_STRUCT_STAT sbuf;
pstring dname;
int ret;
@@ -3980,7 +3969,6 @@ BOOL can_delete_file_in_directory(connection_struct *conn, const char *fname)
BOOL can_write_to_file(connection_struct *conn, const char *fname)
{
- extern struct current_user current_user;
SMB_STRUCT_STAT sbuf;
int ret;
diff --git a/source3/smbd/process.c b/source3/smbd/process.c
index 3043cadfd8..1bf6f4f9d1 100644
--- a/source3/smbd/process.c
+++ b/source3/smbd/process.c
@@ -20,6 +20,11 @@
#include "includes.h"
+extern uint16 global_smbpid;
+extern int keepalive;
+extern struct auth_context *negprot_global_auth_context;
+extern int smb_echo_count;
+
struct timeval smb_last_time;
static char *InBuffer = NULL;
@@ -852,7 +857,6 @@ static int switch_message(int type,char *inbuf,char *outbuf,int size,int bufsize
{
static pid_t pid= (pid_t)-1;
int outsize = 0;
- extern uint16 global_smbpid;
type &= 0xff;
@@ -1331,7 +1335,6 @@ static BOOL timeout_processing(int deadtime, int *select_timeout, time_t *last_t
static time_t last_idle_closed_check = 0;
time_t t;
BOOL allidle = True;
- extern int keepalive;
if (smb_read_error == READ_EOF) {
DEBUG(3,("timeout_processing: End of file from client (client has disconnected).\n"));
@@ -1375,7 +1378,6 @@ static BOOL timeout_processing(int deadtime, int *select_timeout, time_t *last_t
}
if (keepalive && (t - last_keepalive_sent_time)>keepalive) {
- extern struct auth_context *negprot_global_auth_context;
if (!send_keepalive(smbd_server_fd())) {
DEBUG( 2, ( "Keepalive failed - exiting.\n" ) );
return False;
@@ -1493,7 +1495,6 @@ machine %s in domain %s.\n", global_myname(), lp_workgroup()));
void smbd_process(void)
{
- extern int smb_echo_count;
time_t last_timeout_processing_time = time(NULL);
unsigned int num_smbs = 0;
const size_t total_buffer_size = BUFFER_SIZE + LARGE_WRITEX_HDR_SIZE + SAFETY_MARGIN;
diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c
index 0d1523ae3b..c3cb81ddfc 100644
--- a/source3/smbd/reply.c
+++ b/source3/smbd/reply.c
@@ -35,6 +35,7 @@ extern int global_oplock_break;
unsigned int smb_echo_count = 0;
extern uint32 global_client_caps;
+extern struct current_user current_user;
extern BOOL global_encrypted_passwords_negotiated;
/****************************************************************************
@@ -471,7 +472,6 @@ int reply_tcon_and_X(connection_struct *conn, char *inbuf,char *outbuf,int lengt
int passlen = SVAL(inbuf,smb_vwv3);
pstring path;
char *p, *q;
- extern BOOL global_encrypted_passwords_negotiated;
START_PROFILE(SMBtconX);
@@ -2010,7 +2010,6 @@ void send_file_readbraw(connection_struct *conn, files_struct *fsp, SMB_OFF_T st
int reply_readbraw(connection_struct *conn, char *inbuf, char *outbuf, int dum_size, int out_buffsize)
{
- extern struct current_user current_user;
ssize_t maxcount,mincount;
size_t nread = 0;
SMB_OFF_T startpos;
@@ -2980,7 +2979,6 @@ int reply_exit(connection_struct *conn,
int reply_close(connection_struct *conn, char *inbuf,char *outbuf, int size,
int dum_buffsize)
{
- extern struct current_user current_user;
int outsize = 0;
time_t mtime;
int32 eclass = 0, err = 0;
diff --git a/source3/smbd/server.c b/source3/smbd/server.c
index 7f7d55c7e3..9d910cd14a 100644
--- a/source3/smbd/server.c
+++ b/source3/smbd/server.c
@@ -30,6 +30,8 @@ int last_message = -1;
/* a useful macro to debug the last message processed */
#define LAST_MESSAGE() smb_fn_name(last_message)
+extern char *last_inbuf;
+extern struct auth_context *negprot_global_auth_context;
extern pstring user_socket_options;
extern SIG_ATOMIC_T got_sig_term;
extern SIG_ATOMIC_T reload_after_sighup;
@@ -598,8 +600,6 @@ static BOOL dump_core(void)
void exit_server(const char *reason)
{
static int firsttime=1;
- extern char *last_inbuf;
- extern struct auth_context *negprot_global_auth_context;
if (!firsttime)
exit(0);
diff --git a/source3/smbd/service.c b/source3/smbd/service.c
index 7bbf8d7f2a..d39d3d3836 100644
--- a/source3/smbd/service.c
+++ b/source3/smbd/service.c
@@ -20,6 +20,7 @@
#include "includes.h"
+extern char magic_char;
extern struct timeval smb_last_time;
extern userdom_struct current_user_info;
@@ -30,7 +31,6 @@ extern userdom_struct current_user_info;
BOOL set_current_service(connection_struct *conn, uint16 flags, BOOL do_chdir)
{
- extern char magic_char;
static connection_struct *last_conn;
static uint16 last_flags;
int snum;
diff --git a/source3/smbd/sesssetup.c b/source3/smbd/sesssetup.c
index 60867df653..9fbf0b1d51 100644
--- a/source3/smbd/sesssetup.c
+++ b/source3/smbd/sesssetup.c
@@ -25,6 +25,12 @@
uint32 global_client_caps = 0;
+extern BOOL global_encrypted_passwords_negotiated;
+extern BOOL global_spnego_negotiated;
+extern enum protocol_types Protocol;
+extern int max_send;
+extern struct auth_context *negprot_global_auth_context;
+
static struct auth_ntlmssp_state *global_ntlmssp_state;
/*
@@ -637,13 +643,8 @@ 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;
diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c
index f8123bc11a..8d673c25bd 100644
--- a/source3/smbd/trans2.c
+++ b/source3/smbd/trans2.c
@@ -23,6 +23,7 @@
#include "includes.h"
+extern int max_send;
extern enum protocol_types Protocol;
extern int smb_read_error;
extern int global_oplock_break;
@@ -574,7 +575,6 @@ static int send_trans2_replies(char *outbuf,
global struct. These different max_xmit variables should
be merged as this is now too confusing */
- extern int max_send;
int data_to_send = datasize;
int params_to_send = paramsize;
int useable_space;
diff --git a/source3/tdb/tdbbackup.c b/source3/tdb/tdbbackup.c
index 1a0e1c1588..f49cd339c7 100644
--- a/source3/tdb/tdbbackup.c
+++ b/source3/tdb/tdbbackup.c
@@ -69,6 +69,9 @@
#include "tdb.h"
#include "tdbback.h"
+extern int optind;
+extern char *optarg;
+
/*
see if one file is newer than another
*/
@@ -100,8 +103,6 @@ static void usage(void)
int c;
int verify = 0;
const char *suffix = ".bak";
- extern int optind;
- extern char *optarg;
while ((c = getopt(argc, argv, "vhs:")) != -1) {
switch (c) {
diff --git a/source3/utils/net.c b/source3/utils/net.c
index 9c05828357..ef992b1014 100644
--- a/source3/utils/net.c
+++ b/source3/utils/net.c
@@ -87,6 +87,7 @@ const char *opt_destination = NULL;
BOOL opt_have_ip = False;
struct in_addr opt_dest_ip;
+extern struct in_addr loopback_ip;
extern BOOL AllowDebugChange;
uint32 get_sec_channel_type(const char *param)
@@ -321,7 +322,6 @@ BOOL net_find_server(unsigned flags, struct in_addr *server_ip, char **server_na
}
*server_name = SMB_STRDUP(inet_ntoa(opt_dest_ip));
} else if (!(flags & NET_FLAGS_LOCALHOST_DEFAULT_INSANE)) {
- extern struct in_addr loopback_ip;
*server_ip = loopback_ip;
*server_name = SMB_STRDUP("127.0.0.1");
}
diff --git a/source3/web/diagnose.c b/source3/web/diagnose.c
index a490786068..0c9c854df7 100644
--- a/source3/web/diagnose.c
+++ b/source3/web/diagnose.c
@@ -23,6 +23,8 @@
#ifdef WITH_WINBIND
+extern struct in_addr loopback_ip;
+
NSS_STATUS winbindd_request(int req_type,
struct winbindd_request *request,
struct winbindd_response *response);
@@ -39,7 +41,6 @@ BOOL winbindd_running(void)
response */
BOOL nmbd_running(void)
{
- extern struct in_addr loopback_ip;
int fd, count, flags;
struct in_addr *ip_list;
@@ -64,7 +65,6 @@ BOOL nmbd_running(void)
BOOL smbd_running(void)
{
static struct cli_state cli;
- extern struct in_addr loopback_ip;
if (!cli_initialise(&cli))
return False;