diff options
author | Stefan Metzmacher <metze@samba.org> | 2014-02-26 20:16:26 +0100 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2014-04-02 09:03:43 +0200 |
commit | 427db654acec8e66e4c272b4e515c584ccb368c7 (patch) | |
tree | 640bb6178c14ee6d452c86415a7ddcb419b1a1fb /source3/smbd/reply.c | |
parent | 0cf9f9d9139b1f1ceac1a8d37ca450da82f09c8c (diff) | |
download | samba-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>
Diffstat (limited to 'source3/smbd/reply.c')
-rw-r--r-- | source3/smbd/reply.c | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c index 9603975761..e58735ed93 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); |