[wplug] Off-the-wall Question on FTP
Diana A. Clarion
dclarion at fnordnet.net
Wed Mar 8 17:28:14 EST 2006
Oh, I intend to play around with the code, let me assure you. I'll likely end
up using Dave Holland's somewhat revised client as a code base, and can
probably stick the new code into the pipeprotect() function (cmds.c).
All I need to do now is decide what I want to do; probably strip directories
and dump everything into the local CWD...
DAC
On Wed, Mar 08, 2006 at 11:58:22AM -0500, Chester R. Hosey wrote:
>
> If you're interested, it wouldn't be hard to revise the code slightly to
> change this behavior, either by attempting to create the directory first
> or by simply stripping the directory portion of the filename prior to
> processing. A description of causing the latter behavior follows, if
> you're interested. If not, no biggie. Personally, I'd probably just seek
> another client, but sometimes it's fun to play.
>
> I'm pretty sure BSD generally defaults to lukemftp, and the source
> filenames match the Debian distribution of lukemftp, which I examined
> for the following comments.
>
> Check out the getit function in cmds.c (I'm not sure where it is in the
> source tree, but it shouldn't be that hard to track down). There's a
> line that reads:
>
> locfile = olocfile;
>
> Declare a new "char *tmpfn" at the top of the function, and change the
> above line to read:
>
> tmpfn = strdup(olocfile);
> locfile = basename(tmpfn);
>
> To the end of the function (after the "freegetit" label), add:
>
> (void)free(tmpfn);
>
> Yes, I dislike the case to void, but it matches the style of the rest of
> the program. Consistency makes code easier to read, so it's a good
> habit. Four lines of code, a recompile, and you no longer have attempts
> to create files in invalid directories.
>
> Changing the behavior to attempting to create the directory first is
> similarly easy. If you're interested and would like some help, feel free
> to shoot me an email off-list.
>
> Chet
>
> _______________________________________________
> wplug mailing list
> wplug at wplug.org
> http://www.wplug.org/mailman/listinfo/wplug
--
Diana A. Clarion, Goddess of the Network
http://www.fnordnet.net/~dclarion
More information about the wplug
mailing list