The branch, master has been updated
       via  77eabd74e9a docs: dfree command. Correct usage of dfree scripts.
       via  9fa95d5b453 lib: util: Finally remove possibilities of using 
sys_popen() unsafely.
       via  dbfa3cd1864 s3: lib: Rename all uses of file_pload_XXX -> 
file_ploadv_XXX.
       via  d5c363d65d7 s3: lib: Remove file_pload_send().
       via  449d49946b2 s3: winbind: Convert idmap to use file_ploadv_send().
       via  61054e53f53 s3: lib: Add file_ploadv_send().
       via  c5729ae4421 lib: util: Remove file_pload()
       via  02bc0ce9d22 s3: lib: Remove file_lines_pload().
       via  4a63e3b9659 s3: smbd: Convert sysquotas.c code to use 
file_lines_ploadv().
       via  f9ccf1cc3df s3: smbd: Convert print_svid code to use 
file_lines_ploadv().
       via  d6453e1ffd9 s3: smbd: Convert dfree code to use file_lines_ploadv().
       via  3b19412baed s3: lib: util: Add file_lines_ploadv().
       via  5c34fa0b85e lib: util: Add file_ploadv().
       via  f20538de041 lib: popen: Prepare to remove sys_popen().
      from  77117a14b91 docs: Add another dns forwarder in the example.

https://git.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 77eabd74e9a28b1e6decf0890a9ef4c83fa002d4
Author: Jeremy Allison <[email protected]>
Date:   Sat May 18 11:41:56 2019 -0700

    docs: dfree command. Correct usage of dfree scripts.
    
    Add quotes to the sample scripts to prevent incorrect
    parameter usage.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13964
    
    Signed-off-by: Jeremy Allison <[email protected]>
    Reviewed-by: Ralph Boehme <[email protected]>
    
    Autobuild-User(master): Jeremy Allison <[email protected]>
    Autobuild-Date(master): Fri May 24 20:12:02 UTC 2019 on sn-devel-184

commit 9fa95d5b45369acfdd38923e8618e94e5d04b07e
Author: Jeremy Allison <[email protected]>
Date:   Sat May 18 11:40:26 2019 -0700

    lib: util: Finally remove possibilities of using sys_popen() unsafely.
    
    All code now uses sys_popenv() which is much
    harder to use incorrectly.
    
    Remove the extract_args() function that was the
    cause of possible issues.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13964
    
    Signed-off-by: Jeremy Allison <[email protected]>
    Reviewed-by: Ralph Boehme <[email protected]>

commit dbfa3cd186428c02589aa9093e868554b4c695d5
Author: Ralph Boehme <[email protected]>
Date:   Fri May 24 19:08:10 2019 +0200

    s3: lib: Rename all uses of file_pload_XXX -> file_ploadv_XXX.
    
    Keep naming consistent across all usage.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13964
    
    Signed-off-by: Jeremy Allison <[email protected]>
    Reviewed-by: Ralph Boehme <[email protected]>

commit d5c363d65d771c792523f2f3e526c90514212fc2
Author: Jeremy Allison <[email protected]>
Date:   Sat May 18 11:32:05 2019 -0700

    s3: lib: Remove file_pload_send().
    
    No longer used.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13964
    
    Signed-off-by: Jeremy Allison <[email protected]>
    Reviewed-by: Ralph Boehme <[email protected]>

commit 449d49946b295f574e1fed83b5a5ffbf1c1b1e30
Author: Jeremy Allison <[email protected]>
Date:   Sat May 18 11:25:01 2019 -0700

    s3: winbind: Convert idmap to use file_ploadv_send().
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13964
    
    Signed-off-by: Jeremy Allison <[email protected]>
    Reviewed-by: Ralph Boehme <[email protected]>

commit 61054e53f53e5884902b566b1f9b454a3ff4741f
Author: Jeremy Allison <[email protected]>
Date:   Sat May 18 11:18:19 2019 -0700

    s3: lib: Add file_ploadv_send().
    
    Not yet used. Preparing to remove file_pload_send()
    with this safer alternative.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13964
    
    Signed-off-by: Jeremy Allison <[email protected]>
    Reviewed-by: Ralph Boehme <[email protected]>

commit c5729ae44219ec81008040d4d50f0f5fdf254201
Author: Jeremy Allison <[email protected]>
Date:   Sat May 18 11:14:53 2019 -0700

    lib: util: Remove file_pload()
    
    No longer used.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13964
    
    Signed-off-by: Jeremy Allison <[email protected]>
    Reviewed-by: Ralph Boehme <[email protected]>

commit 02bc0ce9d22117b464bae47c5d09c45b4f7c2272
Author: Jeremy Allison <[email protected]>
Date:   Sat May 18 11:10:40 2019 -0700

    s3: lib: Remove file_lines_pload().
    
    No longer used.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13964
    
    Signed-off-by: Jeremy Allison <[email protected]>
    Reviewed-by: Ralph Boehme <[email protected]>

commit 4a63e3b9659c8715d436c66dee8bf420e2ea89fb
Author: Jeremy Allison <[email protected]>
Date:   Sat May 18 11:08:15 2019 -0700

    s3: smbd: Convert sysquotas.c code to use file_lines_ploadv().
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13964
    
    Signed-off-by: Jeremy Allison <[email protected]>
    Reviewed-by: Ralph Boehme <[email protected]>

commit f9ccf1cc3df13138a1a4b645c8190238ce011f04
Author: Jeremy Allison <[email protected]>
Date:   Thu May 16 22:18:40 2019 -0700

    s3: smbd: Convert print_svid code to use file_lines_ploadv().
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13964
    
    Signed-off-by: Jeremy Allison <[email protected]>
    Reviewed-by: Ralph Boehme <[email protected]>

commit d6453e1ffd92c7754862389a933a9fd9089ce518
Author: Jeremy Allison <[email protected]>
Date:   Thu May 16 22:11:49 2019 -0700

    s3: smbd: Convert dfree code to use file_lines_ploadv().
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13964
    
    Signed-off-by: Jeremy Allison <[email protected]>
    Reviewed-by: Ralph Boehme <[email protected]>

commit 3b19412baedfffb7adc2a79471f5b17990259c31
Author: Jeremy Allison <[email protected]>
Date:   Thu May 16 22:10:51 2019 -0700

    s3: lib: util: Add file_lines_ploadv().
    
    Not yet used.
    
    Duplicate code to file_lines_pload() except uses vectored
    argument list. file_lines_pload() will be removed once all
    callers are converted.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13964
    
    Signed-off-by: Jeremy Allison <[email protected]>
    Reviewed-by: Ralph Boehme <[email protected]>

commit 5c34fa0b85e4d9a3c5fd4fa0b39af4772ec023db
Author: Jeremy Allison <[email protected]>
Date:   Thu May 16 21:56:13 2019 -0700

    lib: util: Add file_ploadv().
    
    Not yet used.
    
    Duplicate code to file_pload() except uses vectored
    argument list. file_pload() will be removed once all
    callers are converted.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13964
    
    Signed-off-by: Jeremy Allison <[email protected]>
    Reviewed-by: Ralph Boehme <[email protected]>

commit f20538de041eed1cadbabe2149b2b7cfcb779cb5
Author: Jeremy Allison <[email protected]>
Date:   Thu May 16 21:45:21 2019 -0700

    lib: popen: Prepare to remove sys_popen().
    
    Add sys_popenv(char * const argl[]) that uses a NULL
    terminated vector array of args. Change sys_popen() to
    split up its command string and call sys_popenv().
    
    Once all callers are converted to sys_popenv() we
    can remove sys_popen().
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13964
    
    Signed-off-by: Jeremy Allison <[email protected]>
    Reviewed-by: Ralph Boehme <[email protected]>

-----------------------------------------------------------------------

Summary of changes:
 docs-xml/smbdotconf/misc/dfreecommand.xml |   6 +-
 lib/util/samba_util.h                     |   2 +-
 lib/util/sys_popen.c                      | 104 +++---------------------
 lib/util/sys_popen.h                      |   2 +-
 lib/util/util_file.c                      |  20 ++---
 source3/lib/sysquotas.c                   | 126 +++++++++++++++++++++++++-----
 source3/lib/util_file.c                   |  45 +++++------
 source3/lib/util_file.h                   |  10 +--
 source3/printing/print_svid.c             |  29 ++++++-
 source3/smbd/dfree.c                      |  35 ++++++---
 source3/winbindd/idmap_script.c           |  61 +++++++++++----
 11 files changed, 260 insertions(+), 180 deletions(-)


Changeset truncated at 500 lines:

diff --git a/docs-xml/smbdotconf/misc/dfreecommand.xml 
b/docs-xml/smbdotconf/misc/dfreecommand.xml
index a678bb44adf..a1eed4948a6 100644
--- a/docs-xml/smbdotconf/misc/dfreecommand.xml
+++ b/docs-xml/smbdotconf/misc/dfreecommand.xml
@@ -40,14 +40,16 @@
        Where the script dfree (which must be made executable) could be:
 <programlisting format="linespecific"> 
 #!/bin/sh
-df $1 | tail -1 | awk '{print $(NF-4),$(NF-2)}'
+df "$1" | tail -1 | awk '{print $(NF-4),$(NF-2)}'
 </programlisting>
        or perhaps (on Sys V based systems):
 <programlisting format="linespecific"> 
 #!/bin/sh
-/usr/bin/df -k $1 | tail -1 | awk '{print $3&quot; &quot;$5}'
+/usr/bin/df -k "$1" | tail -1 | awk '{print $3&quot; &quot;$5}'
 </programlisting>
        Note that you may have to replace the command names with full path 
names on some systems.
+       Also note the arguments passed into the script should be quoted inside 
the script in case they
+       contain special characters such as spaces or newlines.
        </para>
 
        <para>
diff --git a/lib/util/samba_util.h b/lib/util/samba_util.h
index 0722426216e..f0aa42e7271 100644
--- a/lib/util/samba_util.h
+++ b/lib/util/samba_util.h
@@ -404,7 +404,7 @@ bool file_compare(const char *path1, const char *path2);
 /*
   load from a pipe into memory.
  */
-char *file_pload(const char *syscmd, size_t *size);
+char *file_ploadv(char * const argl[], size_t *size);
 
 /* The following definitions come from lib/util/util.c  */
 
diff --git a/lib/util/sys_popen.c b/lib/util/sys_popen.c
index 709f1822f33..659e99ba736 100644
--- a/lib/util/sys_popen.c
+++ b/lib/util/sys_popen.c
@@ -24,77 +24,6 @@
 #include "lib/util/sys_popen.h"
 #include "lib/util/debug.h"
 
-/**************************************************************************
- Extract a command into an arg list.
-****************************************************************************/
-
-static char **extract_args(TALLOC_CTX *mem_ctx, const char *command)
-{
-       char *trunc_cmd;
-       char *saveptr;
-       char *ptr;
-       int argcl;
-       char **argl = NULL;
-       int i;
-
-       if (!(trunc_cmd = talloc_strdup(mem_ctx, command))) {
-               DEBUG(0, ("talloc failed\n"));
-               goto nomem;
-       }
-
-       if(!(ptr = strtok_r(trunc_cmd, " \t", &saveptr))) {
-               TALLOC_FREE(trunc_cmd);
-               errno = EINVAL;
-               return NULL;
-       }
-
-       /*
-        * Count the args.
-        */
-
-       for( argcl = 1; ptr; ptr = strtok_r(NULL, " \t", &saveptr))
-               argcl++;
-
-       TALLOC_FREE(trunc_cmd);
-
-       if (!(argl = talloc_array(mem_ctx, char *, argcl + 1))) {
-               goto nomem;
-       }
-
-       /*
-        * Now do the extraction.
-        */
-
-       if (!(trunc_cmd = talloc_strdup(mem_ctx, command))) {
-               goto nomem;
-       }
-
-       ptr = strtok_r(trunc_cmd, " \t", &saveptr);
-       i = 0;
-
-       if (!(argl[i++] = talloc_strdup(argl, ptr))) {
-               goto nomem;
-       }
-
-       while((ptr = strtok_r(NULL, " \t", &saveptr)) != NULL) {
-
-               if (!(argl[i++] = talloc_strdup(argl, ptr))) {
-                       goto nomem;
-               }
-       }
-
-       argl[i++] = NULL;
-       TALLOC_FREE(trunc_cmd);
-       return argl;
-
- nomem:
-       DEBUG(0, ("talloc failed\n"));
-       TALLOC_FREE(trunc_cmd);
-       TALLOC_FREE(argl);
-       errno = ENOMEM;
-       return NULL;
-}
-
 /**************************************************************************
  Wrapper for popen. Safer as it doesn't search a path.
  Modified from the glibc sources.
@@ -110,14 +39,19 @@ typedef struct _popen_list
 
 static popen_list *popen_chain;
 
-int sys_popen(const char *command)
+int sys_popenv(char * const argl[])
 {
        int parent_end, child_end;
        int pipe_fds[2];
        popen_list *entry = NULL;
-       char **argl = NULL;
+       const char *command = argl[0];
        int ret;
 
+       if (argl == NULL) {
+               errno = EINVAL;
+               return -1;
+       }
+
        if (!*command) {
                errno = EINVAL;
                return -1;
@@ -125,8 +59,8 @@ int sys_popen(const char *command)
 
        ret = pipe(pipe_fds);
        if (ret < 0) {
-               DEBUG(0, ("sys_popen: error opening pipe: %s\n",
-                         strerror(errno)));
+               DBG_ERR("error opening pipe: %s\n",
+                         strerror(errno));
                return -1;
        }
 
@@ -135,24 +69,14 @@ int sys_popen(const char *command)
 
        entry = talloc_zero(NULL, popen_list);
        if (entry == NULL) {
-               DEBUG(0, ("sys_popen: malloc failed\n"));
-               goto err_exit;
-       }
-
-       /*
-        * Extract the command and args into a NULL terminated array.
-        */
-
-       argl = extract_args(NULL, command);
-       if (argl == NULL) {
-               DEBUG(0, ("sys_popen: extract_args() failed: %s\n", 
strerror(errno)));
+               DBG_ERR("talloc failed\n");
                goto err_exit;
        }
 
        entry->child_pid = fork();
 
        if (entry->child_pid == -1) {
-               DEBUG(0, ("sys_popen: fork failed: %s\n", strerror(errno)));
+               DBG_ERR("fork failed: %s\n", strerror(errno));
                goto err_exit;
        }
 
@@ -182,8 +106,8 @@ int sys_popen(const char *command)
 
                ret = execv(argl[0], argl);
                if (ret == -1) {
-                       DEBUG(0, ("sys_popen: ERROR executing command "
-                                 "'%s': %s\n", command, strerror(errno)));
+                       DBG_ERR("ERROR executing command "
+                         "'%s': %s\n", command, strerror(errno));
                }
                _exit (127);
        }
@@ -193,7 +117,6 @@ int sys_popen(const char *command)
         */
 
        close (child_end);
-       TALLOC_FREE(argl);
 
        /* Link into popen_chain. */
        entry->next = popen_chain;
@@ -205,7 +128,6 @@ int sys_popen(const char *command)
 err_exit:
 
        TALLOC_FREE(entry);
-       TALLOC_FREE(argl);
        close(pipe_fds[0]);
        close(pipe_fds[1]);
        return -1;
diff --git a/lib/util/sys_popen.h b/lib/util/sys_popen.h
index 6807d3c5061..be437483626 100644
--- a/lib/util/sys_popen.h
+++ b/lib/util/sys_popen.h
@@ -20,7 +20,7 @@
 #ifndef __LIB_SYS_POPEN_H__
 #define __LIB_SYS_POPEN_H__
 
-int sys_popen(const char *command);
+int sys_popenv(char * const argl[]);
 int sys_pclose(int fd);
 
 #endif
diff --git a/lib/util/util_file.c b/lib/util/util_file.c
index 7a8644e3f5d..79276153015 100644
--- a/lib/util/util_file.c
+++ b/lib/util/util_file.c
@@ -398,29 +398,27 @@ bool file_compare(const char *path1, const char *path2)
        return true;
 }
 
-
 /**
  Load from a pipe into memory.
 **/
-char *file_pload(const char *syscmd, size_t *size)
+char *file_ploadv(char * const argl[], size_t *size)
 {
        int fd, n;
-       char *p;
+       char *p = NULL;
        char buf[1024];
        size_t total;
 
-       fd = sys_popen(syscmd);
+       fd = sys_popenv(argl);
        if (fd == -1) {
                return NULL;
        }
 
-       p = NULL;
        total = 0;
 
        while ((n = sys_read(fd, buf, sizeof(buf))) > 0) {
                p = talloc_realloc(NULL, p, char, total + n + 1);
-               if (!p) {
-                       DEBUG(0,("file_pload: failed to expand buffer!\n"));
+               if (p == NULL) {
+                       DBG_ERR("failed to expand buffer!\n");
                        close(fd);
                        return NULL;
                }
@@ -428,13 +426,15 @@ char *file_pload(const char *syscmd, size_t *size)
                total += n;
        }
 
-       if (p) {
+       if (p != NULL) {
                p[total] = 0;
        }
 
-       /* FIXME: Perhaps ought to check that the command completed
+       /*
+        * FIXME: Perhaps ought to check that the command completed
         * successfully (returned 0); if not the data may be
-        * truncated. */
+        * truncated.
+        */
        sys_pclose(fd);
 
        if (size) {
diff --git a/source3/lib/sysquotas.c b/source3/lib/sysquotas.c
index 43a451da596..864d9dd5c56 100644
--- a/source3/lib/sysquotas.c
+++ b/source3/lib/sysquotas.c
@@ -251,9 +251,9 @@ static int command_get_quota(const char *path, enum 
SMB_QUOTA_TYPE qtype, unid_t
        if (get_quota_command && *get_quota_command) {
                const char *p;
                char *p2;
-               char *syscmd = NULL;
                int _id = -1;
                int error = 0;
+               char **argl = NULL;
 
                switch(qtype) {
                        case SMB_USER_QUOTA_TYPE:
@@ -269,15 +269,40 @@ static int command_get_quota(const char *path, enum 
SMB_QUOTA_TYPE qtype, unid_t
                                return -1;
                }
 
-               if (asprintf(&syscmd, "%s %s %d %d",
-                       get_quota_command, path, qtype, _id) < 0) {
+               argl = talloc_zero_array(talloc_tos(), char *, 5);
+               if (argl == NULL) {
                        return -1;
                }
+               argl[0] = talloc_strdup(argl, get_quota_command);
+               if (argl[0] == NULL) {
+                       TALLOC_FREE(argl);
+                       return -1;
+               }
+               argl[1] = talloc_strdup(argl, path);
+               if (argl[1] == NULL) {
+                       TALLOC_FREE(argl);
+                       return -1;
+               }
+               argl[2] = talloc_asprintf(argl, "%d", qtype);
+               if (argl[2] == NULL) {
+                       TALLOC_FREE(argl);
+                       return -1;
+               }
+               argl[3] = talloc_asprintf(argl, "%d", _id);
+               if (argl[3] == NULL) {
+                       TALLOC_FREE(argl);
+                       return -1;
+               }
+               argl[4] = NULL;
 
-               DEBUG (3, ("get_quota: Running command %s\n", syscmd));
+               DBG_NOTICE("Running command %s %s %d %d\n",
+                       get_quota_command,
+                       path,
+                       qtype,
+                       _id);
 
-               lines = file_lines_pload(talloc_tos(), syscmd, NULL);
-               SAFE_FREE(syscmd);
+               lines = file_lines_ploadv(talloc_tos(), argl, NULL);
+               TALLOC_FREE(argl);
 
                if (lines) {
                        char *line = lines[0];
@@ -399,8 +424,8 @@ static int command_set_quota(const char *path, enum 
SMB_QUOTA_TYPE qtype, unid_t
        set_quota_command = lp_set_quota_command(talloc_tos());
        if (set_quota_command && *set_quota_command) {
                char **lines = NULL;
-               char *syscmd = NULL;
                int _id = -1;
+               char **argl = NULL;
 
                switch(qtype) {
                        case SMB_USER_QUOTA_TYPE:
@@ -415,21 +440,84 @@ static int command_set_quota(const char *path, enum 
SMB_QUOTA_TYPE qtype, unid_t
                                return -1;
                }
 
-               if (asprintf(&syscmd,
-                       "%s %s %d %d "
-                       "%u %llu %llu "
-                       "%llu %llu %llu ",
-                       set_quota_command, path, qtype, _id, dp->qflags,
-                       (long long unsigned)dp->softlimit,(long long 
unsigned)dp->hardlimit,
-                       (long long unsigned)dp->isoftlimit,(long long 
unsigned)dp->ihardlimit,
-                       (long long unsigned)dp->bsize) < 0) {
+               argl = talloc_zero_array(talloc_tos(), char *, 11);
+               if (argl == NULL) {
                        return -1;
                }
+               argl[0] = talloc_strdup(argl, set_quota_command);
+               if (argl[0] == NULL) {
+                       TALLOC_FREE(argl);
+                       return -1;
+               }
+               argl[1] = talloc_strdup(argl, path);
+               if (argl[1] == NULL) {
+                       TALLOC_FREE(argl);
+                       return -1;
+               }
+               argl[2] = talloc_asprintf(argl, "%d", qtype);
+               if (argl[2] == NULL) {
+                       TALLOC_FREE(argl);
+                       return -1;
+               }
+               argl[3] = talloc_asprintf(argl, "%d", _id);
+               if (argl[3] == NULL) {
+                       TALLOC_FREE(argl);
+                       return -1;
+               }
+               argl[4] = talloc_asprintf(argl, "%u", dp->qflags);
+               if (argl[4] == NULL) {
+                       TALLOC_FREE(argl);
+                       return -1;
+               }
+               argl[5] = talloc_asprintf(argl, "%llu",
+                               (long long unsigned)dp->softlimit);
+               if (argl[5] == NULL) {
+                       TALLOC_FREE(argl);
+                       return -1;
+               }
+               argl[6] = talloc_asprintf(argl, "%llu",
+                               (long long unsigned)dp->hardlimit);
+               if (argl[6] == NULL) {
+                       TALLOC_FREE(argl);
+                       return -1;
+               }
+               argl[7] = talloc_asprintf(argl, "%llu",
+                               (long long unsigned)dp->isoftlimit);
+               if (argl[7] == NULL) {
+                       TALLOC_FREE(argl);
+                       return -1;
+               }
+               argl[8] = talloc_asprintf(argl, "%llu",
+                               (long long unsigned)dp->ihardlimit);
+               if (argl[8] == NULL) {
+                       TALLOC_FREE(argl);
+                       return -1;
+               }
+               argl[9] = talloc_asprintf(argl, "%llu",
+                               (long long unsigned)dp->bsize);
+               if (argl[9] == NULL) {
+                       TALLOC_FREE(argl);
+                       return -1;
+               }
+               argl[10] = NULL;
 
-               DBG_NOTICE("set_quota: Running command %s\n", syscmd);
-
-               lines = file_lines_pload(talloc_tos(), syscmd, NULL);
-               SAFE_FREE(syscmd);
+               DBG_NOTICE("Running command "
+                       "%s %s %d %d "
+                       "%u %llu %llu "
+                       "%llu %llu %llu ",
+                       set_quota_command,
+                       path,
+                       qtype,
+                       _id,
+                       dp->qflags,
+                       (long long unsigned)dp->softlimit,
+                       (long long unsigned)dp->hardlimit,
+                       (long long unsigned)dp->isoftlimit,
+                       (long long unsigned)dp->ihardlimit,
+                       (long long unsigned)dp->bsize);
+
+               lines = file_lines_ploadv(talloc_tos(), argl, NULL);
+               TALLOC_FREE(argl);
                if (lines) {
                        char *line = lines[0];
 
diff --git a/source3/lib/util_file.c b/source3/lib/util_file.c
index cfbcf278caa..1c468ea5501 100644
--- a/source3/lib/util_file.c
+++ b/source3/lib/util_file.c
@@ -26,46 +26,46 @@
 #include "lib/async_req/async_sock.h"
 #include "lib/util/tevent_unix.h"
 
-struct file_pload_state {
+struct file_ploadv_state {
        struct tevent_context *ev;
        size_t maxsize;
        int fd;
        uint8_t *buf;
 };
 
-static int file_pload_state_destructor(struct file_pload_state *s);
-static void file_pload_readable(struct tevent_req *subreq);
+static int file_ploadv_state_destructor(struct file_ploadv_state *s);
+static void file_ploadv_readable(struct tevent_req *subreq);
 
-struct tevent_req *file_pload_send(TALLOC_CTX *mem_ctx,
+struct tevent_req *file_ploadv_send(TALLOC_CTX *mem_ctx,
                                   struct tevent_context *ev,
-                                  const char *syscmd, size_t maxsize)
+                                  char * const argl[], size_t maxsize)
 {
-       struct tevent_req *req, *subreq;
-       struct file_pload_state *state;
+       struct tevent_req *req = NULL, *subreq = NULL;
+       struct file_ploadv_state *state = NULL;
 
-       req = tevent_req_create(mem_ctx, &state, struct file_pload_state);
+       req = tevent_req_create(mem_ctx, &state, struct file_ploadv_state);
        if (req == NULL) {
                return NULL;
        }
        state->ev = ev;
        state->maxsize = maxsize;
 
-       state->fd = sys_popen(syscmd);
+       state->fd = sys_popenv(argl);
        if (state->fd == -1) {
                tevent_req_error(req, errno);
                return tevent_req_post(req, ev);
        }
-       talloc_set_destructor(state, file_pload_state_destructor);
+       talloc_set_destructor(state, file_ploadv_state_destructor);
 
        subreq = wait_for_read_send(state, state->ev, state->fd, false);
        if (tevent_req_nomem(subreq, req)) {
                return tevent_req_post(req, ev);
        }
-       tevent_req_set_callback(subreq, file_pload_readable, req);
+       tevent_req_set_callback(subreq, file_ploadv_readable, req);
        return req;


-- 
Samba Shared Repository

Reply via email to