diff options
author | Jeremy Allison <jra@samba.org> | 2004-03-03 20:55:59 +0000 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2004-03-03 20:55:59 +0000 |
commit | fba5a722497c1e4577aa463921a0fec5f6d5fe55 (patch) | |
tree | 15df1942a8929c34b86df0a1bf1042700d0e7f85 /source3/libsmb | |
parent | 7ac1750de20edf1b315feb8648f292ff82e92c21 (diff) | |
download | samba-fba5a722497c1e4577aa463921a0fec5f6d5fe55.tar.gz samba-fba5a722497c1e4577aa463921a0fec5f6d5fe55.tar.bz2 samba-fba5a722497c1e4577aa463921a0fec5f6d5fe55.zip |
Use a common function to parse all pathnames from the wire. This allows
much closer emulation of Win2k3 error return codes.
Jeremy.
(This used to be commit c9f31fafeda6ad79e590276f36e03ecd2e93f818)
Diffstat (limited to 'source3/libsmb')
-rw-r--r-- | source3/libsmb/clifile.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/source3/libsmb/clifile.c b/source3/libsmb/clifile.c index c7f0cdb84b..9b766987ef 100644 --- a/source3/libsmb/clifile.c +++ b/source3/libsmb/clifile.c @@ -224,6 +224,44 @@ BOOL cli_rename(struct cli_state *cli, const char *fname_src, const char *fname_ } /**************************************************************************** + NT Rename a file. +****************************************************************************/ + +BOOL cli_ntrename(struct cli_state *cli, const char *fname_src, const char *fname_dst) +{ + char *p; + + memset(cli->outbuf,'\0',smb_size); + memset(cli->inbuf,'\0',smb_size); + + set_message(cli->outbuf, 4, 0, True); + + SCVAL(cli->outbuf,smb_com,SMBntrename); + SSVAL(cli->outbuf,smb_tid,cli->cnum); + cli_setup_packet(cli); + + SSVAL(cli->outbuf,smb_vwv0,aSYSTEM | aHIDDEN | aDIR); + SSVAL(cli->outbuf,smb_vwv1, RENAME_FLAG_RENAME); + + p = smb_buf(cli->outbuf); + *p++ = 4; + p += clistr_push(cli, p, fname_src, -1, STR_TERMINATE); + *p++ = 4; + p += clistr_push(cli, p, fname_dst, -1, STR_TERMINATE); + + cli_setup_bcc(cli, p); + + cli_send_smb(cli); + if (!cli_receive_smb(cli)) + return False; + + if (cli_is_error(cli)) + return False; + + return True; +} + +/**************************************************************************** Delete a file. ****************************************************************************/ |