Skip to contentSkip to conversation

net/slirp: specify logbase for smbd

PATCH In review Michael Tokarev 2 participants 2 messages Oct 24, 2014 – Oct 25, 2014 Networking

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net/slirp: specify logbase for smbd

It looks like smbd always logs to /var/log/samba/log.$progname even if config file specifies different logfile -- when it needs to log something before completing reading the config file. But if it can't open it for writing, it fails and exits. Tell smbd to use our temp dir as logbase (-l option) to avoid that.

The same option is used by samba3 and samba4, so there should be no incompatible changes.

---
 net/slirp.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
net/slirp.c +2 -2
index c171119..920af30 100644
@@ -549,8 +549,8 @@ static int slirp_smb(SlirpState* s, const char *exported_dir,
             );
     fclose(f);
 
-    snprintf(smb_cmdline, sizeof(smb_cmdline), "%s -s %s",
-             CONFIG_SMBD_COMMAND, smb_conf);
+    snprintf(smb_cmdline, sizeof(smb_cmdline), "%s -l %s -s %s",
+             CONFIG_SMBD_COMMAND, s->smb_dir, smb_conf);
 
     if (slirp_add_exec(s->slirp, 0, smb_cmdline, &vserver_addr, 139) < 0 ||
         slirp_add_exec(s->slirp, 0, smb_cmdline, &vserver_addr, 445) < 0) {
Signature · 1 line
1.7.10.4
#1 lore raw
Quoted 20 lines · Michael Tokarev

It looks like smbd always logs to /var/log/samba/log.$progname even if config file specifies different logfile -- when it needs to log something before completing reading the config file. But if it can't open it for writing, it fails and exits. Tell smbd to use our temp dir as logbase (-l option) to avoid that.

The same option is used by samba3 and samba4, so there should be no incompatible changes.

---
 net/slirp.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
net/slirp.c +0 -0
index c171119..920af30 100644

net/slirp.c static int slirp_smb(SlirpState* s, const char *exported_dir, · line 556

Quoted 10 lines
net/slirp.c +2 -2
@@ -549,8 +549,8 @@ static int slirp_smb(SlirpState* s, const char *exported_dir,
             );
     fclose(f);
 
-    snprintf(smb_cmdline, sizeof(smb_cmdline), "%s -s %s",
-             CONFIG_SMBD_COMMAND, smb_conf);
+    snprintf(smb_cmdline, sizeof(smb_cmdline), "%s -l %s -s %s",
+             CONFIG_SMBD_COMMAND, s->smb_dir, smb_conf);
 
     if (slirp_add_exec(s->slirp, 0, smb_cmdline, &vserver_addr, 139) < 0 ||
         slirp_add_exec(s->slirp, 0, smb_cmdline, &vserver_addr, 445) < 0) {

Cool, works for me as well!

Reviewed-and-tested-by Jan Kiszka <[email protected]>

Jan