From ebe7c7a173efa32057908af43a5c3d74d8b3739a Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 24 Nov 1997 13:44:52 +0000 Subject: added cli_rmdir and cli_mkdir added test in smbtorture for the server updating the directory modify time when a file is added to a directory cleanup in smbtorture so no garbage files are left on the server (This used to be commit 3a5e07f1e994396853e6340e8ef3f4d12bb0243e) --- source3/libsmb/clientgen.c | 66 +++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 65 insertions(+), 1 deletion(-) (limited to 'source3/libsmb/clientgen.c') diff --git a/source3/libsmb/clientgen.c b/source3/libsmb/clientgen.c index 89557905fc..1bd55cffe8 100644 --- a/source3/libsmb/clientgen.c +++ b/source3/libsmb/clientgen.c @@ -594,7 +594,71 @@ BOOL cli_unlink(struct cli_state *cli, char *fname) p = smb_buf(cli->outbuf); *p++ = 4; strcpy(p,fname); - p = skip_string(p,1); + + send_smb(cli->fd,cli->outbuf); + if (!receive_smb(cli->fd,cli->inbuf,cli->timeout)) { + return False; + } + + if (CVAL(cli->inbuf,smb_rcls) != 0) { + return False; + } + + return True; +} + + +/**************************************************************************** +create a directory +****************************************************************************/ +BOOL cli_mkdir(struct cli_state *cli, char *dname) +{ + char *p; + + bzero(cli->outbuf,smb_size); + bzero(cli->inbuf,smb_size); + + set_message(cli->outbuf,0, 2 + strlen(dname),True); + + CVAL(cli->outbuf,smb_com) = SMBmkdir; + SSVAL(cli->outbuf,smb_tid,cli->cnum); + cli_setup_packet(cli); + + p = smb_buf(cli->outbuf); + *p++ = 4; + strcpy(p,dname); + + send_smb(cli->fd,cli->outbuf); + if (!receive_smb(cli->fd,cli->inbuf,cli->timeout)) { + return False; + } + + if (CVAL(cli->inbuf,smb_rcls) != 0) { + return False; + } + + return True; +} + +/**************************************************************************** +remove a directory +****************************************************************************/ +BOOL cli_rmdir(struct cli_state *cli, char *dname) +{ + char *p; + + bzero(cli->outbuf,smb_size); + bzero(cli->inbuf,smb_size); + + set_message(cli->outbuf,0, 2 + strlen(dname),True); + + CVAL(cli->outbuf,smb_com) = SMBrmdir; + SSVAL(cli->outbuf,smb_tid,cli->cnum); + cli_setup_packet(cli); + + p = smb_buf(cli->outbuf); + *p++ = 4; + strcpy(p,dname); send_smb(cli->fd,cli->outbuf); if (!receive_smb(cli->fd,cli->inbuf,cli->timeout)) { -- cgit