Bug 183006 - smb.conf not found under FreeBSD
Summary: smb.conf not found under FreeBSD
Status: RESOLVED FIXED
Alias: None
Product: systemsettings
Classification: Applications
Component: kcm_samba (show other bugs)
Version: unspecified
Platform: FreeBSD Ports FreeBSD
: NOR normal
Target Milestone: ---
Assignee: KDE Bugs List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-02-03 15:07 UTC by David Naylor
Modified: 2009-02-03 21:05 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments
The proposed patch (1.47 KB, patch)
2009-02-03 15:11 UTC, David Naylor
Details

Note You need to log in before you can comment on or make changes to this bug.
Description David Naylor 2009-02-03 15:07:30 UTC
Version:            (using KDE 4.2.0)
Compiler:          gcc (GCC) 4.2.1 20070719  [FreeBSD] 
OS:                FreeBSD
Installed from:    FreeBSD Ports

Under FreeBSD smb.conf is located (by default) under /usr/local/etc/smb.conf however KDE does not look there.  

Please see patch for proposed changes that add /usr/local/etc/smb.conf to the search paths.
Comment 1 David Naylor 2009-02-03 15:11:27 UTC
Created attachment 30913 [details]
The proposed patch

The patch does change the basics of how the method works.  Instead of a, rather, long series of else/if it is converted into a for loop.  This should result in less source code and machine code...?
Comment 2 David Naylor 2009-02-03 15:19:56 UTC
Comment on attachment 30913 [details]
The proposed patch

--- kdelibs/kio/kio/ksambashare.cpp	2009-02-03 15:24:57.000000000 +0200
+++ kdelibs/kio/kio/ksambashare.cpp	2009-02-03 15:21:32.000000000 +0200
@@ -72,34 +72,29 @@
 {
   KConfig config(QLatin1String(FILESHARECONF));
   const KConfigGroup group(&config, QString());
+  const char *smbConfPath[] = {
+		"/etc/samba/smb.conf", 
+		"/etc/smb.conf", 
+		"/usr/local/etc/smb.conf", 
+		"/usr/local/samba/lib/smb.conf", 
+		"/usr/samba/lib/smb.conf", 
+		"/usr/lib/smb.conf", 
+		"/usr/local/lib/smb.conf", 
+		NULL};
   smbConf = group.readEntry("SMBCONF");
 
   if ( QFile::exists(smbConf) )
     return true;
+  
+  for(const char **smb = smbConfPath; *smb != NULL; ++smb)
+    if ( QFile::exists(*smb) ) {
+      smbConf = *smb;
+      return true;
+    }
+    
+  kDebug(7000) << "KSambaShare: Could not found smb.conf!";
+  return false;
 
-  if ( QFile::exists("/etc/samba/smb.conf") )
-    smbConf = "/etc/samba/smb.conf";
-  else
-  if ( QFile::exists("/etc/smb.conf") )
-    smbConf = "/etc/smb.conf";
-  else
-  if ( QFile::exists("/usr/local/samba/lib/smb.conf") )
-    smbConf = "/usr/local/samba/lib/smb.conf";
-  else
-  if ( QFile::exists("/usr/samba/lib/smb.conf") )
-    smbConf = "/usr/samba/lib/smb.conf";
-  else
-  if ( QFile::exists("/usr/lib/smb.conf") )
-    smbConf = "/usr/lib/smb.conf";
-  else
-  if ( QFile::exists("/usr/local/lib/smb.conf") )
-    smbConf = "/usr/local/lib/smb.conf";
-  else {
-    kDebug(7000) << "KSambaShare: Could not found smb.conf!";
-    return false;
-  }
-
-  return true;
 }
Comment 3 Dario Andres 2009-02-03 19:58:38 UTC
SVN commit 920766 by darioandres:

Added default location to smb.conf under FreeBSD
Loop over the default locations instead of having lot of if/else blocks

BUG: 183006



 M  +26 -26    ksambashare.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=920766
Comment 4 Dario Andres 2009-02-03 20:02:30 UTC
SVN commit 920768 by darioandres:

Backport of SVN commit 920766 to 4.2 branch
Added default location to smb.conf under FreeBSD
Loop over the default locations instead of having lot of if/else blocks
BUG: 183006



 M  +26 -26    ksambashare.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=920768
Comment 5 Dario Andres 2009-02-03 20:47:59 UTC
SVN commit 920789 by darioandres:

Doing the things properly as suggested by Friedrich W. H. Kossebau
CCBUG: 183006



 M  +24 -17    ksambashare.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=920789
Comment 6 Dario Andres 2009-02-03 21:05:33 UTC
SVN commit 920798 by darioandres:

Backport of SVN commit 920789 to 4.2branch
Doing the things properly as suggested by Friedrich W. H. Kossebau
CCBUG: 183006



 M  +24 -17    ksambashare.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=920798