summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2011-07-06 18:36:29 +0200
committerStefan Metzmacher <metze@samba.org>2011-07-07 19:16:28 +0200
commitcea924590916c3c69245af56a2bb18743d299cbb (patch)
tree8fd51eb77aa18046dfb6b5d0d8b2d11ba1c42215 /source3
parent2453164317e350fd398858a84b6ef5e030faab1b (diff)
downloadsamba-cea924590916c3c69245af56a2bb18743d299cbb.tar.gz
samba-cea924590916c3c69245af56a2bb18743d299cbb.tar.bz2
samba-cea924590916c3c69245af56a2bb18743d299cbb.zip
s3:libsmb: use trans2_bytes_push_str() in cli_dfs_get_referral()
metze
Diffstat (limited to 'source3')
-rw-r--r--source3/libsmb/clidfs.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/source3/libsmb/clidfs.c b/source3/libsmb/clidfs.c
index 5d97cd3011..a0d503a802 100644
--- a/source3/libsmb/clidfs.c
+++ b/source3/libsmb/clidfs.c
@@ -614,7 +614,6 @@ NTSTATUS cli_dfs_get_referral(TALLOC_CTX *ctx,
uint8_t *rdata = NULL;
char *p;
char *endp;
- size_t pathlen = 2*(strlen(path)+1);
smb_ucs2_t *path_ucs;
char *consumed_path = NULL;
uint16_t consumed_ucs;
@@ -628,17 +627,22 @@ NTSTATUS cli_dfs_get_referral(TALLOC_CTX *ctx,
SSVAL(setup, 0, TRANSACT2_GET_DFS_REFERRAL);
- param = talloc_array(talloc_tos(), uint8_t, 2+pathlen+2);
+ param = talloc_array(talloc_tos(), uint8_t, 2);
if (!param) {
status = NT_STATUS_NO_MEMORY;
goto out;
}
SSVAL(param, 0, 0x03); /* max referral level */
- p = (char *)(&param[2]);
- path_ucs = (smb_ucs2_t *)p;
- p += clistr_push(cli, p, path, pathlen, STR_TERMINATE);
- param_len = PTR_DIFF(p, param);
+ param = trans2_bytes_push_str(param, cli_ucs2(cli),
+ path, strlen(path)+1,
+ NULL);
+ if (!param) {
+ status = NT_STATUS_NO_MEMORY;
+ goto out;
+ }
+ param_len = talloc_get_size(param);
+ path_ucs = (smb_ucs2_t *)&param[2];
status = cli_trans(talloc_tos(), cli, SMBtrans2,
NULL, 0xffff, 0, 0,