Package: ncftp
Version: 2:3.1.9-1
Severity: minor
Removing a directory with rmdir fails with some servers if the directory
to delete is specified with a trailing slash. That's annoying because
this trailing slash is added by the tab completion of ncftp.
Here's how I reproduce the problem :
ncftp /yydecode > cd ..
ncftp / > mkdir testdir
ncftp / > rmdir testdir/
rmdir testdir/: server said: testdir/: Forbidden filename
ncftp / >
Note that I typed "rmdir test" and then I have used the tab key to
complete the directory name to "testdir/".
The attached patch fixes the problem. It doesn't change the tab
completion, it but removes the trailing slash from the argument of the
RMD command just before it's sent to the server.
I'd appreciate that you'd include this modification in the next upload
of ncftp. Thanks !
diff -ruN orig/ncftp-3.1.9/libncftp/c_rmdir.c ncftp-3.1.9/libncftp/c_rmdir.c
--- orig/ncftp-3.1.9/libncftp/c_rmdir.c 2005-01-01 22:29:02.000000000 +0100
+++ ncftp-3.1.9/libncftp/c_rmdir.c 2006-02-11 21:12:31.000000000 +0100
@@ -15,7 +15,7 @@
{
FTPLineList fileList;
FTPLinePtr filePtr;
- char *file;
+ char *file, *tail;
int onceResult, batchResult;
if (cip == NULL)
@@ -37,6 +37,8 @@
cip->errNo = kErrBadLineList;
break;
}
+ if( *file && *( tail = file + strlen( file ) - 1 ) == '/' )
+ *tail = '\0';
onceResult = FTPCmd(cip, "RMD %s", file);
if (onceResult < 0) {
batchResult = onceResult;