Re: .netrc patch breaks fish, possibly mcfs and smbfs

* Pavel Roskin <proski gnu org>, 11/07/2002, 01:49

> I've just found a regression in the current version of MC.  Fish doesn't
> work anymore unless the user is specified explicitly.  If I don't specify
> the user, mc tries to login as user "*netrc*" over ssh.
> [...]
> Indeed, vfs_split_url() is called not only by ftpfs, but also by fish,
> mcfs and smbfs.  But only ftpfs knows how to handle "*netrc*".

Argh! That just *had to* happen, of course. 8-(

> Thomas, do you have any ideas how to fix it?  I'll be busy the rest of
> this week, but I'll apply your fix if you post it.

Off-hand, without looking at the code, I can think of two similar quick-
and-dirty fixes, with a similar degree of ugliness:

1. Introduce a global variable that is set before calling, and then read
   by vfs_split_url(), telling it whether or not to use the netrc code.
   ftpfs would set it to TRUE, all others to FALSE.
   Advantage: changes to the actual code could be reduced to only those
   source files that I already modified with my patch anyway, simply by
   initializing the global to 0/FALSE, and then doing something like
      called_from_ftpfs = 1;
      called_from_ftpfs = 0;

   in the ftpfs related code.

2. Add a new parameter to be passed to vfs_split_url(), with the same
   meaning as above.
   Advantage: when #defined as a macro (which would automagically add
   the correct values for ftpfs, fish, mcfs and smbfs) in the respective
   headers, the change becomes more or less transparent to the existing
   code. Moreover, this would catch accidental breakages in the future,
   caused by, for example, calling vfs_split_url() from some new or other
   place(s) (ie. VFS subsystems) than now, without properly setting the
   global first.

In the vfs_split_url() code itself, the new global/parameter would more
or less do the same thing at runtime that the "#ifdef USE_NETRC" parts do
(or rather, did - as I understand the #ifdefs are completely gone now) at
compile time in my original patch, and the "if (use_netrc == 1)" parts
would have to be changed to "if (use_netrc && called_from_ftpfs)".

Personally, I'd rather go for solution 2. (and changing the actual calls
to vfs_split_url() instead of using a #define, coming to think of it),
because it feels slightly cleaner and safer (with respect to possible
future changes & additions) than 1., and there are already two parameters
to vfs_split_url() that are ftpfs specific anyway.

What do you think?

-  Thomas "ZlatkO" Zajic    <zlatko gmx at>     Linux-2.4.18 & Mutt-1.4i  -
-  "It is not easy to cut through a human head with a hacksaw."  (M. C.)  -

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]