Samba configuration files directory



Hi, Pavel!

I implement possibility to describe where Samba configuration file is in the
system.  This can be configured by configure, but somewhere smb.conf is 
placed in the /etc, somewhere in the /etc/samba and so on.  This feature
can be useful for system administrators.  I need your help to describe
this change in the doc/mc.1.in.  My English is not perfect ;-)

ChangeLog:

* doc/mc.1.in (mc.lib): Describe Samba section.

src/ChangeLog
* setup.c (get_samba_configdir) [WITH_SMBFS]: New function to 
load Samba configuration files directory from global parameters file.
(load_keys_from_section): Remove useless code.
* setup.h: Declare get_samba_configdir().

vfs/ChangeLog:

* smbfs.c (smbfs_init): Use Samba configuration files directory
from global mc.lib if this one is defined there.

--- doc/mc.1.in	Sat Aug 31 12:52:18 2002
+++ doc/mc.1.in	Sat Aug 31 22:47:38 2002
@@ -1,5 +1,5 @@
 .\"TOPICS "Topics:"
-.TH mc 1 "30 October 1998"
+.TH mc 1 "31 August 2002"
 .\"SKIP_SECTION"
 .SH "NAME"
 mc \- Visual shell for Unix-like systems.
@@ -3151,7 +3151,14 @@
 .\"LINK2"
 terminal settings
 .\"Terminal databases"
-are loaded from mc.lib.
+are loaded from mc.lib.  Also, if Midnight Commander supports 
+.\"LINK2"
+SMB File System,
+.\"SMB File System"
+the directory where Samba configuration file (smb.conf) is located in your
+system may be specified in the
+.I configdir
+variable of the Samba section.
 .PP
 ~/.mc/ini
 .IP
Index: src/setup.h
===================================================================
RCS file: /cvs/gnome/mc/src/setup.h,v
retrieving revision 1.7
diff -u -p -r1.7 setup.h
--- src/setup.h	17 Aug 2002 01:11:21 -0000	1.7
+++ src/setup.h	31 Aug 2002 19:57:27 -0000
@@ -17,6 +17,7 @@ void panel_load_setup ();
 void load_key_defs (void);
 void save_panel_types (void);
 char *load_anon_passwd (void);
+int get_samba_configdir (char *configdir, int maxsize);
 
 extern char *profile_name;
 extern char *global_profile_name;
Index: setup.c
===================================================================
RCS file: /cvs/gnome/mc/src/setup.c,v
retrieving revision 1.62
diff -u -p -r1.62 setup.c
--- src/setup.c	19 Aug 2002 01:43:40 -0000	1.62
+++ src/setup.c	31 Aug 2002 19:00:54 -0000
@@ -587,6 +588,15 @@
     else
 	return 0;
 }
+
+#ifdef WITH_SMBFS
+void
+load_samba_configdir (char *configdir, int maxsize)
+{
+    GetPrivateProfileString ("Samba", "configdir", "", configdir, maxsize,
+			     global_profile_name);
+}
+#endif /* WITH_SMBFS */
 #endif /* USE_VFS && USE_NETCODE */
 
 void done_setup (void)
@@ -611,10 +622,6 @@ load_keys_from_section (char *terminal, 
 
     section_name = g_strconcat ("terminal:", terminal, NULL);
     profile_keys = profile_init_iterator (section_name, profile_name);
-    if (!profile_keys){
-	g_free (section_name);
-	return;
-    }
 
     while (profile_keys){
 	profile_keys = profile_iterator_next (profile_keys, &key, &value);
Index: vfs/smbfs.c
===================================================================
RCS file: /cvs/gnome/mc/vfs/smbfs.c,v
retrieving revision 1.37
diff -u -p -r1.37 smbfs.c
--- vfs/smbfs.c	15 Aug 2002 21:15:17 -0000	1.37
+++ vfs/smbfs.c	31 Aug 2002 19:55:00 -0000
@@ -48,6 +48,7 @@
 #include "vfs.h"
 #include "smbfs.h"
 #include "../src/dialog.h"
+#include "../src/setup.h"	/* get_samba_configdir() */
 
 #define SMBFS_MAX_CONNECTIONS 16
 static const char * const IPC = "IPC$";
@@ -261,6 +262,12 @@ smbfs_init (vfs * me)
 {
     char *servicesf = CONFIGDIR PATH_SEP_STR "smb.conf";
 
+    /* Get CONFIGDIR from mc.lib */
+    if (get_samba_configdir (username, sizeof (username))) {
+	pstrcat (username, PATH_SEP_STR "smb.conf");
+	servicesf = username;
+    }
+
     /*  DEBUGLEVEL = 4; */
 
     setup_logging ("mc", True);



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