mirror of
https://github.com/samba-team/samba.git
synced 2025-02-03 13:47:25 +03:00
- patch to fix a memory leak from metze
- fix a couple of unicode string errors for ascii clients found by RAW- tests (This used to be commit 81c941ba8ae33567d79b4bb0bb5928f5f6077b76)
This commit is contained in:
parent
dbe7b0c402
commit
039e9dc5e6
@ -486,22 +486,12 @@ char *get_socket_addr(TALLOC_CTX *mem_ctx, int fd)
|
||||
struct sockaddr sa;
|
||||
struct sockaddr_in *sockin = (struct sockaddr_in *) (&sa);
|
||||
int length = sizeof(sa);
|
||||
char *addr_buf;
|
||||
|
||||
addr_buf = talloc_strdup(mem_ctx, "0.0.0.0");
|
||||
|
||||
if (fd == -1) {
|
||||
return addr_buf;
|
||||
if (fd == -1 || getpeername(fd, &sa, &length) == -1) {
|
||||
return talloc_strdup(mem_ctx, "0.0.0.0");
|
||||
}
|
||||
|
||||
if (getpeername(fd, &sa, &length) < 0) {
|
||||
DEBUG(0,("getpeername failed. Error was %s\n", strerror(errno) ));
|
||||
return addr_buf;
|
||||
}
|
||||
|
||||
addr_buf = talloc_strdup(mem_ctx, (char *)inet_ntoa(sockin->sin_addr));
|
||||
|
||||
return addr_buf;
|
||||
return talloc_strdup(mem_ctx, (char *)inet_ntoa(sockin->sin_addr));
|
||||
}
|
||||
|
||||
|
||||
|
@ -738,7 +738,7 @@ void init_smbsession(struct event_context *ev, struct model_ops *model_ops, int
|
||||
/* set an initial client name based on its IP address. This will be replaced with
|
||||
the netbios name later if it gives us one */
|
||||
sub_set_remote_machine(strdup(get_socket_addr(smb->mem_ctx, fd)));
|
||||
smb->socket.client_addr = talloc_strdup(smb->mem_ctx, get_socket_addr(smb->mem_ctx, fd));
|
||||
smb->socket.client_addr = get_socket_addr(smb->mem_ctx, fd);
|
||||
|
||||
/* now initialise a few default values associated with this smb socket */
|
||||
smb->negotiate.max_send = 0xFFFF;
|
||||
|
@ -329,7 +329,7 @@ size_t req_push_str(struct request_context *req, char *dest, const char *str, in
|
||||
const int max_bytes_per_char = 3;
|
||||
|
||||
if (!(flags & (STR_ASCII|STR_UNICODE))) {
|
||||
flags |= (req->smb->negotiate.client_caps & CAP_UNICODE) ? STR_UNICODE : STR_ASCII;
|
||||
flags |= (req->flags2 & FLAGS2_UNICODE_STRINGS) ? STR_UNICODE : STR_ASCII;
|
||||
}
|
||||
|
||||
if (dest == NULL) {
|
||||
|
@ -136,7 +136,7 @@ static size_t trans2_push_data_string(struct request_context *req,
|
||||
}
|
||||
|
||||
if (!(flags & (STR_ASCII|STR_UNICODE))) {
|
||||
flags |= (req->smb->negotiate.client_caps & CAP_UNICODE) ? STR_UNICODE : STR_ASCII;
|
||||
flags |= (req->flags2 & FLAGS2_UNICODE_STRINGS) ? STR_UNICODE : STR_ASCII;
|
||||
}
|
||||
|
||||
if ((offset&1) && (flags & STR_UNICODE) && !(flags & STR_NOALIGN)) {
|
||||
@ -555,21 +555,21 @@ static NTSTATUS trans2_fileinfo_fill(struct request_context *req, struct smb_tra
|
||||
SSVAL(trans->out.data.data, 62, 0); /* padding */
|
||||
SIVAL(trans->out.data.data, 64, st->all_info.out.ea_size);
|
||||
trans2_append_data_string(req, trans, &st->all_info.out.fname,
|
||||
68, 0);
|
||||
68, STR_UNICODE);
|
||||
return NT_STATUS_OK;
|
||||
|
||||
case RAW_FILEINFO_NAME_INFO:
|
||||
case RAW_FILEINFO_NAME_INFORMATION:
|
||||
trans2_setup_reply(req, trans, 2, 4, 0);
|
||||
SSVAL(trans->out.params.data, 0, 0);
|
||||
trans2_append_data_string(req, trans, &st->name_info.out.fname, 0, 0);
|
||||
trans2_append_data_string(req, trans, &st->name_info.out.fname, 0, STR_UNICODE);
|
||||
return NT_STATUS_OK;
|
||||
|
||||
case RAW_FILEINFO_ALT_NAME_INFO:
|
||||
case RAW_FILEINFO_ALT_NAME_INFORMATION:
|
||||
trans2_setup_reply(req, trans, 2, 4, 0);
|
||||
SSVAL(trans->out.params.data, 0, 0);
|
||||
trans2_append_data_string(req, trans, &st->alt_name_info.out.fname, 0, 0);
|
||||
trans2_append_data_string(req, trans, &st->alt_name_info.out.fname, 0, STR_UNICODE);
|
||||
return NT_STATUS_OK;
|
||||
|
||||
case RAW_FILEINFO_STREAM_INFO:
|
||||
|
Loading…
x
Reference in New Issue
Block a user