[PATCH] Add a "deltree" command to smbclient.

Andrew Bartlett abartlet at samba.org
Fri Jul 7 07:48:16 UTC 2017


On Fri, 2017-07-07 at 09:14 +0200, Andreas Schneider via samba-
technical wrote:
> On Thursday, 6 July 2017 21:05:46 CEST Alexander Bokovoy wrote:
> > +       dt = talloc_zero(NULL, struct file_list);
> > +       if (dt == NULL) {
> > +               return NT_STATUS_NO_MEMORY;
> > +       }
> > +
> > +       /* create absolute filename for cli_ntcreate() */
> > +       dt->file_path = talloc_asprintf(dt,
> > +                               "%s%s%s",
> > +                               dir,
> > +                               CLI_DIRSEP_STR,
> > +                               finfo->name);
> > +       if (dt->file_path == NULL) {
> 
> TALLOC_FREE(dt);
> 
> missing, I've added it and pushed the patchset upstream
> 
> > +               return NT_STATUS_NO_MEMORY;
> > +       }
> 
> 
> > +# Test smbclient deltree command
> > +test_deltree()
> > +{
> > +    tmpfile=$PREFIX/smbclient_interactive_prompt_commands
> > +    deltree_dir=$PREFIX/deltree_dir
> > +
> > +    rm -f $deltree_dir
> 
> And as this is a directory I think we want 'rm -rf'
> 
> > +    cat > $tmpfile <<EOF
> > +mkdir deltree_dir
> > +mkdir deltree_dir/foo
> > +mkdir deltree_dir/foo/bar
> > +put ${SMBCLIENT} deltree_dir/foo/bar/client
> > +deltree deltree_dir
> > +quit
> > +EOF
> 

Nice!  Thanks for doing the mkdir side remotely, that should avoid this
flapping with the same issue as the symlink test.

Andrew Bartlett
-- 
Andrew Bartlett                       http://samba.org/~abartlet/
Authentication Developer, Samba Team  http://samba.org
Samba Developer, Catalyst IT          http://catalyst.net.nz/services/samba




More information about the samba-technical mailing list