Midnight Commander and SMB

Dan M. shem at warehouse.net
Fri Jan 8 02:27:29 GMT 1999


Andrew Tridgell wrote:

> great, I'm glad to see it's working OK. I imagine Juan was thinking of
> linking direct to the smbwrapper code rather than using LD_PRELOAD and
> that should increase the reliability a bit. All the ugly (and
> dangerous) tricks in smbwrapper are in wrapped.c, which wouldn't be
> needed in that case.

ugly/dangerous but addictive... after reading the PORTING document in
the
smbwrapper directory, I wanted to try it out with different
protocols all at once, trying to return 'appropriate' return codes to
not break existing programs. Serious UNIX scientists will probably laugh
out loud at that last sentence but it's a feature I dream of having one
day
(transparent redirection). I know the issues of various protocol timings
whatever make it somewhere between very difficult and nearly impossible
to
do. Or maybe just unreliable if you did get it working. I guess if it
was
that important a feature it would be in the C library already.

I agree completely with you, the mc people would probably be best
advised to to use the smbw_ stuff as opposed to dealing with the wrapper
code. I just wanted to see it working.

> You mentioned segfaults when doing some things, could you help to
> track those down? Start by doing a strace to see if any system calls
> are "leaking" through wrapped.c and if that doesn't find it then use
> gdb.

Ok, a backtrace:

#0  0x404bfdc4 in strncmp ()
#1  0x4001a2b8 in smbw_path (path=0x0) at smbwrapper/smbw.c:353
#2  0x4001caae in mkdir (name=0x0, mode=0) at smbwrapper/wrapped.c:344
smbw_path->/usr/local/lib/libgnome.so.31
#3  0x4040c86e in lock () at gnome-metadata.c:144
#4  0x4040e19d in gnome_metadata_get (
    file=0x818d5b8 "/home/daniel/desktop/Home directory",
    name=0x81129bb "icon-position", size=0xbffffc0c, buffer=0xbffffc08)
    at gnome-metadata.c:1000

I'm not sure then who's bug this is :) for some reason,
gnome-metadata.c:144 is calling mkdir() with a NULL pointer
for the first argument. This doesn't cause a problem under
normal circumstances (?)

Running under smbwrapper, smbw_path() in smbw.c doesn't check if path is
a null pointer so the first call to strncmp() in that function causes a
segfault. Adding:

     if (path==NULL)
                return(0);

immediately before/after the comment about BSD malloc and recompiling,
gmc starts up gracefully, desktop icons and all. I don't know what
other programs this is likely to break, however.

Cheers,

Daniel Morriss
Simplicity IT


More information about the samba-technical mailing list