Skip to contentSkip to conversation

Allow overriding the location of Samba's smbd.

PATCH Applied Brad 3 participants 3 messages Sep 2, 2011 – Sep 3, 2011 Networking

lore
Share & tools
lore

Brad

author
#0 lore raw

PATCH 1/1 Allow overriding the location of Samba's smbd.

Allow overriding the location of Samba's smbd.

Pretty much every OS I look at has some means of changing this path (patching) so lets just make it easier for OS developers creating packages and/or end users to override the location.

---
 configure       |    9 +++++++++
 net.h           |    5 -----
 net/slirp.c     |    2 +-
 qemu-options.hx |    6 +++---
 4 files changed, 13 insertions(+), 9 deletions(-)
configure +9 -0
index ad60ea0..c669d4e 100755
@@ -413,6 +413,7 @@ SunOS)
   make="${MAKE-gmake}"
   install="${INSTALL-ginstall}"
   ld="gld"
+  smbd="${SMBD-/usr/sfw/sbin/smbd}"
   needs_libsunmath="no"
   solarisrev=`uname -r | cut -f2 -d.`
   # have to select again, because `uname -m` returns i86pc
@@ -481,6 +482,7 @@ fi
 : ${make=${MAKE-make}}
 : ${install=${INSTALL-install}}
 : ${python=${PYTHON-python}}
+: ${smbd=${SMBD-/usr/sbin/smbd}}
 
 if test "$mingw32" = "yes" ; then
   EXESUF=".exe"
@@ -525,6 +527,8 @@ for opt do
   ;;
   --python=*) python="$optarg"
   ;;
+  --smbd=*) smbd="$optarg"
+  ;;
   --extra-cflags=*)
   ;;
   --extra-ldflags=*)
@@ -941,6 +945,7 @@ echo "  --extra-ldflags=LDFLAGS  append extra linker flags LDFLAGS"
 echo "  --make=MAKE              use specified make [$make]"
 echo "  --install=INSTALL        use specified install [$install]"
 echo "  --python=PYTHON          use specified python [$python]"
+echo "  --smbd=SMBD              use specified smbd [$smbd]"
 echo "  --static                 enable static build [$static]"
 echo "  --mandir=PATH            install man pages in PATH"
 echo "  --datadir=PATH           install firmware in PATH"
@@ -2666,6 +2671,9 @@ echo "LDFLAGS           $LDFLAGS"
 echo "make              $make"
 echo "install           $install"
 echo "python            $python"
+if test "$slirp" = "yes" ; then
+    echo "smbd              $smbd"
+fi
 echo "host CPU          $cpu"
 echo "host big endian   $bigendian"
 echo "target list       $target_list"
@@ -2825,6 +2833,7 @@ if test "$profiler" = "yes" ; then
 fi
 if test "$slirp" = "yes" ; then
   echo "CONFIG_SLIRP=y" >> $config_host_mak
+  echo "CONFIG_SMBD_COMMAND=\"$smbd\"" >> $config_host_mak
   QEMU_INCLUDES="-I\$(SRC_PATH)/slirp $QEMU_INCLUDES"
 fi
 if test "$vde" = "yes" ; then
net.h +0 -5
index 5a7881c..9f633f8 100644
@@ -174,11 +174,6 @@ int do_netdev_del(Monitor *mon, const QDict *qdict, QObject **ret_data);
 
 #define DEFAULT_NETWORK_SCRIPT "/etc/qemu-ifup"
 #define DEFAULT_NETWORK_DOWN_SCRIPT "/etc/qemu-ifdown"
-#ifdef __sun__
-#define SMBD_COMMAND "/usr/sfw/sbin/smbd"
-#else
-#define SMBD_COMMAND "/usr/sbin/smbd"
-#endif
 
 void qdev_set_nic_properties(DeviceState *dev, NICInfo *nd);
 
net/slirp.c +1 -1
index 3b39d21..c6cda5d 100644
@@ -529,7 +529,7 @@ static int slirp_smb(SlirpState* s, const char *exported_dir,
     fclose(f);
 
     snprintf(smb_cmdline, sizeof(smb_cmdline), "%s -s %s",
-             SMBD_COMMAND, smb_conf);
+             CONFIG_SMBD_COMMAND, smb_conf);
 
     if (slirp_add_exec(s->slirp, 0, smb_cmdline, &vserver_addr, 139) < 0) {
         slirp_smb_cleanup(s);
qemu-options.hx +3 -3
index 35d95d1..e24a740 100644
@@ -1277,9 +1277,9 @@ or @file{C:\WINNT\SYSTEM32\DRIVERS\ETC\LMHOSTS} (Windows NT/2000).
 
 Then @file{@var{dir}} can be accessed in @file{\\smbserver\qemu}.
 
-Note that a SAMBA server must be installed on the host OS in
-@file{/usr/sbin/smbd}. QEMU was tested successfully with smbd versions from
-Red Hat 9, Fedora Core 3 and OpenSUSE 11.x.
+Note that a SAMBA server must be installed on the host OS.
+QEMU was tested successfully with smbd versions from Red Hat 9,
+Fedora Core 3 and OpenSUSE 11.x.
 
 @item hostfwd=[tcp|udp]:[@var{hostaddr}]:@var{hostport}-[@var{guestaddr}]:@var{guestport}
 Redirect incoming TCP or UDP connections to the host port @var{hostport} to
Signature · 1 line
1.7.6
Reviewed-by on v1 1/1
#1 lore raw
Quoted 7 lines · Brad

Allow overriding the location of Samba's smbd.

Pretty much every OS I look at has some means of changing this path (patching) so lets just make it easier for OS developers creating packages and/or end users to override the location.

Quoted 8 lines

---
 configure       |    9 +++++++++
 net.h           |    5 -----
 net/slirp.c     |    2 +-
 qemu-options.hx |    6 +++---

 4 files changed, 13 insertions(+), 9 deletions(-)
Applied
#2 lore raw
In reply to Brad

Thanks, applied.

Quoted 122 lines · Brad

Allow overriding the location of Samba's smbd.

Pretty much every OS I look at has some means of changing this path (patching) so lets just make it easier for OS developers creating packages and/or end users to override the location.

---
 configure       |    9 +++++++++
 net.h           |    5 -----
 net/slirp.c     |    2 +-
 qemu-options.hx |    6 +++---

 4 files changed, 13 insertions(+), 9 deletions(-)
configure +0 -0
index ad60ea0..c669d4e 100755
@@ -413,6 +413,7 @@ SunOS)

  make="${MAKE-gmake}" install="${INSTALL-ginstall}"
  ld="gld"
+  smbd="${SMBD-/usr/sfw/sbin/smbd}" needs_libsunmath="no" solarisrev=uname -r | cut -f2 -d.

  # have to select again, because `uname -m` returns i86pc
configure +1 -0
@@ -481,6 +482,7 @@ fi
  : ${make=${MAKE-make}}
  : ${install=${INSTALL-install}}
  : ${python=${PYTHON-python}}
+: ${smbd=${SMBD-/usr/sbin/smbd}}
 

 if test "$mingw32" = "yes" ; then
  EXESUF=".exe"

configure +0 -0
@@ -525,6 +527,8 @@ for opt do
   ;;

  --python=*) python="$optarg"
  ;;
+  --smbd=*) smbd="$optarg"
+  ;;
  --extra-cflags=*)
  ;;
  --extra-ldflags=*)

configure +0 -0
@@ -941,6 +945,7 @@ echo "  --extra-ldflags=LDFLAGS  append extra linker flags LDFLAGS"

 echo "  --make=MAKE              use specified make [$make]" echo "  --install=INSTALL        use specified install [$install]" echo "  --python=PYTHON          use specified python [$python]" +echo "  --smbd=SMBD              use specified smbd [$smbd]" echo "  --static                 enable static build [$static]" echo "  --mandir=PATH            install man pages in PATH" echo "  --datadir=PATH           install firmware in PATH"

configure +0 -0
@@ -2666,6 +2671,9 @@ echo "LDFLAGS           $LDFLAGS"

 echo "make              $make"
 echo "install           $install"
 echo "python            $python"

configure +3 -0
+if test "$slirp" = "yes" ; then
+    echo "smbd              $smbd"
+fi

 echo "host CPU          $cpu"
 echo "host big endian   $bigendian" echo "target list       $target_list"

configure +0 -0
@@ -2825,6 +2833,7 @@ if test "$profiler" = "yes" ; then

 fi
 if test "$slirp" = "yes" ; then
  echo "CONFIG_SLIRP=y" >> $config_host_mak
+  echo "CONFIG_SMBD_COMMAND=\"$smbd\"" >> $config_host_mak QEMU_INCLUDES="-I\$(SRC_PATH)/slirp $QEMU_INCLUDES" fi
 if test "$vde" = "yes" ; then

net.h +0 -5
index 5a7881c..9f633f8 100644
@@ -174,11 +174,6 @@ int do_netdev_del(Monitor *mon, const QDict *qdict, QObject **ret_data);
 
  #define DEFAULT_NETWORK_SCRIPT "/etc/qemu-ifup"
  #define DEFAULT_NETWORK_DOWN_SCRIPT "/etc/qemu-ifdown"
-#ifdef __sun__
-#define SMBD_COMMAND "/usr/sfw/sbin/smbd"
-#else
-#define SMBD_COMMAND "/usr/sbin/smbd"
-#endif
 
  void qdev_set_nic_properties(DeviceState *dev, NICInfo *nd);
 
net/slirp.c +1 -1
index 3b39d21..c6cda5d 100644
@@ -529,7 +529,7 @@ static int slirp_smb(SlirpState* s, const char *exported_dir,
     fclose(f);
 
     snprintf(smb_cmdline, sizeof(smb_cmdline), "%s -s %s",
-             SMBD_COMMAND, smb_conf);
+             CONFIG_SMBD_COMMAND, smb_conf);
 
     if (slirp_add_exec(s->slirp, 0, smb_cmdline, &vserver_addr, 139) < 0) {
         slirp_smb_cleanup(s);
qemu-options.hx +0 -0
index 35d95d1..e24a740 100644
@@ -1277,9 +1277,9 @@ or @file{C:\WINNT\SYSTEM32\DRIVERS\ETC\LMHOSTS} (Windows NT/2000).
 

 Then @file{@var{dir}} can be accessed in @file{\\smbserver\qemu}.

qemu-options.hx +3 -3
-Note that a SAMBA server must be installed on the host OS in
-@file{/usr/sbin/smbd}. QEMU was tested successfully with smbd versions from
-Red Hat 9, Fedora Core 3 and OpenSUSE 11.x.
+Note that a SAMBA server must be installed on the host OS.
+QEMU was tested successfully with smbd versions from Red Hat 9,
+Fedora Core 3 and OpenSUSE 11.x.

 @item hostfwd=[tcp|udp]:[@var{hostaddr}]:@var{hostport}-[@var{guestaddr}]:@var{guestport} Redirect incoming TCP or UDP connections to the host port @var{hostport} to --
1.7.6