summaryrefslogtreecommitdiff
path: root/source3/client
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2010-08-16 16:31:33 -0700
committerJeremy Allison <jra@samba.org>2010-08-18 15:51:43 -0700
commit34230608dfa7e9f4aa0c633e7a92df37ca94d28f (patch)
treef842f637492c8d3cd4fa8561d29fa0a85d0bf3b1 /source3/client
parent8f7bf85c40068523b607b01a141d24e27b9f4be1 (diff)
downloadsamba-34230608dfa7e9f4aa0c633e7a92df37ca94d28f.tar.gz
samba-34230608dfa7e9f4aa0c633e7a92df37ca94d28f.tar.bz2
samba-34230608dfa7e9f4aa0c633e7a92df37ca94d28f.zip
Fix bug 7563 - Creation of symlink using smbclient is buggy.
Fix semantics of symlink. "oldpath" should be an untouched blob, "newpath" should fit the share path semantics. Jeremy.
Diffstat (limited to 'source3/client')
-rw-r--r--source3/client/client.c22
1 files changed, 9 insertions, 13 deletions
diff --git a/source3/client/client.c b/source3/client/client.c
index e11e3bf930..ce5b4e6323 100644
--- a/source3/client/client.c
+++ b/source3/client/client.c
@@ -2869,21 +2869,16 @@ static int cmd_symlink(void)
char *newname = NULL;
char *buf = NULL;
char *buf2 = NULL;
- char *targetname = NULL;
- struct cli_state *targetcli;
+ struct cli_state *newcli;
if (!next_token_talloc(ctx, &cmd_ptr,&buf,NULL) ||
!next_token_talloc(ctx, &cmd_ptr,&buf2,NULL)) {
d_printf("symlink <oldname> <newname>\n");
return 1;
}
- oldname = talloc_asprintf(ctx,
- "%s%s",
- client_get_cur_dir(),
- buf);
- if (!oldname) {
- return 1;
- }
+ /* Oldname (link target) must be an untouched blob. */
+ oldname = buf;
+
newname = talloc_asprintf(ctx,
"%s%s",
client_get_cur_dir(),
@@ -2892,19 +2887,20 @@ static int cmd_symlink(void)
return 1;
}
- if (!cli_resolve_path(ctx, "", auth_info, cli, oldname, &targetcli, &targetname)) {
+ /* New name must be present in share namespace. */
+ if (!cli_resolve_path(ctx, "", auth_info, cli, newname, &newcli, &newname)) {
d_printf("link %s: %s\n", oldname, cli_errstr(cli));
return 1;
}
- if (!SERVER_HAS_UNIX_CIFS(targetcli)) {
+ if (!SERVER_HAS_UNIX_CIFS(newcli)) {
d_printf("Server doesn't support UNIX CIFS calls.\n");
return 1;
}
- if (!NT_STATUS_IS_OK(cli_posix_symlink(targetcli, targetname, newname))) {
+ if (!NT_STATUS_IS_OK(cli_posix_symlink(newcli, oldname, newname))) {
d_printf("%s symlinking files (%s -> %s)\n",
- cli_errstr(targetcli), newname, targetname);
+ cli_errstr(newcli), newname, newname);
return 1;
}