summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2009-11-04 15:15:50 -0800
committerJeremy Allison <jra@samba.org>2009-11-04 15:15:50 -0800
commitcbafe17bb37acfb76acf9d9905be1029e274089e (patch)
tree26e1eb9b867a5564400dce6d3839891c9a9b9d16 /source3
parent51cb96271b4f9a4bd37b44bdb6042913b60ba3c1 (diff)
downloadsamba-cbafe17bb37acfb76acf9d9905be1029e274089e.tar.gz
samba-cbafe17bb37acfb76acf9d9905be1029e274089e.tar.bz2
samba-cbafe17bb37acfb76acf9d9905be1029e274089e.zip
Remove "Protocol" as an extern, and add accessor functions.
Jeremy.
Diffstat (limited to 'source3')
-rw-r--r--source3/include/proto.h2
-rw-r--r--source3/lib/util.c12
-rw-r--r--source3/param/loadparm.c3
-rw-r--r--source3/smbd/negprot.c13
-rw-r--r--source3/smbd/nttrans.c3
-rw-r--r--source3/smbd/reply.c12
-rw-r--r--source3/smbd/sesssetup.c6
-rw-r--r--source3/smbd/smb2_negprot.c4
-rw-r--r--source3/smbd/trans2.c6
9 files changed, 31 insertions, 30 deletions
diff --git a/source3/include/proto.h b/source3/include/proto.h
index 6c8cb2e3ac..6a90c87f84 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -1073,6 +1073,8 @@ struct passwd *Get_Pwnam_alloc(TALLOC_CTX *mem_ctx, const char *user);
/* The following definitions come from lib/util.c */
+enum protocol_types get_Protocol(void);
+void set_Protocol(enum protocol_types p);
bool all_zero(const uint8_t *ptr, size_t size);
bool set_global_myname(const char *myname);
const char *global_myname(void);
diff --git a/source3/lib/util.c b/source3/lib/util.c
index b066a0d346..247042d7d9 100644
--- a/source3/lib/util.c
+++ b/source3/lib/util.c
@@ -55,7 +55,17 @@ extern unsigned int global_clobber_region_line;
#endif /* WITH_NISPLUS_HOME */
#endif /* HAVE_NETGROUP && WITH_AUTOMOUNT */
-enum protocol_types Protocol = PROTOCOL_COREPLUS;
+static enum protocol_types Protocol = PROTOCOL_COREPLUS;
+
+enum protocol_types get_Protocol(void)
+{
+ return Protocol;
+}
+
+void set_Protocol(enum protocol_types p)
+{
+ Protocol = p;
+}
static enum remote_arch_types ra_type = RA_UNKNOWN;
diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c
index 93be01783d..06fb962576 100644
--- a/source3/param/loadparm.c
+++ b/source3/param/loadparm.c
@@ -64,7 +64,6 @@
bool bLoaded = False;
-extern enum protocol_types Protocol;
extern userdom_struct current_user_info;
#ifndef GLOBAL_NAME
@@ -9720,7 +9719,7 @@ bool lp_use_sendfile(int snum, struct smb_signing_state *signing_state)
bool sign_active = false;
/* Using sendfile blows the brains out of any DOS or Win9x TCP stack... JRA. */
- if (Protocol < PROTOCOL_NT1) {
+ if (get_Protocol() < PROTOCOL_NT1) {
return false;
}
if (signing_state) {
diff --git a/source3/smbd/negprot.c b/source3/smbd/negprot.c
index 372f38eb57..81d29d90f9 100644
--- a/source3/smbd/negprot.c
+++ b/source3/smbd/negprot.c
@@ -23,7 +23,6 @@
#include "../libcli/auth/spnego.h"
extern fstring remote_proto;
-extern enum protocol_types Protocol;
static void get_challenge(uint8 buff[8])
{
@@ -61,7 +60,7 @@ static void reply_corep(struct smb_request *req, uint16 choice)
reply_outbuf(req, 1, 0);
SSVAL(req->outbuf, smb_vwv0, choice);
- Protocol = PROTOCOL_CORE;
+ set_Protocol(PROTOCOL_CORE);
}
/****************************************************************************
@@ -81,7 +80,7 @@ static void reply_coreplus(struct smb_request *req, uint16 choice)
SCVAL(req->outbuf,smb_flg,FLAG_REPLY|FLAG_SUPPORT_LOCKREAD);
SSVAL(req->outbuf,smb_vwv1,0x1); /* user level security, don't
* encrypt */
- Protocol = PROTOCOL_COREPLUS;
+ set_Protocol(PROTOCOL_COREPLUS);
}
/****************************************************************************
@@ -114,7 +113,7 @@ static void reply_lanman1(struct smb_request *req, uint16 choice)
SSVAL(req->outbuf,smb_vwv11, 8);
}
- Protocol = PROTOCOL_LANMAN1;
+ set_Protocol(PROTOCOL_LANMAN1);
/* Reply, SMBlockread, SMBwritelock supported. */
SCVAL(req->outbuf,smb_flg,FLAG_REPLY|FLAG_SUPPORT_LOCKREAD);
@@ -163,7 +162,7 @@ static void reply_lanman2(struct smb_request *req, uint16 choice)
SSVAL(req->outbuf,smb_vwv11, 8);
}
- Protocol = PROTOCOL_LANMAN2;
+ set_Protocol(PROTOCOL_LANMAN2);
/* Reply, SMBlockread, SMBwritelock supported. */
SCVAL(req->outbuf,smb_flg,FLAG_REPLY|FLAG_SUPPORT_LOCKREAD);
@@ -345,7 +344,7 @@ static void reply_nt1(struct smb_request *req, uint16 choice)
SSVAL(req->outbuf,smb_vwv0,choice);
SCVAL(req->outbuf,smb_vwv1,secword);
- Protocol = PROTOCOL_NT1;
+ set_Protocol(PROTOCOL_NT1);
SSVAL(req->outbuf,smb_vwv1+1,lp_maxmux()); /* maxmpx */
SSVAL(req->outbuf,smb_vwv2+1,1); /* num vcs */
@@ -698,7 +697,7 @@ void reply_negprot(struct smb_request *req)
DEBUG( 5, ( "negprot index=%d\n", choice ) );
- if ((lp_server_signing() == Required) && (Protocol < PROTOCOL_NT1)) {
+ if ((lp_server_signing() == Required) && (get_Protocol() < PROTOCOL_NT1)) {
exit_server_cleanly("SMB signing is required and "
"client negotiated a downlevel protocol");
}
diff --git a/source3/smbd/nttrans.c b/source3/smbd/nttrans.c
index 0cc05dbd52..66102fa96c 100644
--- a/source3/smbd/nttrans.c
+++ b/source3/smbd/nttrans.c
@@ -21,7 +21,6 @@
#include "includes.h"
#include "smbd/globals.h"
-extern enum protocol_types Protocol;
extern const struct generic_mapping file_generic_mapping;
static char *nttrans_realloc(char **ptr, size_t size)
@@ -2538,7 +2537,7 @@ static void handle_nttrans(connection_struct *conn,
struct trans_state *state,
struct smb_request *req)
{
- if (Protocol >= PROTOCOL_NT1) {
+ if (get_Protocol() >= PROTOCOL_NT1) {
req->flags2 |= 0x40; /* IS_LONG_NAME */
SSVAL(req->inbuf,smb_flg2,req->flags2);
}
diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c
index 2365ed1da1..984cf56c11 100644
--- a/source3/smbd/reply.c
+++ b/source3/smbd/reply.c
@@ -27,8 +27,6 @@
#include "includes.h"
#include "smbd/globals.h"
-extern enum protocol_types Protocol;
-
/****************************************************************************
Ensure we check the path in *exactly* the same way as W2K for a findfirst/findnext
path or anything including wildcards.
@@ -787,7 +785,7 @@ void reply_tcon_and_X(struct smb_request *req)
else
server_devicetype = "A:";
- if (Protocol < PROTOCOL_NT1) {
+ if (get_Protocol() < PROTOCOL_NT1) {
reply_outbuf(req, 2, 0);
if (message_push_string(&req->outbuf, server_devicetype,
STR_TERMINATE|STR_ASCII) == -1) {
@@ -1141,7 +1139,7 @@ void reply_getatr(struct smb_request *req)
}
SIVAL(req->outbuf,smb_vwv3,(uint32)size);
- if (Protocol >= PROTOCOL_NT1) {
+ if (get_Protocol() >= PROTOCOL_NT1) {
SSVAL(req->outbuf, smb_flg2,
SVAL(req->outbuf, smb_flg2) | FLAGS2_IS_LONG_NAME);
}
@@ -1266,7 +1264,7 @@ void reply_dskattr(struct smb_request *req)
reply_outbuf(req, 5, 0);
- if (Protocol <= PROTOCOL_LANMAN2) {
+ if (get_Protocol() <= PROTOCOL_LANMAN2) {
double total_space, free_space;
/* we need to scale this to a number that DOS6 can handle. We
use floating point so we can handle large drives on systems
@@ -3775,7 +3773,7 @@ void reply_writebraw(struct smb_request *req)
/* We have to deal with slightly different formats depending
on whether we are using the core+ or lanman1.0 protocol */
- if(Protocol <= PROTOCOL_COREPLUS) {
+ if(get_Protocol() <= PROTOCOL_COREPLUS) {
numtowrite = SVAL(smb_buf(req->inbuf),-2);
data = smb_buf(req->inbuf);
} else {
@@ -3831,7 +3829,7 @@ void reply_writebraw(struct smb_request *req)
* it to send more bytes */
memcpy(buf, req->inbuf, smb_size);
- srv_set_message(buf,Protocol>PROTOCOL_COREPLUS?1:0,0,True);
+ srv_set_message(buf,get_Protocol()>PROTOCOL_COREPLUS?1:0,0,True);
SCVAL(buf,smb_com,SMBwritebraw);
SSVALS(buf,smb_vwv0,0xFFFF);
show_msg(buf);
diff --git a/source3/smbd/sesssetup.c b/source3/smbd/sesssetup.c
index 16ea2ebfa9..addd386fb4 100644
--- a/source3/smbd/sesssetup.c
+++ b/source3/smbd/sesssetup.c
@@ -26,8 +26,6 @@
#include "smbd/globals.h"
#include "../libcli/auth/spnego.h"
-extern enum protocol_types Protocol;
-
/* For split krb5 SPNEGO blobs. */
struct pending_auth_data {
struct pending_auth_data *prev, *next;
@@ -1432,7 +1430,7 @@ void reply_sesssetup_and_X(struct smb_request *req)
smb_bufsize = SVAL(req->vwv+2, 0);
- if (Protocol < PROTOCOL_NT1) {
+ if (get_Protocol() < PROTOCOL_NT1) {
uint16 passlen1 = SVAL(req->vwv+7, 0);
/* Never do NT status codes with protocols before NT1 as we
@@ -1759,7 +1757,7 @@ void reply_sesssetup_and_X(struct smb_request *req)
/* it's ok - setup a reply */
reply_outbuf(req, 3, 0);
- if (Protocol >= PROTOCOL_NT1) {
+ if (get_Protocol() >= PROTOCOL_NT1) {
push_signature(&req->outbuf);
/* perhaps grab OS version here?? */
}
diff --git a/source3/smbd/smb2_negprot.c b/source3/smbd/smb2_negprot.c
index 2c6449dbaa..5b97c65d79 100644
--- a/source3/smbd/smb2_negprot.c
+++ b/source3/smbd/smb2_negprot.c
@@ -22,8 +22,6 @@
#include "smbd/globals.h"
#include "../libcli/smb/smb_common.h"
-extern enum protocol_types Protocol;
-
/*
* this is the entry point if SMB2 is selected via
* the SMB negprot
@@ -114,7 +112,7 @@ NTSTATUS smbd_smb2_request_process_negprot(struct smbd_smb2_request *req)
return smbd_smb2_request_error(req, NT_STATUS_INVALID_PARAMETER);
}
- Protocol = PROTOCOL_SMB2;
+ set_Protocol(PROTOCOL_SMB2);
if (get_remote_arch() != RA_SAMBA) {
set_remote_arch(RA_VISTA);
diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c
index 445817ff11..74dd173f4f 100644
--- a/source3/smbd/trans2.c
+++ b/source3/smbd/trans2.c
@@ -28,8 +28,6 @@
#include "smbd/globals.h"
#include "../libcli/auth/libcli_auth.h"
-extern enum protocol_types Protocol;
-
#define DIR_ENTRY_SAFETY_MARGIN 4096
static char *store_file_unix_basic(connection_struct *conn,
@@ -2466,7 +2464,7 @@ total_data=%u (should be %u)\n", (unsigned int)total_data, (unsigned int)IVAL(pd
if(numentries == 0) {
dptr_close(sconn, &dptr_num);
- if (Protocol < PROTOCOL_NT1) {
+ if (get_Protocol() < PROTOCOL_NT1) {
reply_doserror(req, ERRDOS, ERRnofiles);
goto out;
} else {
@@ -8161,7 +8159,7 @@ void reply_findnclose(struct smb_request *req)
static void handle_trans2(connection_struct *conn, struct smb_request *req,
struct trans_state *state)
{
- if (Protocol >= PROTOCOL_NT1) {
+ if (get_Protocol() >= PROTOCOL_NT1) {
req->flags2 |= 0x40; /* IS_LONG_NAME */
SSVAL(req->inbuf,smb_flg2,req->flags2);
}