summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2009-11-23 16:33:26 +0100
committerVolker Lendecke <vl@samba.org>2009-11-23 16:34:59 +0100
commit0f8e2a6ebb716588e741c2cdd8e9918262fdd4c6 (patch)
tree5ac6a5d6276f2645e0d4f2ae89c92420bd66985f
parent81c46686db36eaffd25c013f19094b01a8406c6a (diff)
downloadsamba-0f8e2a6ebb716588e741c2cdd8e9918262fdd4c6.tar.gz
samba-0f8e2a6ebb716588e741c2cdd8e9918262fdd4c6.tar.bz2
samba-0f8e2a6ebb716588e741c2cdd8e9918262fdd4c6.zip
Revert "s3: Move the global variable Protocol to struct smbd_server_connection"
This reverts commit c85a4c9ba4a7de65a7850f6f9708df66bd24deea.
-rw-r--r--source3/client/client.c2
-rw-r--r--source3/client/clitar.c4
-rw-r--r--source3/include/proto.h4
-rw-r--r--source3/include/smb.h1
-rw-r--r--source3/lib/util.c12
-rw-r--r--source3/modules/vfs_preopen.c2
-rw-r--r--source3/smbd/dir.c3
-rw-r--r--source3/smbd/dosmode.c10
-rw-r--r--source3/smbd/filename.c2
-rw-r--r--source3/smbd/globals.c10
-rw-r--r--source3/smbd/globals.h1
-rw-r--r--source3/smbd/negprot.c13
-rw-r--r--source3/smbd/nttrans.c2
-rw-r--r--source3/smbd/open.c4
-rw-r--r--source3/smbd/process.c1
-rw-r--r--source3/smbd/reply.c28
-rw-r--r--source3/smbd/sesssetup.c4
-rw-r--r--source3/smbd/smb2_negprot.c2
-rw-r--r--source3/smbd/trans2.c14
19 files changed, 53 insertions, 66 deletions
diff --git a/source3/client/client.c b/source3/client/client.c
index 19efa03d3a..7cbaa81d52 100644
--- a/source3/client/client.c
+++ b/source3/client/client.c
@@ -473,7 +473,7 @@ static bool do_this_one(file_info *finfo)
if (*client_get_fileselection() &&
!mask_match(finfo->name, client_get_fileselection(),
- PROTOCOL_NONE, false)) {
+ get_Protocol(), false)) {
DEBUG(3,("mask_match %s failed\n", finfo->name));
return false;
}
diff --git a/source3/client/clitar.c b/source3/client/clitar.c
index 7a956f9e56..4cbe69f649 100644
--- a/source3/client/clitar.c
+++ b/source3/client/clitar.c
@@ -829,7 +829,7 @@ static void do_tar(file_info *finfo, const char *dir)
if ((!tar_re_search && clipfind(cliplist, clipn, exclaim)) ||
(tar_re_search
&& mask_match_list(exclaim, cliplist, clipn,
- PROTOCOL_NONE, True))) {
+ get_Protocol(), True))) {
DEBUG(3,("Skipping file %s\n", exclaim));
TALLOC_FREE(exclaim);
return;
@@ -1214,7 +1214,7 @@ static void do_tarput(void)
skip = clipn && ((!tar_re_search && clipfind(cliplist, clipn, finfo.name) ^ tar_excl) ||
(tar_re_search
&& mask_match_list(finfo.name, cliplist,
- clipn, PROTOCOL_NONE,
+ clipn, get_Protocol(),
True)));
DEBUG(5, ("Skip = %i, cliplist=%s, file=%s\n", skip, (cliplist?cliplist[0]:NULL), finfo.name));
diff --git a/source3/include/proto.h b/source3/include/proto.h
index b708c26100..d4b734b8f9 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -1073,8 +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(const struct smbd_server_connection *c);
-void set_Protocol(struct smbd_server_connection *c, enum protocol_types p);
+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/include/smb.h b/source3/include/smb.h
index 94d2aa2570..a3acb7c415 100644
--- a/source3/include/smb.h
+++ b/source3/include/smb.h
@@ -652,7 +652,6 @@ struct smb_request {
size_t unread_bytes;
bool encrypted;
connection_struct *conn;
- struct smbd_server_connection *sconn;
struct smb_perfcount_data pcd;
/*
diff --git a/source3/lib/util.c b/source3/lib/util.c
index d194c3ae4b..933b787697 100644
--- a/source3/lib/util.c
+++ b/source3/lib/util.c
@@ -55,6 +55,18 @@ extern unsigned int global_clobber_region_line;
#endif /* WITH_NISPLUS_HOME */
#endif /* HAVE_NETGROUP && WITH_AUTOMOUNT */
+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/modules/vfs_preopen.c b/source3/modules/vfs_preopen.c
index 1ecbc3aa8a..d91a031227 100644
--- a/source3/modules/vfs_preopen.c
+++ b/source3/modules/vfs_preopen.c
@@ -396,7 +396,7 @@ static int preopen_open(vfs_handle_struct *handle,
}
if (!is_in_path(smb_fname->base_name, state->preopen_names,
- get_Protocol(handle->conn->sconn), true)) {
+ get_Protocol(), true)) {
DEBUG(10, ("%s does not match the preopen:names list\n",
smb_fname_str_dbg(smb_fname)));
return res;
diff --git a/source3/smbd/dir.c b/source3/smbd/dir.c
index 25ca5e51b4..137048d4d4 100644
--- a/source3/smbd/dir.c
+++ b/source3/smbd/dir.c
@@ -1215,8 +1215,7 @@ bool is_visible_file(connection_struct *conn, const char *dir_path,
}
/* If it's a vetoed file, pretend it doesn't even exist */
- if (use_veto && is_in_path(name, conn->veto_list,
- get_Protocol(conn->sconn),
+ if (use_veto && is_in_path(name, conn->veto_list, get_Protocol(),
conn->case_sensitive)) {
DEBUG(10,("is_visible_file: file %s is vetoed.\n", name ));
return False;
diff --git a/source3/smbd/dosmode.c b/source3/smbd/dosmode.c
index baf235d3fe..928d48c351 100644
--- a/source3/smbd/dosmode.c
+++ b/source3/smbd/dosmode.c
@@ -455,13 +455,12 @@ uint32 dos_mode_msdfs(connection_struct *conn,
/* Optimization : Only call is_hidden_path if it's not already
hidden. */
if (!(result & aHIDDEN) &&
- is_in_path(smb_fname->base_name, conn->hide_list,
- get_Protocol(conn->sconn),
+ is_in_path(smb_fname->base_name, conn->hide_list, get_Protocol(),
conn->case_sensitive)) {
result |= aHIDDEN;
}
- if (get_Protocol(conn->sconn) <= PROTOCOL_LANMAN2) {
+ if (get_Protocol() <= PROTOCOL_LANMAN2) {
DEBUG(10,("dos_mode_msdfs : filtering result 0x%x\n",
(unsigned int)result ));
result &= 0xff;
@@ -643,13 +642,12 @@ uint32 dos_mode(connection_struct *conn, struct smb_filename *smb_fname)
/* Optimization : Only call is_hidden_path if it's not already
hidden. */
if (!(result & aHIDDEN) &&
- is_in_path(smb_fname->base_name, conn->hide_list,
- get_Protocol(conn->sconn),
+ is_in_path(smb_fname->base_name, conn->hide_list, get_Protocol(),
conn->case_sensitive)) {
result |= aHIDDEN;
}
- if (get_Protocol(conn->sconn) <= PROTOCOL_LANMAN2) {
+ if (get_Protocol() <= PROTOCOL_LANMAN2) {
DEBUG(10,("dos_mode : filtering result 0x%x\n",
(unsigned int)result ));
result &= 0xff;
diff --git a/source3/smbd/filename.c b/source3/smbd/filename.c
index dd237f1a80..719ab6a395 100644
--- a/source3/smbd/filename.c
+++ b/source3/smbd/filename.c
@@ -780,7 +780,7 @@ NTSTATUS unix_convert(TALLOC_CTX *ctx,
NTSTATUS check_name(connection_struct *conn, const char *name)
{
- if (is_in_path(name, conn->veto_list, get_Protocol(conn->sconn),
+ if (is_in_path(name, conn->veto_list, get_Protocol(),
conn->case_sensitive)) {
/* Is it not dot or dot dot. */
if (!((name[0] == '.') && (!name[1] ||
diff --git a/source3/smbd/globals.c b/source3/smbd/globals.c
index f631bebc06..68fa795ba2 100644
--- a/source3/smbd/globals.c
+++ b/source3/smbd/globals.c
@@ -155,13 +155,3 @@ void smbd_init_globals(void)
exit_server("failed to create smbd_server_connection");
}
}
-
-enum protocol_types get_Protocol(const struct smbd_server_connection *c)
-{
- return c->smb1.negprot.protocol;
-}
-
-void set_Protocol(struct smbd_server_connection *c, enum protocol_types p)
-{
- c->smb1.negprot.protocol = p;
-}
diff --git a/source3/smbd/globals.h b/source3/smbd/globals.h
index 1017ff1006..0db61f87a3 100644
--- a/source3/smbd/globals.h
+++ b/source3/smbd/globals.h
@@ -446,7 +446,6 @@ struct smbd_server_connection {
* Can be modified by the max xmit parameter.
*/
int max_recv;
- enum protocol_types protocol;
} negprot;
struct {
diff --git a/source3/smbd/negprot.c b/source3/smbd/negprot.c
index 8b1355ceac..81d29d90f9 100644
--- a/source3/smbd/negprot.c
+++ b/source3/smbd/negprot.c
@@ -60,7 +60,7 @@ static void reply_corep(struct smb_request *req, uint16 choice)
reply_outbuf(req, 1, 0);
SSVAL(req->outbuf, smb_vwv0, choice);
- set_Protocol(req->sconn, PROTOCOL_CORE);
+ set_Protocol(PROTOCOL_CORE);
}
/****************************************************************************
@@ -80,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 */
- set_Protocol(req->sconn, PROTOCOL_COREPLUS);
+ set_Protocol(PROTOCOL_COREPLUS);
}
/****************************************************************************
@@ -113,7 +113,7 @@ static void reply_lanman1(struct smb_request *req, uint16 choice)
SSVAL(req->outbuf,smb_vwv11, 8);
}
- set_Protocol(req->sconn, PROTOCOL_LANMAN1);
+ set_Protocol(PROTOCOL_LANMAN1);
/* Reply, SMBlockread, SMBwritelock supported. */
SCVAL(req->outbuf,smb_flg,FLAG_REPLY|FLAG_SUPPORT_LOCKREAD);
@@ -162,7 +162,7 @@ static void reply_lanman2(struct smb_request *req, uint16 choice)
SSVAL(req->outbuf,smb_vwv11, 8);
}
- set_Protocol(req->sconn, PROTOCOL_LANMAN2);
+ set_Protocol(PROTOCOL_LANMAN2);
/* Reply, SMBlockread, SMBwritelock supported. */
SCVAL(req->outbuf,smb_flg,FLAG_REPLY|FLAG_SUPPORT_LOCKREAD);
@@ -344,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);
- set_Protocol(req->sconn, PROTOCOL_NT1);
+ set_Protocol(PROTOCOL_NT1);
SSVAL(req->outbuf,smb_vwv1+1,lp_maxmux()); /* maxmpx */
SSVAL(req->outbuf,smb_vwv2+1,1); /* num vcs */
@@ -697,8 +697,7 @@ void reply_negprot(struct smb_request *req)
DEBUG( 5, ( "negprot index=%d\n", choice ) );
- if ((lp_server_signing() == Required)
- && (get_Protocol(req->sconn) < 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 3adc73ddf8..bacb9cb0b2 100644
--- a/source3/smbd/nttrans.c
+++ b/source3/smbd/nttrans.c
@@ -2539,7 +2539,7 @@ static void handle_nttrans(connection_struct *conn,
struct trans_state *state,
struct smb_request *req)
{
- if (get_Protocol(conn->sconn) >= 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/open.c b/source3/smbd/open.c
index f8e1927bd4..3ae6a8af29 100644
--- a/source3/smbd/open.c
+++ b/source3/smbd/open.c
@@ -611,7 +611,7 @@ static NTSTATUS open_file(files_struct *fsp,
fsp->is_directory = False;
if (conn->aio_write_behind_list &&
is_in_path(smb_fname->base_name, conn->aio_write_behind_list,
- get_Protocol(conn->sconn), conn->case_sensitive)) {
+ get_Protocol(), conn->case_sensitive)) {
fsp->aio_write_behind = True;
}
status = fsp_set_smb_fname(fsp, smb_fname);
@@ -1570,7 +1570,7 @@ static NTSTATUS open_file_ntcreate(connection_struct *conn,
/* ignore any oplock requests if oplocks are disabled */
if (!lp_oplocks(SNUM(conn)) || global_client_failed_oplock_break ||
is_in_path(smb_fname->base_name, conn->veto_oplock_list,
- get_Protocol(conn->sconn), conn->case_sensitive)) {
+ get_Protocol(), conn->case_sensitive)) {
/* Mask off everything except the private Samba bits. */
oplock_request &= SAMBA_PRIVATE_OPLOCK_MASK;
}
diff --git a/source3/smbd/process.c b/source3/smbd/process.c
index 730a03da1e..fbaa9dee29 100644
--- a/source3/smbd/process.c
+++ b/source3/smbd/process.c
@@ -379,7 +379,6 @@ void init_smb_request(struct smb_request *req,
req->unread_bytes = unread_bytes;
req->encrypted = encrypted;
req->conn = conn_find(sconn,req->tid);
- req->sconn = smbd_server_conn;
req->chain_fsp = NULL;
req->chain_outbuf = NULL;
req->done = false;
diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c
index 49d7497ff3..0b77d82edd 100644
--- a/source3/smbd/reply.c
+++ b/source3/smbd/reply.c
@@ -785,7 +785,7 @@ void reply_tcon_and_X(struct smb_request *req)
else
server_devicetype = "A:";
- if (get_Protocol(req->sconn) < 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) {
@@ -1139,7 +1139,7 @@ void reply_getatr(struct smb_request *req)
}
SIVAL(req->outbuf,smb_vwv3,(uint32)size);
- if (get_Protocol(req->sconn) >= PROTOCOL_NT1) {
+ if (get_Protocol() >= PROTOCOL_NT1) {
SSVAL(req->outbuf, smb_flg2,
SVAL(req->outbuf, smb_flg2) | FLAGS2_IS_LONG_NAME);
}
@@ -1264,7 +1264,7 @@ void reply_dskattr(struct smb_request *req)
reply_outbuf(req, 5, 0);
- if (get_Protocol(req->sconn) <= 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
@@ -2638,8 +2638,7 @@ NTSTATUS unlink_internals(connection_struct *conn, struct smb_request *req,
continue;
}
- if(!mask_match(dname, fname_mask,
- get_Protocol(conn->sconn),
+ if(!mask_match(dname, fname_mask, get_Protocol(),
conn->case_sensitive)) {
TALLOC_FREE(frame);
TALLOC_FREE(talloced);
@@ -2926,7 +2925,7 @@ static void send_file_readbraw(connection_struct *conn,
if ( !req_is_in_chain(req) && (nread > 0) && (fsp->base_fsp == NULL) &&
(fsp->wcp == NULL) &&
- lp_use_sendfile(SNUM(conn), get_Protocol(conn->sconn),
+ lp_use_sendfile(SNUM(conn), get_Protocol(),
smbd_server_conn->smb1.signing_state) ) {
ssize_t sendfile_read = -1;
char header[4];
@@ -3454,7 +3453,7 @@ static void send_file_readX(connection_struct *conn, struct smb_request *req,
if (!req_is_in_chain(req) &&
!is_encrypted_packet(req->inbuf) && (fsp->base_fsp == NULL) &&
(fsp->wcp == NULL) &&
- lp_use_sendfile(SNUM(conn), get_Protocol(conn->sconn),
+ lp_use_sendfile(SNUM(conn), get_Protocol(),
smbd_server_conn->smb1.signing_state) ) {
uint8 headerbuf[smb_size + 12 * 2];
DATA_BLOB header;
@@ -3776,7 +3775,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(get_Protocol(req->sconn) <= PROTOCOL_COREPLUS) {
+ if(get_Protocol() <= PROTOCOL_COREPLUS) {
numtowrite = SVAL(smb_buf(req->inbuf),-2);
data = smb_buf(req->inbuf);
} else {
@@ -3832,9 +3831,7 @@ void reply_writebraw(struct smb_request *req)
* it to send more bytes */
memcpy(buf, req->inbuf, smb_size);
- srv_set_message(
- buf, get_Protocol(req->sconn) > 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);
@@ -5450,8 +5447,7 @@ NTSTATUS rmdir_internals(TALLOC_CTX *ctx,
TALLOC_FREE(talloced);
continue;
}
- if(!is_in_path(dname, conn->veto_list,
- get_Protocol(conn->sconn),
+ if(!is_in_path(dname, conn->veto_list, get_Protocol(),
conn->case_sensitive)) {
TALLOC_FREE(dir_hnd);
TALLOC_FREE(talloced);
@@ -6344,8 +6340,7 @@ NTSTATUS rename_internals(TALLOC_CTX *ctx,
continue;
}
- if(!mask_match(dname, fname_src_mask,
- get_Protocol(conn->sconn),
+ if(!mask_match(dname, fname_src_mask, get_Protocol(),
conn->case_sensitive)) {
TALLOC_FREE(talloced);
continue;
@@ -6977,8 +6972,7 @@ void reply_copy(struct smb_request *req)
continue;
}
- if(!mask_match(dname, fname_src_mask,
- get_Protocol(conn->sconn),
+ if(!mask_match(dname, fname_src_mask, get_Protocol(),
conn->case_sensitive)) {
TALLOC_FREE(talloced);
continue;
diff --git a/source3/smbd/sesssetup.c b/source3/smbd/sesssetup.c
index afb682c101..addd386fb4 100644
--- a/source3/smbd/sesssetup.c
+++ b/source3/smbd/sesssetup.c
@@ -1430,7 +1430,7 @@ void reply_sesssetup_and_X(struct smb_request *req)
smb_bufsize = SVAL(req->vwv+2, 0);
- if (get_Protocol(req->sconn) < 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
@@ -1757,7 +1757,7 @@ void reply_sesssetup_and_X(struct smb_request *req)
/* it's ok - setup a reply */
reply_outbuf(req, 3, 0);
- if (get_Protocol(req->sconn) >= 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 4d2cdca624..5b97c65d79 100644
--- a/source3/smbd/smb2_negprot.c
+++ b/source3/smbd/smb2_negprot.c
@@ -112,7 +112,7 @@ NTSTATUS smbd_smb2_request_process_negprot(struct smbd_smb2_request *req)
return smbd_smb2_request_error(req, NT_STATUS_INVALID_PARAMETER);
}
- set_Protocol(req->sconn, 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 5618f0282d..8226b6c428 100644
--- a/source3/smbd/trans2.c
+++ b/source3/smbd/trans2.c
@@ -1368,8 +1368,7 @@ static bool smbd_dirptr_lanman2_match_fn(TALLOC_CTX *ctx,
fname, mask);
state->got_exact_match = got_match;
if (!got_match) {
- got_match = mask_match(fname, mask,
- get_Protocol(state->conn->sconn),
+ got_match = mask_match(fname, mask, get_Protocol(),
state->conn->case_sensitive);
}
@@ -1393,10 +1392,9 @@ static bool smbd_dirptr_lanman2_match_fn(TALLOC_CTX *ctx,
mangled_name, mask);
state->got_exact_match = got_match;
if (!got_match) {
- got_match = mask_match(
- mangled_name, mask,
- get_Protocol(state->conn->sconn),
- state->conn->case_sensitive);
+ got_match = mask_match(mangled_name, mask,
+ get_Protocol(),
+ state->conn->case_sensitive);
}
}
@@ -2467,7 +2465,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 (get_Protocol(sconn) < PROTOCOL_NT1) {
+ if (get_Protocol() < PROTOCOL_NT1) {
reply_doserror(req, ERRDOS, ERRnofiles);
goto out;
} else {
@@ -8149,7 +8147,7 @@ void reply_findnclose(struct smb_request *req)
static void handle_trans2(connection_struct *conn, struct smb_request *req,
struct trans_state *state)
{
- if (get_Protocol(req->sconn) >= PROTOCOL_NT1) {
+ if (get_Protocol() >= PROTOCOL_NT1) {
req->flags2 |= 0x40; /* IS_LONG_NAME */
SSVAL(req->inbuf,smb_flg2,req->flags2);
}