mirror of
https://github.com/samba-team/samba.git
synced 2025-01-22 22:04:08 +03:00
s3: client: Rename <oldname> to <link_target> in cmd_symlink() and cli_posix_symlink().
Stops us from mixing up the old and new names. Only behavior change is correcting the names printed in the error messages. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13172 Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
This commit is contained in:
parent
d7a5cd589b
commit
8448dcaa8d
@ -3523,7 +3523,7 @@ static int cmd_readlink(void)
|
||||
static int cmd_symlink(void)
|
||||
{
|
||||
TALLOC_CTX *ctx = talloc_tos();
|
||||
char *oldname = NULL;
|
||||
char *link_target = NULL;
|
||||
char *newname = NULL;
|
||||
char *buf = NULL;
|
||||
char *buf2 = NULL;
|
||||
@ -3532,11 +3532,11 @@ static int cmd_symlink(void)
|
||||
|
||||
if (!next_token_talloc(ctx, &cmd_ptr,&buf,NULL) ||
|
||||
!next_token_talloc(ctx, &cmd_ptr,&buf2,NULL)) {
|
||||
d_printf("symlink <oldname> <newname>\n");
|
||||
d_printf("symlink <link_target> <newname>\n");
|
||||
return 1;
|
||||
}
|
||||
/* Oldname (link target) must be an untouched blob. */
|
||||
oldname = buf;
|
||||
link_target = buf;
|
||||
|
||||
if (SERVER_HAS_UNIX_CIFS(cli)) {
|
||||
newname = talloc_asprintf(ctx, "%s%s", client_get_cur_dir(),
|
||||
@ -3553,19 +3553,20 @@ static int cmd_symlink(void)
|
||||
popt_get_cmdline_auth_info(), cli, newname,
|
||||
&newcli, &newname);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
d_printf("link %s: %s\n", oldname, nt_errstr(status));
|
||||
d_printf("link %s: %s\n", newname,
|
||||
nt_errstr(status));
|
||||
return 1;
|
||||
}
|
||||
status = cli_posix_symlink(newcli, oldname, newname);
|
||||
status = cli_posix_symlink(newcli, link_target, newname);
|
||||
} else {
|
||||
status = cli_symlink(
|
||||
cli, oldname, buf2,
|
||||
cli, link_target, buf2,
|
||||
buf2[0] == '\\' ? 0 : SYMLINK_FLAG_RELATIVE);
|
||||
}
|
||||
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
d_printf("%s symlinking files (%s -> %s)\n",
|
||||
nt_errstr(status), oldname, newname);
|
||||
nt_errstr(status), newname, link_target);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -151,7 +151,7 @@ NTSTATUS cli_setpathinfo(struct cli_state *cli,
|
||||
|
||||
/****************************************************************************
|
||||
Hard/Symlink a file (UNIX extensions).
|
||||
Creates new name (sym)linked to oldname.
|
||||
Creates new name (sym)linked to link_target.
|
||||
****************************************************************************/
|
||||
|
||||
struct cli_posix_link_internal_state {
|
||||
@ -164,7 +164,7 @@ static struct tevent_req *cli_posix_link_internal_send(TALLOC_CTX *mem_ctx,
|
||||
struct tevent_context *ev,
|
||||
struct cli_state *cli,
|
||||
uint16_t level,
|
||||
const char *oldname,
|
||||
const char *link_target,
|
||||
const char *newname)
|
||||
{
|
||||
struct tevent_req *req = NULL, *subreq = NULL;
|
||||
@ -182,7 +182,8 @@ static struct tevent_req *cli_posix_link_internal_send(TALLOC_CTX *mem_ctx,
|
||||
return tevent_req_post(req, ev);
|
||||
}
|
||||
state->data = trans2_bytes_push_str(
|
||||
state->data, smbXcli_conn_use_unicode(cli->conn), oldname, strlen(oldname)+1, NULL);
|
||||
state->data, smbXcli_conn_use_unicode(cli->conn),
|
||||
link_target, strlen(link_target)+1, NULL);
|
||||
|
||||
subreq = cli_setpathinfo_send(
|
||||
state, ev, cli, level, newname,
|
||||
@ -207,11 +208,11 @@ static void cli_posix_link_internal_done(struct tevent_req *subreq)
|
||||
struct tevent_req *cli_posix_symlink_send(TALLOC_CTX *mem_ctx,
|
||||
struct tevent_context *ev,
|
||||
struct cli_state *cli,
|
||||
const char *oldname,
|
||||
const char *link_target,
|
||||
const char *newname)
|
||||
{
|
||||
return cli_posix_link_internal_send(
|
||||
mem_ctx, ev, cli, SMB_SET_FILE_UNIX_LINK, oldname, newname);
|
||||
mem_ctx, ev, cli, SMB_SET_FILE_UNIX_LINK, link_target, newname);
|
||||
}
|
||||
|
||||
NTSTATUS cli_posix_symlink_recv(struct tevent_req *req)
|
||||
@ -220,7 +221,7 @@ NTSTATUS cli_posix_symlink_recv(struct tevent_req *req)
|
||||
}
|
||||
|
||||
NTSTATUS cli_posix_symlink(struct cli_state *cli,
|
||||
const char *oldname,
|
||||
const char *link_target,
|
||||
const char *newname)
|
||||
{
|
||||
TALLOC_CTX *frame = talloc_stackframe();
|
||||
@ -245,7 +246,7 @@ NTSTATUS cli_posix_symlink(struct cli_state *cli,
|
||||
req = cli_posix_symlink_send(frame,
|
||||
ev,
|
||||
cli,
|
||||
oldname,
|
||||
link_target,
|
||||
newname);
|
||||
if (req == NULL) {
|
||||
status = NT_STATUS_NO_MEMORY;
|
||||
|
Loading…
x
Reference in New Issue
Block a user