From: David Mulder Date: Thu, 17 Mar 2022 16:45:00 +0000 (-0600) Subject: smbd: Move srvstr_pull_req_talloc to smb2_reply.c X-Git-Tag: tevent-0.12.0~110 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a8e1f65cba40f6b15e103ce04002ade887bc3458;p=thirdparty%2Fsamba.git smbd: Move srvstr_pull_req_talloc to smb2_reply.c Signed-off-by: David Mulder Reviewed-by: Jeremy Allison --- diff --git a/source3/smbd/proto.h b/source3/smbd/proto.h index 978e98eb1ea..18b73856917 100644 --- a/source3/smbd/proto.h +++ b/source3/smbd/proto.h @@ -912,8 +912,6 @@ bool disk_quotas(connection_struct *conn, struct smb_filename *fname, /* The following definitions come from smbd/reply.c */ -size_t srvstr_pull_req_talloc(TALLOC_CTX *ctx, struct smb_request *req, - 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, @@ -1036,6 +1034,8 @@ size_t srvstr_get_path_posix(TALLOC_CTX *ctx, 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 uint8_t *src, int flags); /* The following definitions come from smbd/seal.c */ diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c index 2ec4149c2f8..77816e1883a 100644 --- a/source3/smbd/reply.c +++ b/source3/smbd/reply.c @@ -53,24 +53,6 @@ #include "source3/printing/rap_jobid.h" #include "source3/lib/substitute.h" -/** - * pull a string from the smb_buf part of a packet. In this case the - * string can either be null terminated or it can be terminated by the - * end of the smbbuf area - */ -size_t srvstr_pull_req_talloc(TALLOC_CTX *ctx, struct smb_request *req, - char **dest, const uint8_t *src, int flags) -{ - ssize_t bufrem = smbreq_bufrem(req, src); - - if (bufrem < 0) { - return 0; - } - - return pull_string_talloc(ctx, req->inbuf, req->flags2, dest, src, - bufrem, flags); -} - /**************************************************************************** Check if we have a correct fsp pointing to a file. Basic check for open fsp. ****************************************************************************/ diff --git a/source3/smbd/smb2_reply.c b/source3/smbd/smb2_reply.c index 4048284990e..7fa1fb1d265 100644 --- a/source3/smbd/smb2_reply.c +++ b/source3/smbd/smb2_reply.c @@ -372,3 +372,21 @@ size_t srvstr_get_path_req(TALLOC_CTX *mem_ctx, struct smb_request *req, err); } } + +/** + * pull a string from the smb_buf part of a packet. In this case the + * string can either be null terminated or it can be terminated by the + * end of the smbbuf area + */ +size_t srvstr_pull_req_talloc(TALLOC_CTX *ctx, struct smb_request *req, + char **dest, const uint8_t *src, int flags) +{ + ssize_t bufrem = smbreq_bufrem(req, src); + + if (bufrem < 0) { + return 0; + } + + return pull_string_talloc(ctx, req->inbuf, req->flags2, dest, src, + bufrem, flags); +}