summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2014-02-26 20:16:26 +0100
committerAndrew Bartlett <abartlet@samba.org>2014-04-02 09:03:43 +0200
commit427db654acec8e66e4c272b4e515c584ccb368c7 (patch)
tree640bb6178c14ee6d452c86415a7ddcb419b1a1fb
parent0cf9f9d9139b1f1ceac1a8d37ca450da82f09c8c (diff)
downloadsamba-427db654acec8e66e4c272b4e515c584ccb368c7.tar.gz
samba-427db654acec8e66e4c272b4e515c584ccb368c7.tar.xz
samba-427db654acec8e66e4c272b4e515c584ccb368c7.zip
s3:smbd: let srvstr_pull_req_talloc() take 'const uint8_t *src'
This is the correct thing to do the smb request buffer contains just bytes (uint8_t). It also avoids strange casting in the callers. Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
-rw-r--r--source3/smbd/message.c10
-rw-r--r--source3/smbd/proto.h2
-rw-r--r--source3/smbd/reply.c20
-rw-r--r--source3/smbd/sesssetup.c9
4 files changed, 21 insertions, 20 deletions
diff --git a/source3/smbd/message.c b/source3/smbd/message.c
index 3d91f1408db..0dca2d89c22 100644
--- a/source3/smbd/message.c
+++ b/source3/smbd/message.c
@@ -145,8 +145,8 @@ void reply_sends(struct smb_request *req)
{
struct msg_state *state;
int len;
- const char *msg;
- const char *p;
+ const uint8_t *msg;
+ const uint8_t *p;
START_PROFILE(SMBsends);
@@ -158,7 +158,7 @@ void reply_sends(struct smb_request *req)
state = talloc(talloc_tos(), struct msg_state);
- p = (const char *)req->buf + 1;
+ p = req->buf + 1;
p += srvstr_pull_req_talloc(
state, req, &state->from, p, STR_ASCII|STR_TERMINATE) + 1;
p += srvstr_pull_req_talloc(
@@ -194,7 +194,7 @@ void reply_sends(struct smb_request *req)
void reply_sendstrt(struct smb_request *req)
{
- const char *p;
+ const uint8_t *p;
START_PROFILE(SMBsendstrt);
@@ -214,7 +214,7 @@ void reply_sendstrt(struct smb_request *req)
return;
}
- p = (const char *)req->buf+1;
+ p = req->buf+1;
p += srvstr_pull_req_talloc(
req->sconn->conn->msg_state, req,
&req->sconn->conn->msg_state->from, p,
diff --git a/source3/smbd/proto.h b/source3/smbd/proto.h
index 36012e60d6a..62c9728a4e8 100644
--- a/source3/smbd/proto.h
+++ b/source3/smbd/proto.h
@@ -836,7 +836,7 @@ size_t srvstr_get_path_req(TALLOC_CTX *mem_ctx, struct smb_request *req,
char **pp_dest, const char *src, int flags,
NTSTATUS *err);
size_t srvstr_pull_req_talloc(TALLOC_CTX *ctx, struct smb_request *req,
- char **dest, const char *src, int flags);
+ char **dest, const uint8_t *src, int flags);
bool check_fsp_open(connection_struct *conn, struct smb_request *req,
files_struct *fsp);
bool check_fsp(connection_struct *conn, struct smb_request *req,
diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c
index 9603975761e..e58735ed93e 100644
--- a/source3/smbd/reply.c
+++ b/source3/smbd/reply.c
@@ -345,7 +345,7 @@ size_t srvstr_get_path_req(TALLOC_CTX *mem_ctx, struct smb_request *req,
* end of the smbbuf area
*/
size_t srvstr_pull_req_talloc(TALLOC_CTX *ctx, struct smb_request *req,
- char **dest, const char *src, int flags)
+ char **dest, const uint8_t *src, int flags)
{
ssize_t bufrem = smbreq_bufrem(req, src);
@@ -688,7 +688,8 @@ void reply_tcon(struct smb_request *req)
char *dev = NULL;
int pwlen=0;
NTSTATUS nt_status;
- const char *p;
+ const uint8_t *p;
+ const char *p2;
TALLOC_CTX *ctx = talloc_tos();
struct smbd_server_connection *sconn = req->sconn;
NTTIME now = timeval_to_nttime(&req->request_time);
@@ -701,7 +702,7 @@ void reply_tcon(struct smb_request *req)
return;
}
- p = (const char *)req->buf + 1;
+ p = req->buf + 1;
p += srvstr_pull_req_talloc(ctx, req, &service_buf, p, STR_TERMINATE);
p += 1;
pwlen = srvstr_pull_req_talloc(ctx, req, &password, p, STR_TERMINATE);
@@ -714,9 +715,9 @@ void reply_tcon(struct smb_request *req)
END_PROFILE(SMBtcon);
return;
}
- p = strrchr_m(service_buf,'\\');
- if (p) {
- service = p+1;
+ p2 = strrchr_m(service_buf,'\\');
+ if (p2) {
+ service = p2+1;
} else {
service = service_buf;
}
@@ -760,7 +761,8 @@ void reply_tcon_and_X(struct smb_request *req)
NTSTATUS nt_status;
int passlen;
char *path = NULL;
- const char *p, *q;
+ const uint8_t *p;
+ const char *q;
uint16_t tcon_flags;
struct smbXsrv_session *session = NULL;
NTTIME now = timeval_to_nttime(&req->request_time);
@@ -815,9 +817,9 @@ void reply_tcon_and_X(struct smb_request *req)
}
if (sconn->smb1.negprot.encrypted_passwords) {
- p = (const char *)req->buf + passlen;
+ p = req->buf + passlen;
} else {
- p = (const char *)req->buf + passlen + 1;
+ p = req->buf + passlen + 1;
}
p += srvstr_pull_req_talloc(ctx, req, &path, p, STR_TERMINATE);
diff --git a/source3/smbd/sesssetup.c b/source3/smbd/sesssetup.c
index cf5c9f0d0e3..f719ec52335 100644
--- a/source3/smbd/sesssetup.c
+++ b/source3/smbd/sesssetup.c
@@ -127,7 +127,6 @@ static void reply_sesssetup_and_X_spnego(struct smb_request *req)
const char *native_os;
const char *native_lanman;
const char *primary_domain;
- const char *p2;
uint16 data_blob_len = SVAL(req->vwv+7, 0);
enum remote_arch_types ra_type = get_remote_arch();
uint64_t vuid = req->vuid;
@@ -165,17 +164,17 @@ static void reply_sesssetup_and_X_spnego(struct smb_request *req)
file_save("negotiate.dat", in_blob.data, in_blob.length);
#endif
- p2 = (const char *)req->buf + in_blob.length;
+ p = req->buf + in_blob.length;
- p2 += srvstr_pull_req_talloc(talloc_tos(), req, &tmp, p2,
+ p += srvstr_pull_req_talloc(talloc_tos(), req, &tmp, p,
STR_TERMINATE);
native_os = tmp ? tmp : "";
- p2 += srvstr_pull_req_talloc(talloc_tos(), req, &tmp, p2,
+ p += srvstr_pull_req_talloc(talloc_tos(), req, &tmp, p,
STR_TERMINATE);
native_lanman = tmp ? tmp : "";
- p2 += srvstr_pull_req_talloc(talloc_tos(), req, &tmp, p2,
+ p += srvstr_pull_req_talloc(talloc_tos(), req, &tmp, p,
STR_TERMINATE);
primary_domain = tmp ? tmp : "";