All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jordi Pujol <jordipujolp@gmail.com>
To: Laurent Vivier <laurent@vivier.eu>
Cc: Samuel Thibault <samuel.thibault@ens-lyon.org>,
	Jason Wang <jasowang@redhat.com>,
	qemu-devel qemu-devel <qemu-devel@nongnu.org>,
	Jan Kiszka <jan.kiszka@siemens.com>
Subject: Re: [PATCH v2] smb daemon get additional command line parameters from env variable
Date: Thu, 31 Oct 2019 14:33:00 +0100	[thread overview]
Message-ID: <CACTE=goN=Nw8b5RN8sWhX9mRNWEU0fhuc=HnD3MJW59BET=hkA@mail.gmail.com> (raw)
In-Reply-To: <144c1b0a-5cd4-b657-025b-f44d5e812e06@vivier.eu>

Hello,

Many thanks Laurent,

This is the version 2 of this patch, has been modified according to
the qemu guidelines.

**************************************************
From: Jordi Pujol Palomer <jordipujolp@gmail.com>
Date: Thu, 31 Oct 2019 14:31:14 +0200
Subject: [PATCH v2] QEMU samba daemon: additional command line options

The smbd daemon takes additional command line options
from environment variable SMBDOPTIONS.
Set the environment variable SMBDOPTIONS before executing qemu.

Example:

export SMBDOPTIONS="--option='server min protocol=CORE' -d 4"

Signed-off-by: Jordi Pujol Palomer <jordipujolp@gmail.com>
---
--- qemu-4.1-a/net/slirp.c
+++ qemu_4.1-b/net/slirp.c
@@ -909,6 +909,12 @@ static int slirp_smb(SlirpState* s, cons
              CONFIG_SMBD_COMMAND, s->smb_dir, smb_conf);
     g_free(smb_conf);

+    char *options = g_strdup(g_getenv("SMBDOPTIONS"));
+    if (options) {
+        smb_cmdline = g_strdup_printf("%s %s", smb_cmdline, options);
+    }
+    g_free(options);
+
     if (slirp_add_exec(s->slirp, smb_cmdline, &vserver_addr, 139) < 0 ||
         slirp_add_exec(s->slirp, smb_cmdline, &vserver_addr, 445) < 0) {
         slirp_smb_cleanup(s);

--- qemu-4.1-a/slirp/src/misc.c 2019-10-29 14:40:15.043120941 +0100
+++ qemu-4.1-b/slirp/src/misc.c 2019-10-29 14:41:04.440235684 +0100
@@ -168,7 +168,9 @@ g_spawn_async_with_fds_slirp(const gchar
 int fork_exec(struct socket *so, const char *ex)
 {
     GError *err = NULL;
-    char **argv;
+    gint argc = 0;
+    gchar **argv = NULL;
+    gboolean ret;
     int opt, sp[2];

     DEBUG_CALL("fork_exec");
@@ -179,7 +181,13 @@ int fork_exec(struct socket *so, const c
         return 0;
     }

-    argv = g_strsplit(ex, " ", -1);
+    ret = g_shell_parse_argv(ex, &argc, &argv, &err);
+    if (err) {
+        g_critical("fork_exec invalid command: %s", err->message);
+        g_error_free(err);
+        return 0;
+    }
+
     g_spawn_async_with_fds(NULL /* cwd */, argv, NULL /* env */,
                            G_SPAWN_SEARCH_PATH, fork_exec_child_setup,
                            NULL /* data */, NULL /* child_pid */, sp[1], sp[1],
**************************************************

Thanks,

Jordi Pujol


  reply	other threads:[~2019-10-31 14:36 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CACTE=gpFbUSxXeTwu6_tzSeoh_9Yp905aMdzCPCUz3h7kcgeyw@mail.gmail.com>
2019-10-31 12:47 ` smb daemon get additional command line parameters from env variable Laurent Vivier
2019-10-31 13:33   ` Jordi Pujol [this message]
2019-10-31 16:15     ` [PATCH v2] " Samuel Thibault
2019-11-01 14:38       ` [PATCH v3] " Jordi Pujol
2019-11-01 14:54         ` Samuel Thibault
2019-11-02  7:41           ` [PATCH v4] " Jordi Pujol
2019-11-02  8:33             ` Samuel Thibault

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CACTE=goN=Nw8b5RN8sWhX9mRNWEU0fhuc=HnD3MJW59BET=hkA@mail.gmail.com' \
    --to=jordipujolp@gmail.com \
    --cc=jan.kiszka@siemens.com \
    --cc=jasowang@redhat.com \
    --cc=laurent@vivier.eu \
    --cc=qemu-devel@nongnu.org \
    --cc=samuel.thibault@ens-lyon.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.