From 1db9257c953c93c3f26596a535e4f26b609e7955 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Tue, 6 Apr 2004 23:01:09 +0000 Subject: r96: Stupid f&%'n UNIX extensions.... SETPATHINFO normally takes as it's param entry the filename to be acted upon.... Unless it's UNIX extensions create hardlink, or UNIX extensions create symlink. Then it's param -> newfile name data -> oldfile name. This caused me to stuff them up in 3.0.2 (and the client commands link and symlink). Fixed them, everything is now called oldname and newname - thus specifying which name should already exist (hint - the old one...) and which will be created (newname). Jeremy. (This used to be commit 21cc6ab7e8a41160a3e2970623ade7445b5214d6) --- source3/libsmb/clifile.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'source3/libsmb') diff --git a/source3/libsmb/clifile.c b/source3/libsmb/clifile.c index bf7923ec78..398c7cc4f0 100644 --- a/source3/libsmb/clifile.c +++ b/source3/libsmb/clifile.c @@ -25,9 +25,10 @@ /**************************************************************************** Hard/Symlink a file (UNIX extensions). + Creates new name (sym)linked to oldname. ****************************************************************************/ -static BOOL cli_link_internal(struct cli_state *cli, const char *fname_src, const char *fname_dst, BOOL hard_link) +static BOOL cli_link_internal(struct cli_state *cli, const char *oldname, const char *newname, BOOL hard_link) { unsigned int data_len = 0; unsigned int param_len = 0; @@ -36,18 +37,18 @@ static BOOL cli_link_internal(struct cli_state *cli, const char *fname_src, cons pstring data; char *rparam=NULL, *rdata=NULL; char *p; - size_t srclen = 2*(strlen(fname_src)+1); - size_t destlen = 2*(strlen(fname_dst) + 1); + size_t oldlen = 2*(strlen(oldname)+1); + size_t newlen = 2*(strlen(newname)+1); memset(param, 0, sizeof(param)); SSVAL(param,0,hard_link ? SMB_SET_FILE_UNIX_HLINK : SMB_SET_FILE_UNIX_LINK); p = ¶m[6]; - p += clistr_push(cli, p, fname_src, MIN(srclen, sizeof(param)-6), STR_TERMINATE); + p += clistr_push(cli, p, newname, MIN(newlen, sizeof(param)-6), STR_TERMINATE); param_len = PTR_DIFF(p, param); p = data; - p += clistr_push(cli, p, fname_dst, MIN(destlen,sizeof(data)), STR_TERMINATE); + p += clistr_push(cli, p, oldname, MIN(oldlen,sizeof(data)), STR_TERMINATE); data_len = PTR_DIFF(p, data); if (!cli_send_trans(cli, SMBtrans2, @@ -105,18 +106,18 @@ uint32 unix_perms_to_wire(mode_t perms) Symlink a file (UNIX extensions). ****************************************************************************/ -BOOL cli_unix_symlink(struct cli_state *cli, const char *fname_src, const char *fname_dst) +BOOL cli_unix_symlink(struct cli_state *cli, const char *oldname, const char *newname) { - return cli_link_internal(cli, fname_src, fname_dst, False); + return cli_link_internal(cli, oldname, newname, False); } /**************************************************************************** Hard a file (UNIX extensions). ****************************************************************************/ -BOOL cli_unix_hardlink(struct cli_state *cli, const char *fname_src, const char *fname_dst) +BOOL cli_unix_hardlink(struct cli_state *cli, const char *oldname, const char *newname) { - return cli_link_internal(cli, fname_src, fname_dst, True); + return cli_link_internal(cli, oldname, newname, True); } /**************************************************************************** -- cgit