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;
}
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;
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));
/* 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);
size_t unread_bytes;
bool encrypted;
connection_struct *conn;
- struct smbd_server_connection *sconn;
struct smb_perfcount_data pcd;
/*
#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;
/***********************************************************************
}
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;
}
/* 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;
/* 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;
/* 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;
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] ||
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;
-}
* Can be modified by the max xmit parameter.
*/
int max_recv;
- enum protocol_types protocol;
} negprot;
struct {
reply_outbuf(req, 1, 0);
SSVAL(req->outbuf, smb_vwv0, choice);
- set_Protocol(req->sconn, PROTOCOL_CORE);
+ set_Protocol(PROTOCOL_CORE);
}
/****************************************************************************
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);
}
/****************************************************************************
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);
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);
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 */
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");
}
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);
}
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);
/* 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;
}
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;
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) {
}
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);
}
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
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);
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];
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;
/* 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 {
* 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);
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);
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;
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;
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
/* 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?? */
}
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);
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);
}
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);
}
}
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 {
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);
}