Jeremy.
/* 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);
#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;
bool bLoaded = False;
-extern enum protocol_types Protocol;
extern userdom_struct current_user_info;
#ifndef GLOBAL_NAME
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) {
#include "../libcli/auth/spnego.h"
extern fstring remote_proto;
-extern enum protocol_types Protocol;
static void get_challenge(uint8 buff[8])
{
reply_outbuf(req, 1, 0);
SSVAL(req->outbuf, smb_vwv0, choice);
- Protocol = 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 */
- Protocol = PROTOCOL_COREPLUS;
+ set_Protocol(PROTOCOL_COREPLUS);
}
/****************************************************************************
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);
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);
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 */
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");
}
#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)
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);
}
#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.
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) {
}
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);
}
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
/* 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 {
* 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);
#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;
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
/* 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?? */
}
#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
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);
#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,
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 {
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);
}