summaryrefslogtreecommitdiff
path: root/source3/libsmb
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>1997-11-24 13:44:52 +0000
committerAndrew Tridgell <tridge@samba.org>1997-11-24 13:44:52 +0000
commitebe7c7a173efa32057908af43a5c3d74d8b3739a (patch)
treeb1acb1d2cf692411cf898d12b643f3de974afd11 /source3/libsmb
parent931d0150b0751d2e52cded550061374826214943 (diff)
downloadsamba-ebe7c7a173efa32057908af43a5c3d74d8b3739a.tar.gz
samba-ebe7c7a173efa32057908af43a5c3d74d8b3739a.tar.bz2
samba-ebe7c7a173efa32057908af43a5c3d74d8b3739a.zip
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)
Diffstat (limited to 'source3/libsmb')
-rw-r--r--source3/libsmb/clientgen.c66
1 files changed, 65 insertions, 1 deletions
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)) {