1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-24 21:34:56 +03:00

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>
This commit is contained in:
Stefan Metzmacher 2014-02-26 20:16:26 +01:00 committed by Andrew Bartlett
parent 0cf9f9d913
commit 427db654ac
4 changed files with 21 additions and 20 deletions

View File

@ -145,8 +145,8 @@ void reply_sends(struct smb_request *req)
{
struct msg_state *state;
int len;
const char *msg;
const char *p;
const uint8_t *msg;
const uint8_t *p;
START_PROFILE(SMBsends);
@ -158,7 +158,7 @@ void reply_sends(struct smb_request *req)
state = talloc(talloc_tos(), struct msg_state);
p = (const char *)req->buf + 1;
p = req->buf + 1;
p += srvstr_pull_req_talloc(
state, req, &state->from, p, STR_ASCII|STR_TERMINATE) + 1;
p += srvstr_pull_req_talloc(
@ -194,7 +194,7 @@ void reply_sends(struct smb_request *req)
void reply_sendstrt(struct smb_request *req)
{
const char *p;
const uint8_t *p;
START_PROFILE(SMBsendstrt);
@ -214,7 +214,7 @@ void reply_sendstrt(struct smb_request *req)
return;
}
p = (const char *)req->buf+1;
p = req->buf+1;
p += srvstr_pull_req_talloc(
req->sconn->conn->msg_state, req,
&req->sconn->conn->msg_state->from, p,

View File

@ -836,7 +836,7 @@ 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 char *src, int flags);
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,

View File

@ -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);

View File

@ -127,7 +127,6 @@ static void reply_sesssetup_and_X_spnego(struct smb_request *req)
const char *native_os;
const char *native_lanman;
const char *primary_domain;
const char *p2;
uint16 data_blob_len = SVAL(req->vwv+7, 0);
enum remote_arch_types ra_type = get_remote_arch();
uint64_t vuid = req->vuid;
@ -165,17 +164,17 @@ static void reply_sesssetup_and_X_spnego(struct smb_request *req)
file_save("negotiate.dat", in_blob.data, in_blob.length);
#endif
p2 = (const char *)req->buf + in_blob.length;
p = req->buf + in_blob.length;
p2 += srvstr_pull_req_talloc(talloc_tos(), req, &tmp, p2,
p += srvstr_pull_req_talloc(talloc_tos(), req, &tmp, p,
STR_TERMINATE);
native_os = tmp ? tmp : "";
p2 += srvstr_pull_req_talloc(talloc_tos(), req, &tmp, p2,
p += srvstr_pull_req_talloc(talloc_tos(), req, &tmp, p,
STR_TERMINATE);
native_lanman = tmp ? tmp : "";
p2 += srvstr_pull_req_talloc(talloc_tos(), req, &tmp, p2,
p += srvstr_pull_req_talloc(talloc_tos(), req, &tmp, p,
STR_TERMINATE);
primary_domain = tmp ? tmp : "";