summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2008-12-19 18:07:44 +0100
committerVolker Lendecke <vl@samba.org>2008-12-19 18:08:47 +0100
commitae0c6cff25c2be64fb5d19e738e449f845551d8c (patch)
treeeeecaea82f08f7e08127ed52bd3435516481f521
parent13eefa7c435cb5ac656f662c78260a82caf43180 (diff)
downloadsamba-ae0c6cff25c2be64fb5d19e738e449f845551d8c.tar.gz
samba-ae0c6cff25c2be64fb5d19e738e449f845551d8c.tar.bz2
samba-ae0c6cff25c2be64fb5d19e738e449f845551d8c.zip
Remove the direct inbuf reference from construct_reply_common()
-rw-r--r--source3/include/proto.h2
-rw-r--r--source3/smbd/process.c19
2 files changed, 11 insertions, 10 deletions
diff --git a/source3/include/proto.h b/source3/include/proto.h
index 212bbf0df7..25161fef97 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -7489,8 +7489,6 @@ struct idle_event *event_add_idle(struct event_context *event_ctx,
void *private_data);
NTSTATUS allow_new_trans(struct trans_state *list, int mid);
void respond_to_all_remaining_local_messages(void);
-bool create_outbuf(TALLOC_CTX *mem_ctx, const char *inbuf, char **outbuf,
- uint8_t num_words, uint32_t num_bytes);
void reply_outbuf(struct smb_request *req, uint8 num_words, uint32 num_bytes);
const char *smb_fn_name(int type);
void add_to_common_flags2(uint32 v);
diff --git a/source3/smbd/process.c b/source3/smbd/process.c
index b3cd2f26c8..e4d15d87d6 100644
--- a/source3/smbd/process.c
+++ b/source3/smbd/process.c
@@ -37,7 +37,8 @@ SIG_ATOMIC_T got_sig_term = 0;
extern bool global_machine_password_needs_changing;
extern int max_send;
-static void construct_reply_common(const char *inbuf, char *outbuf);
+static void construct_reply_common(struct smb_request *req, const char *inbuf,
+ char *outbuf);
/* Accessor function for smb_read_error for smbd functions. */
@@ -1248,8 +1249,9 @@ static const struct smb_message_struct {
allocate and initialize a reply packet
********************************************************************/
-bool create_outbuf(TALLOC_CTX *mem_ctx, const char *inbuf, char **outbuf,
- uint8_t num_words, uint32_t num_bytes)
+static bool create_outbuf(TALLOC_CTX *mem_ctx, struct smb_request *req,
+ const char *inbuf, char **outbuf, uint8_t num_words,
+ uint32_t num_bytes)
{
/*
* Protect against integer wrap
@@ -1270,7 +1272,7 @@ bool create_outbuf(TALLOC_CTX *mem_ctx, const char *inbuf, char **outbuf,
return false;
}
- construct_reply_common(inbuf, *outbuf);
+ construct_reply_common(req, inbuf, *outbuf);
srv_set_message(*outbuf, num_words, num_bytes, false);
/*
* Zero out the word area, the caller has to take care of the bcc area
@@ -1286,7 +1288,7 @@ bool create_outbuf(TALLOC_CTX *mem_ctx, const char *inbuf, char **outbuf,
void reply_outbuf(struct smb_request *req, uint8 num_words, uint32 num_bytes)
{
char *outbuf;
- if (!create_outbuf(req, (char *)req->inbuf, &outbuf, num_words,
+ if (!create_outbuf(req, req, (char *)req->inbuf, &outbuf, num_words,
num_bytes)) {
smb_panic("could not allocate output buffer\n");
}
@@ -1592,11 +1594,12 @@ void remove_from_common_flags2(uint32 v)
common_flags2 &= ~v;
}
-static void construct_reply_common(const char *inbuf, char *outbuf)
+static void construct_reply_common(struct smb_request *req, const char *inbuf,
+ char *outbuf)
{
srv_set_message(outbuf,0,0,false);
- SCVAL(outbuf,smb_com,CVAL(inbuf,smb_com));
+ SCVAL(outbuf, smb_com, req->cmd);
SIVAL(outbuf,smb_rcls,0);
SCVAL(outbuf,smb_flg, FLAG_REPLY | (CVAL(inbuf,smb_flg) & FLAG_CASELESS_PATHNAMES));
SSVAL(outbuf,smb_flg2,
@@ -1612,7 +1615,7 @@ static void construct_reply_common(const char *inbuf, char *outbuf)
void construct_reply_common_req(struct smb_request *req, char *outbuf)
{
- construct_reply_common((char *)req->inbuf, outbuf);
+ construct_reply_common(req, (char *)req->inbuf, outbuf);
}
/****************************************************************************