summaryrefslogtreecommitdiff
path: root/source3/smbd
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2009-06-05 11:05:03 +0200
committerStefan Metzmacher <metze@samba.org>2009-06-05 11:31:03 +0200
commit160ead46dc13e908903e70e372bdafc2ba8f4615 (patch)
treea90e9552450a9d6f768465acb17ec1bf8b111a2a /source3/smbd
parent96de8766fc80881c4398ea11ce65cccbb9b7c83b (diff)
downloadsamba-160ead46dc13e908903e70e372bdafc2ba8f4615.tar.gz
samba-160ead46dc13e908903e70e372bdafc2ba8f4615.tar.bz2
samba-160ead46dc13e908903e70e372bdafc2ba8f4615.zip
s3:smbd: implement smbd_smb2_request_error/done() as macros on top of the _ex() function
metze
Diffstat (limited to 'source3/smbd')
-rw-r--r--source3/smbd/globals.h16
-rw-r--r--source3/smbd/smb2_server.c31
-rw-r--r--source3/smbd/smb2_sesssetup.c3
3 files changed, 23 insertions, 27 deletions
diff --git a/source3/smbd/globals.h b/source3/smbd/globals.h
index 4c90e8f66b..2e5bc913d0 100644
--- a/source3/smbd/globals.h
+++ b/source3/smbd/globals.h
@@ -176,14 +176,18 @@ void reply_smb2002(struct smb_request *req, uint16_t choice);
void smbd_smb2_first_negprot(struct smbd_server_connection *conn,
const uint8_t *inbuf, size_t size);
-NTSTATUS smbd_smb2_request_error_(struct smbd_smb2_request *req,
- NTSTATUS status,
- const char *wherestr);
+NTSTATUS smbd_smb2_request_error_ex(struct smbd_smb2_request *req,
+ NTSTATUS status,
+ DATA_BLOB *info,
+ const char *location);
+#define smbd_smb2_request_error(req, status) \
+ smbd_smb2_request_error_ex(req, status, NULL, __location__)
NTSTATUS smbd_smb2_request_done_ex(struct smbd_smb2_request *req,
NTSTATUS status,
- DATA_BLOB body, DATA_BLOB *dyn);
-NTSTATUS smbd_smb2_request_done(struct smbd_smb2_request *req,
- DATA_BLOB body, DATA_BLOB *dyn);
+ DATA_BLOB body, DATA_BLOB *dyn,
+ const char *location);
+#define smbd_smb2_request_done(req, body, dyn) \
+ smbd_smb2_request_done_ex(req, NT_STATUS_OK, body, dyn, __location__)
NTSTATUS smbd_smb2_request_check_session(struct smbd_smb2_request *req);
NTSTATUS smbd_smb2_request_check_tcon(struct smbd_smb2_request *req);
diff --git a/source3/smbd/smb2_server.c b/source3/smbd/smb2_server.c
index 5c4bdca3e5..f4dc7c4f46 100644
--- a/source3/smbd/smb2_server.c
+++ b/source3/smbd/smb2_server.c
@@ -583,17 +583,18 @@ static void smbd_smb2_request_writev_done(struct tevent_req *subreq)
talloc_free(mem_pool);
}
-static NTSTATUS smbd_smb2_request_error_ex(struct smbd_smb2_request *req,
+NTSTATUS smbd_smb2_request_error_ex(struct smbd_smb2_request *req,
NTSTATUS status,
- const char *wherestr,
- DATA_BLOB *info)
+ DATA_BLOB *info,
+ const char *location)
{
uint8_t *outhdr;
uint8_t *outbody;
int i = req->current_idx;
- DEBUG(10,("smbd_smb2_request_error_ex: idx[%d] status[%s] at %s |%s|\n",
- i, nt_errstr(status), wherestr, info ? " +info" : ""));
+ DEBUG(10,("smbd_smb2_request_error_ex: idx[%d] status[%s] |%s| at %s\n",
+ i, nt_errstr(status), info ? " +info" : "",
+ location));
outhdr = (uint8_t *)req->out.vector[i].iov_base;
@@ -620,15 +621,10 @@ static NTSTATUS smbd_smb2_request_error_ex(struct smbd_smb2_request *req,
return smbd_smb2_request_reply(req);
}
-NTSTATUS smbd_smb2_request_error_(struct smbd_smb2_request *req,
- NTSTATUS status, const char *wherestr)
-{
- return smbd_smb2_request_error_ex(req, status, wherestr, NULL);
-}
-
NTSTATUS smbd_smb2_request_done_ex(struct smbd_smb2_request *req,
NTSTATUS status,
- DATA_BLOB body, DATA_BLOB *dyn)
+ DATA_BLOB body, DATA_BLOB *dyn,
+ const char *location)
{
uint8_t *outhdr;
uint8_t *outdyn;
@@ -636,10 +632,11 @@ NTSTATUS smbd_smb2_request_done_ex(struct smbd_smb2_request *req,
uint32_t next_command_ofs;
DEBUG(10,("smbd_smb2_request_done_ex: "
- "idx[%d] status[%s] body[%u] dyn[%s:%u]\n",
+ "idx[%d] status[%s] body[%u] dyn[%s:%u] at %s\n",
i, nt_errstr(status), (unsigned int)body.length,
dyn ? "yes": "no",
- (unsigned int)(dyn ? dyn->length : 0)));
+ (unsigned int)(dyn ? dyn->length : 0),
+ location));
if (body.length < 2) {
return smbd_smb2_request_error(req, NT_STATUS_INTERNAL_ERROR);
@@ -690,12 +687,6 @@ NTSTATUS smbd_smb2_request_done_ex(struct smbd_smb2_request *req,
return smbd_smb2_request_reply(req);
}
-NTSTATUS smbd_smb2_request_done(struct smbd_smb2_request *req,
- DATA_BLOB body, DATA_BLOB *dyn)
-{
- return smbd_smb2_request_done_ex(req, NT_STATUS_OK, body, dyn);
-}
-
struct smbd_smb2_request_read_state {
size_t missing;
bool asked_for_header;
diff --git a/source3/smbd/smb2_sesssetup.c b/source3/smbd/smb2_sesssetup.c
index faf7bd3db3..b56f8bd5f6 100644
--- a/source3/smbd/smb2_sesssetup.c
+++ b/source3/smbd/smb2_sesssetup.c
@@ -114,7 +114,8 @@ NTSTATUS smbd_smb2_request_process_sesssetup(struct smbd_smb2_request *req)
outdyn = out_security_buffer;
- return smbd_smb2_request_done_ex(req, status, outbody, &outdyn);
+ return smbd_smb2_request_done_ex(req, status, outbody, &outdyn,
+ __location__);
}
static int smbd_smb2_session_destructor(struct smbd_smb2_session *session)