summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2011-07-07 10:16:38 +0200
committerStefan Metzmacher <metze@samba.org>2011-07-07 19:16:28 +0200
commit5b1ac1bcc3d0bd0af4d5b745e0e2e834aae34e54 (patch)
tree28576f424970a154ef81afafcc2ed61b7cd13a3c /source3
parentcea924590916c3c69245af56a2bb18743d299cbb (diff)
downloadsamba-5b1ac1bcc3d0bd0af4d5b745e0e2e834aae34e54.tar.gz
samba-5b1ac1bcc3d0bd0af4d5b745e0e2e834aae34e54.tar.bz2
samba-5b1ac1bcc3d0bd0af4d5b745e0e2e834aae34e54.zip
s3:libsmb: use trans2_bytes_push_str() in cli_set_ea_path()
metze
Diffstat (limited to 'source3')
-rw-r--r--source3/libsmb/clifile.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/source3/libsmb/clifile.c b/source3/libsmb/clifile.c
index 3fa124e6f1..24a099b4ca 100644
--- a/source3/libsmb/clifile.c
+++ b/source3/libsmb/clifile.c
@@ -4101,24 +4101,25 @@ NTSTATUS cli_set_ea_path(struct cli_state *cli, const char *path,
{
unsigned int param_len = 0;
uint8_t *param;
- size_t srclen = 2*(strlen(path)+1);
- char *p;
NTSTATUS status;
+ TALLOC_CTX *frame = talloc_stackframe();
- param = SMB_MALLOC_ARRAY(uint8_t, 6+srclen+2);
+ param = talloc_array(talloc_tos(), uint8_t, 6);
if (!param) {
return NT_STATUS_NO_MEMORY;
}
- memset(param, '\0', 6);
SSVAL(param,0,SMB_INFO_SET_EA);
- p = (char *)(&param[6]);
+ SSVAL(param,2,0);
+ SSVAL(param,4,0);
- p += clistr_push(cli, p, path, srclen, STR_TERMINATE);
- param_len = PTR_DIFF(p, param);
+ param = trans2_bytes_push_str(param, cli_ucs2(cli),
+ path, strlen(path)+1,
+ NULL);
+ param_len = talloc_get_size(param);
status = cli_set_ea(cli, TRANSACT2_SETPATHINFO, param, param_len,
ea_name, ea_val, ea_len);
- SAFE_FREE(param);
+ SAFE_FREE(frame);
return status;
}