summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2008-11-02 01:07:46 +0100
committerVolker Lendecke <vl@samba.org>2008-11-02 09:22:40 +0100
commita31fab81568ed2b4314ea05740423aceb5d7c977 (patch)
tree8b4c061cc881025cdf8ccb5de9cdcad796c2b555
parent2bd5ac86ffc9f7610b0205092e4cc9cdccb4752f (diff)
downloadsamba-a31fab81568ed2b4314ea05740423aceb5d7c977.tar.gz
samba-a31fab81568ed2b4314ea05740423aceb5d7c977.tar.bz2
samba-a31fab81568ed2b4314ea05740423aceb5d7c977.zip
Simplify params of srvstr_pull_buf_talloc()
Now that "req" is available everywhere, use it. Rename srvstr_pull_buf_talloc() to srvstr_pull_req()
-rw-r--r--source3/include/srvstr.h5
-rw-r--r--source3/smbd/ipc.c4
-rw-r--r--source3/smbd/message.c22
-rw-r--r--source3/smbd/nttrans.c3
-rw-r--r--source3/smbd/pipes.c3
-rw-r--r--source3/smbd/reply.c16
-rw-r--r--source3/smbd/sesssetup.c33
7 files changed, 37 insertions, 49 deletions
diff --git a/source3/include/srvstr.h b/source3/include/srvstr.h
index 0e8e275655..d2de6805d3 100644
--- a/source3/include/srvstr.h
+++ b/source3/include/srvstr.h
@@ -25,5 +25,6 @@
end of the smbbuf area
*/
-#define srvstr_pull_buf_talloc(ctx, inbuf, smb_flags2, dest, src, flags) \
- pull_string_talloc(ctx, inbuf, smb_flags2, dest, src, smb_bufrem(inbuf, src), flags)
+#define srvstr_pull_req_talloc(ctx, req_, dest, src, flags) \
+ pull_string_talloc(ctx, req_->inbuf, req_->flags2, dest, src, \
+ smb_bufrem(req_->inbuf, src), flags)
diff --git a/source3/smbd/ipc.c b/source3/smbd/ipc.c
index d11c8c7cd5..1f6443f1d7 100644
--- a/source3/smbd/ipc.c
+++ b/source3/smbd/ipc.c
@@ -543,8 +543,8 @@ void reply_trans(struct smb_request *req)
state->close_on_completion = BITSETW(req->inbuf+smb_vwv5,0);
state->one_way = BITSETW(req->inbuf+smb_vwv5,1);
- srvstr_pull_buf_talloc(state, req->inbuf, req->flags2, &state->name,
- req->buf, STR_TERMINATE);
+ srvstr_pull_req_talloc(state, req, &state->name, req->buf,
+ STR_TERMINATE);
if ((dscnt > state->total_data) || (pscnt > state->total_param) ||
!state->name)
diff --git a/source3/smbd/message.c b/source3/smbd/message.c
index 6977b586df..347370e40c 100644
--- a/source3/smbd/message.c
+++ b/source3/smbd/message.c
@@ -154,12 +154,10 @@ void reply_sends(struct smb_request *req)
state = talloc(talloc_tos(), struct msg_state);
p = (const char *)req->buf + 1;
- p += srvstr_pull_buf_talloc(
- state, (char *)req->inbuf, req->flags2, &state->from, p,
- STR_ASCII|STR_TERMINATE) + 1;
- p += srvstr_pull_buf_talloc(
- state, (char *)req->inbuf, req->flags2, &state->to, p,
- STR_ASCII|STR_TERMINATE) + 1;
+ p += srvstr_pull_req_talloc(
+ state, req, &state->from, p, STR_ASCII|STR_TERMINATE) + 1;
+ p += srvstr_pull_req_talloc(
+ state, req, &state->to, p, STR_ASCII|STR_TERMINATE) + 1;
msg = p;
@@ -212,12 +210,12 @@ void reply_sendstrt(struct smb_request *req)
}
p = (const char *)req->buf+1;
- p += srvstr_pull_buf_talloc(
- smbd_msg_state, (char *)req->inbuf, req->flags2,
- &smbd_msg_state->from, p, STR_ASCII|STR_TERMINATE) + 1;
- p += srvstr_pull_buf_talloc(
- smbd_msg_state, (char *)req->inbuf, req->flags2,
- &smbd_msg_state->to, p, STR_ASCII|STR_TERMINATE) + 1;
+ p += srvstr_pull_req_talloc(
+ smbd_msg_state, req, &smbd_msg_state->from, p,
+ STR_ASCII|STR_TERMINATE) + 1;
+ p += srvstr_pull_req_talloc(
+ smbd_msg_state, req, &smbd_msg_state->to, p,
+ STR_ASCII|STR_TERMINATE) + 1;
DEBUG( 3, ( "SMBsendstrt (from %s to %s)\n", smbd_msg_state->from,
smbd_msg_state->to ) );
diff --git a/source3/smbd/nttrans.c b/source3/smbd/nttrans.c
index 3749abffe8..000055470e 100644
--- a/source3/smbd/nttrans.c
+++ b/source3/smbd/nttrans.c
@@ -307,8 +307,7 @@ static void do_ntcreate_pipe_open(connection_struct *conn,
uint32 flags = IVAL(req->inbuf,smb_ntcreate_Flags);
TALLOC_CTX *ctx = talloc_tos();
- srvstr_pull_buf_talloc(ctx, (char *)req->inbuf, req->flags2, &fname,
- req->buf, STR_TERMINATE);
+ srvstr_pull_req_talloc(ctx, req, &fname, req->buf, STR_TERMINATE);
if (!fname) {
reply_botherror(req, NT_STATUS_OBJECT_NAME_NOT_FOUND,
diff --git a/source3/smbd/pipes.c b/source3/smbd/pipes.c
index 2ce60c762e..0f4a0d7fec 100644
--- a/source3/smbd/pipes.c
+++ b/source3/smbd/pipes.c
@@ -48,8 +48,7 @@ void reply_open_pipe_and_X(connection_struct *conn, struct smb_request *req)
NTSTATUS status;
/* XXXX we need to handle passed times, sattr and flags */
- srvstr_pull_buf_talloc(ctx, req->inbuf, req->flags2, &pipe_name,
- req->buf, STR_TERMINATE);
+ srvstr_pull_req_talloc(ctx, req, &pipe_name, req->buf, STR_TERMINATE);
if (!pipe_name) {
reply_botherror(req, NT_STATUS_OBJECT_NAME_NOT_FOUND,
ERRDOS, ERRbadpipe);
diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c
index ba73f4eccb..f7165ff217 100644
--- a/source3/smbd/reply.c
+++ b/source3/smbd/reply.c
@@ -495,13 +495,12 @@ void reply_tcon(struct smb_request *req)
}
p = (const char *)req->buf + 1;
- p += srvstr_pull_buf_talloc(ctx, req->inbuf, req->flags2,
- &service_buf, p, STR_TERMINATE) + 1;
- pwlen = srvstr_pull_buf_talloc(ctx, req->inbuf, req->flags2,
- &password, p, STR_TERMINATE) + 1;
- p += pwlen;
- p += srvstr_pull_buf_talloc(ctx, req->inbuf, req->flags2,
- &dev, p, STR_TERMINATE) + 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);
+ p += pwlen+1;
+ p += srvstr_pull_req_talloc(ctx, req, &dev, p, STR_TERMINATE);
+ p += 1;
if (service_buf == NULL || password == NULL || dev == NULL) {
reply_nterror(req, NT_STATUS_INVALID_PARAMETER);
@@ -603,8 +602,7 @@ void reply_tcon_and_X(struct smb_request *req)
p = (const char *)req->buf + passlen + 1;
}
- p += srvstr_pull_buf_talloc(ctx, req->inbuf, req->flags2, &path, p,
- STR_TERMINATE);
+ p += srvstr_pull_req_talloc(ctx, req, &path, p, STR_TERMINATE);
if (path == NULL) {
data_blob_clear_free(&password);
diff --git a/source3/smbd/sesssetup.c b/source3/smbd/sesssetup.c
index 4123783eda..6981764e22 100644
--- a/source3/smbd/sesssetup.c
+++ b/source3/smbd/sesssetup.c
@@ -1175,7 +1175,6 @@ static void reply_sesssetup_and_X_spnego(struct smb_request *req)
user_struct *vuser = NULL;
NTSTATUS status = NT_STATUS_OK;
uint16 smbpid = req->smbpid;
- uint16 smb_flag2 = req->flags2;
DEBUG(3,("Doing spnego session setup\n"));
@@ -1206,16 +1205,16 @@ static void reply_sesssetup_and_X_spnego(struct smb_request *req)
p2 = (char *)req->inbuf + smb_vwv13 + data_blob_len;
- p2 += srvstr_pull_buf_talloc(talloc_tos(), req->inbuf, smb_flag2,
- &tmp, p2, STR_TERMINATE);
+ p2 += srvstr_pull_req_talloc(talloc_tos(), req, &tmp, p2,
+ STR_TERMINATE);
native_os = tmp ? tmp : "";
- p2 += srvstr_pull_buf_talloc(talloc_tos(), req->inbuf, smb_flag2,
- &tmp, p2, STR_TERMINATE);
+ p2 += srvstr_pull_req_talloc(talloc_tos(), req, &tmp, p2,
+ STR_TERMINATE);
native_lanman = tmp ? tmp : "";
- p2 += srvstr_pull_buf_talloc(talloc_tos(), req->inbuf, smb_flag2,
- &tmp, p2,STR_TERMINATE);
+ p2 += srvstr_pull_req_talloc(talloc_tos(), req, &tmp, p2,
+ STR_TERMINATE);
primary_domain = tmp ? tmp : "";
DEBUG(3,("NativeOS=[%s] NativeLanMan=[%s] PrimaryDomain=[%s]\n",
@@ -1472,9 +1471,8 @@ void reply_sesssetup_and_X(struct smb_request *req)
plaintext_password.data[passlen1] = 0;
}
- srvstr_pull_buf_talloc(talloc_tos(), req->inbuf, req->flags2,
- &tmp, req->buf + passlen1,
- STR_TERMINATE);
+ srvstr_pull_req_talloc(talloc_tos(), req, &tmp,
+ req->buf + passlen1, STR_TERMINATE);
user = tmp ? tmp : "";
domain = "";
@@ -1592,23 +1590,19 @@ void reply_sesssetup_and_X(struct smb_request *req)
p += passlen1 + passlen2;
- p += srvstr_pull_buf_talloc(talloc_tos(), req->inbuf,
- req->flags2, &tmp, p,
+ p += srvstr_pull_req_talloc(talloc_tos(), req, &tmp, p,
STR_TERMINATE);
user = tmp ? tmp : "";
- p += srvstr_pull_buf_talloc(talloc_tos(), req->inbuf,
- req->flags2, &tmp, p,
+ p += srvstr_pull_req_talloc(talloc_tos(), req, &tmp, p,
STR_TERMINATE);
domain = tmp ? tmp : "";
- p += srvstr_pull_buf_talloc(talloc_tos(), req->inbuf,
- req->flags2, &tmp, p,
+ p += srvstr_pull_req_talloc(talloc_tos(), req, &tmp, p,
STR_TERMINATE);
native_os = tmp ? tmp : "";
- p += srvstr_pull_buf_talloc(talloc_tos(), req->inbuf,
- req->flags2, &tmp, p,
+ p += srvstr_pull_req_talloc(talloc_tos(), req, &tmp, p,
STR_TERMINATE);
native_lanman = tmp ? tmp : "";
@@ -1621,8 +1615,7 @@ void reply_sesssetup_and_X(struct smb_request *req)
byte_count = SVAL(req->inbuf, smb_vwv13);
if ( PTR_DIFF(p, save_p) < byte_count) {
- p += srvstr_pull_buf_talloc(talloc_tos(), req->inbuf,
- req->flags2, &tmp, p,
+ p += srvstr_pull_req_talloc(talloc_tos(), req, &tmp, p,
STR_TERMINATE);
primary_domain = tmp ? tmp : "";
} else {