[SCM] Samba Shared Repository - branch master updated -
7808a2594c22ff452d54d2e9e272aa60e4b7e482
Volker Lendecke
vlendec at samba.org
Sun Nov 2 22:19:29 GMT 2008
The branch, master has been updated
via 7808a2594c22ff452d54d2e9e272aa60e4b7e482 (commit)
via 792324bf5a2bb29144c5ef6525d7d84f4934c93d (commit)
via e7607b95f281af349df34c5ba0b12673e6ed6250 (commit)
from 17218df56714237d319673c17ddd2c75795d6285 (commit)
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 7808a2594c22ff452d54d2e9e272aa60e4b7e482
Author: Volker Lendecke <vl at samba.org>
Date: Sun Nov 2 22:33:20 2008 +0100
Remove some inbuf references by adding "cmd" to smb_request
commit 792324bf5a2bb29144c5ef6525d7d84f4934c93d
Author: Volker Lendecke <vl at samba.org>
Date: Sun Nov 2 22:20:48 2008 +0100
Remove the inbuf reference from map_checkpath_error()
commit e7607b95f281af349df34c5ba0b12673e6ed6250
Author: Volker Lendecke <vl at samba.org>
Date: Sun Nov 2 22:09:51 2008 +0100
Remove a direct inbuf reference in reply_negprot
-----------------------------------------------------------------------
Summary of changes:
source3/include/smb.h | 1 +
source3/smbd/blocking.c | 2 +-
source3/smbd/negprot.c | 10 ++++++++--
source3/smbd/process.c | 7 +++----
source3/smbd/reply.c | 22 ++++++++++------------
source3/smbd/trans2.c | 6 +++---
6 files changed, 26 insertions(+), 22 deletions(-)
Changeset truncated at 500 lines:
diff --git a/source3/include/smb.h b/source3/include/smb.h
index 3de782e..bcf605e 100644
--- a/source3/include/smb.h
+++ b/source3/include/smb.h
@@ -625,6 +625,7 @@ struct current_user {
};
struct smb_request {
+ uint8_t cmd;
uint16 flags2;
uint16 smbpid;
uint16 mid;
diff --git a/source3/smbd/blocking.c b/source3/smbd/blocking.c
index 14ce237..a232249 100644
--- a/source3/smbd/blocking.c
+++ b/source3/smbd/blocking.c
@@ -190,7 +190,7 @@ bool push_blocking_lock_request( struct byte_range_lock *br_lck,
return False;
}
- blr->com_type = CVAL(req->inbuf,smb_com);
+ blr->com_type = req->cmd;
blr->fsp = fsp;
if (lock_timeout == -1) {
blr->expire_time.tv_sec = 0;
diff --git a/source3/smbd/negprot.c b/source3/smbd/negprot.c
index fe168aa..43fdc1d 100644
--- a/source3/smbd/negprot.c
+++ b/source3/smbd/negprot.c
@@ -507,7 +507,6 @@ static const struct {
void reply_negprot(struct smb_request *req)
{
- size_t size = smb_len(req->inbuf) + 4;
int choice= -1;
int protocol;
const char *p;
@@ -527,7 +526,14 @@ void reply_negprot(struct smb_request *req)
}
done_negprot = True;
- if (req->inbuf[size-1] != '\0') {
+ if (req->buflen == 0) {
+ DEBUG(0, ("negprot got no protocols\n"));
+ reply_nterror(req, NT_STATUS_INVALID_PARAMETER);
+ END_PROFILE(SMBnegprot);
+ return;
+ }
+
+ if (req->buf[req->buflen-1] != '\0') {
DEBUG(0, ("negprot protocols not 0-terminated\n"));
reply_nterror(req, NT_STATUS_INVALID_PARAMETER);
END_PROFILE(SMBnegprot);
diff --git a/source3/smbd/process.c b/source3/smbd/process.c
index e32eea9..215ae20 100644
--- a/source3/smbd/process.c
+++ b/source3/smbd/process.c
@@ -369,6 +369,7 @@ void init_smb_request(struct smb_request *req,
(unsigned int)req_size ));
exit_server_cleanly("Invalid SMB request");
}
+ req->cmd = CVAL(inbuf, smb_com);
req->flags2 = SVAL(inbuf, smb_flg2);
req->smbpid = SVAL(inbuf, smb_pid);
req->mid = SVAL(inbuf, smb_mid);
@@ -1451,8 +1452,7 @@ static connection_struct *switch_message(uint8 type, struct smb_request *req, in
/* encrypted required from now on. */
conn->encrypt_level = Required;
} else if (ENCRYPTION_REQUIRED(conn)) {
- uint8 com = CVAL(req->inbuf,smb_com);
- if (com != SMBtrans2 && com != SMBtranss2) {
+ if (req->cmd != SMBtrans2 && req->cmd != SMBtranss2) {
exit_server_cleanly("encryption required "
"on connection");
return conn;
@@ -1487,7 +1487,6 @@ static connection_struct *switch_message(uint8 type, struct smb_request *req, in
static void construct_reply(char *inbuf, int size, size_t unread_bytes, bool encrypted)
{
- uint8 type = CVAL(inbuf,smb_com);
connection_struct *conn;
struct smb_request *req;
@@ -1498,7 +1497,7 @@ static void construct_reply(char *inbuf, int size, size_t unread_bytes, bool enc
}
init_smb_request(req, (uint8 *)inbuf, unread_bytes, encrypted);
- conn = switch_message(type, req, size);
+ conn = switch_message(req->cmd, req, size);
if (req->unread_bytes) {
/* writeX failed. drain socket. */
diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c
index 2aa3c1b..7b5ed8f 100644
--- a/source3/smbd/reply.c
+++ b/source3/smbd/reply.c
@@ -821,10 +821,10 @@ void reply_ioctl(struct smb_request *req)
Strange checkpath NTSTATUS mapping.
****************************************************************************/
-static NTSTATUS map_checkpath_error(const char *inbuf, NTSTATUS status)
+static NTSTATUS map_checkpath_error(uint16_t flags2, NTSTATUS status)
{
/* Strange DOS error code semantics only for checkpath... */
- if (!(SVAL(inbuf,smb_flg2) & FLAGS2_32_BIT_ERROR_CODES)) {
+ if (!(flags2 & FLAGS2_32_BIT_ERROR_CODES)) {
if (NT_STATUS_EQUAL(NT_STATUS_OBJECT_NAME_INVALID,status)) {
/* We need to map to ERRbadpath */
return NT_STATUS_OBJECT_PATH_NOT_FOUND;
@@ -851,7 +851,7 @@ void reply_checkpath(struct smb_request *req)
STR_TERMINATE, &status);
if (!NT_STATUS_IS_OK(status)) {
- status = map_checkpath_error((char *)req->inbuf, status);
+ status = map_checkpath_error(req->flags2, status);
reply_nterror(req, status);
END_PROFILE(SMBcheckpath);
return;
@@ -911,7 +911,7 @@ void reply_checkpath(struct smb_request *req)
one at a time - if a component fails it expects
ERRbadpath, not ERRbadfile.
*/
- status = map_checkpath_error((char *)req->inbuf, status);
+ status = map_checkpath_error(req->flags2, status);
if (NT_STATUS_EQUAL(status, NT_STATUS_OBJECT_NAME_NOT_FOUND)) {
/*
* Windows returns different error codes if
@@ -1227,13 +1227,13 @@ void reply_search(struct smb_request *req)
}
if (lp_posix_pathnames()) {
- reply_unknown_new(req, CVAL(req->inbuf, smb_com));
+ reply_unknown_new(req, req->cmd);
END_PROFILE(SMBsearch);
return;
}
/* If we were called as SMBffirst then we must expect close. */
- if(CVAL(req->inbuf,smb_com) == SMBffirst) {
+ if(req->cmd == SMBffirst) {
expect_close = True;
}
@@ -1443,7 +1443,7 @@ void reply_search(struct smb_request *req)
}
/* If we were called as SMBfunique, then we can close the dirptr now ! */
- if(dptr_num >= 0 && CVAL(req->inbuf,smb_com) == SMBfunique) {
+ if(dptr_num >= 0 && req->cmd == SMBfunique) {
dptr_close(&dptr_num);
}
@@ -1476,7 +1476,7 @@ void reply_search(struct smb_request *req)
}
DEBUG(4,("%s mask=%s path=%s dtype=%d nument=%u of %u\n",
- smb_fn_name(CVAL(req->inbuf,smb_com)),
+ smb_fn_name(req->cmd),
mask,
directory ? directory : "./",
dirtype,
@@ -1505,7 +1505,7 @@ void reply_fclose(struct smb_request *req)
START_PROFILE(SMBfclose);
if (lp_posix_pathnames()) {
- reply_unknown_new(req, CVAL(req->inbuf, smb_com));
+ reply_unknown_new(req, req->cmd);
END_PROFILE(SMBfclose);
return;
}
@@ -1891,7 +1891,6 @@ void reply_mknew(struct smb_request *req)
{
connection_struct *conn = req->conn;
char *fname = NULL;
- int com;
uint32 fattr = 0;
struct timespec ts[2];
files_struct *fsp;
@@ -1914,7 +1913,6 @@ void reply_mknew(struct smb_request *req)
fattr = SVAL(req->vwv+0, 0);
oplock_request = CORE_OPLOCK_REQUEST(req->inbuf);
- com = SVAL(req->inbuf,smb_com);
ts[1] = convert_time_t_to_timespec(srv_make_unix_date3(req->vwv+1));
/* mtime. */
@@ -1932,7 +1930,7 @@ void reply_mknew(struct smb_request *req)
"please report this\n", fname));
}
- if(com == SMBmknew) {
+ if(req->cmd == SMBmknew) {
/* We should fail if file exists. */
create_disposition = FILE_CREATE;
} else {
diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c
index df8b272..9e15001 100644
--- a/source3/smbd/trans2.c
+++ b/source3/smbd/trans2.c
@@ -2183,7 +2183,7 @@ total_data=%u (should be %u)\n", (unsigned int)total_data, (unsigned int)IVAL(pd
}
DEBUG( 4, ( "%s mask=%s directory=%s dirtype=%d numentries=%d\n",
- smb_fn_name(CVAL(req->inbuf,smb_com)),
+ smb_fn_name(req->cmd),
mask, directory, dirtype, numentries ) );
/*
@@ -2481,7 +2481,7 @@ total_data=%u (should be %u)\n", (unsigned int)total_data, (unsigned int)IVAL(pd
}
DEBUG( 3, ( "%s mask=%s directory=%s dirtype=%d numentries=%d\n",
- smb_fn_name(CVAL(req->inbuf,smb_com)),
+ smb_fn_name(req->cmd),
mask, directory, dirtype, numentries ) );
/* Check if we can close the dirptr */
@@ -3118,7 +3118,7 @@ cBytesSector=%u, cUnitTotal=%u, cUnitAvail=%d\n", (unsigned int)bsize, (unsigned
max_data_bytes);
DEBUG( 4, ( "%s info_level = %d\n",
- smb_fn_name(CVAL(req->inbuf,smb_com)), info_level) );
+ smb_fn_name(req->cmd), info_level) );
return;
}
--
Samba Shared Repository
More information about the samba-cvs
mailing list