a bug in smbmount

Anton A. Golubev anton at engec.ru
Tue Jun 13 11:39:40 GMT 2000


Hello All!

There was a problem: then the samba server goes down, the smbfs
tries to reconnect only once. Then the server returns online
the smbfs dont restore connection and say "I/O error"
without keeping trying to reconnect.

I found that there is no problem in smbfs kernel module.
Each time it got CONN_INVALID, it send SIGUSR1 to smbmount daemon,
which has to restore connection.

The problem is in smbmount. Then it got SIGUSR1 it tries
to connect to the server. If the server already got back,
the connection will be successfully restored.

But if the server still offline and smbmount fails to reconnect,
it exit with core dump. I think it shouldn't.

I think the bug is in send_fs_socket (smbmount.c) in
infinite loop. do_connection returns NULL pointer:
    c=do_connection(service);
and program don't check it.

I offer the patch which i tested and it worked for me,
but i am not an expireenced programmer:

---------------------------------------------------------------
--- smbmount.c.ORIG     Thu Nov 11 00:00:00 1999
+++ smbmount.c  Tue Jun 13 14:00:23 2000
@@ -342,7 +342,7 @@
                        close_our_files(c?c->fd:-1);
                }
 #endif
-
+failed:
                /* Wait for a signal from smbfs ... */
                CatchSignal(SIGUSR1, &usr1_handler);
                pause();
@@ -350,6 +350,7 @@
                DEBUG(2,("mount.smbfs: got signal, getting new socket\n"));
 #endif
                c = do_connection(service);
+               if(c==NULL) goto failed;
        }
 
        smb_umount(mount_point);
---------------------------------------------------------------


--Anton

P.S. Sorry for my bad English, but i am not a native speaker.
P.P.S. Is it a known bug? Is there any other patches?

--Anton                          mailto:anton at engec.ru
ENGECON CC




More information about the samba mailing list