s3: smbd: Convert print_svid code to use file_lines_ploadv().
authorJeremy Allison <jra@samba.org>
Fri, 17 May 2019 05:18:40 +0000 (22:18 -0700)
committerJeremy Allison <jra@samba.org>
Fri, 24 May 2019 19:00:05 +0000 (19:00 +0000)
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13964

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
source3/printing/print_svid.c

index f041ef482addb4606ad683b42f358b59ac979a62..d20fdad88e34dd7e2ed477fb0da3282f2cf285fc 100644 (file)
@@ -41,6 +41,7 @@ bool sysv_cache_reload(struct pcap_cache **_pcache)
        char **lines;
        int i;
        struct pcap_cache *pcache = NULL;
+       char **argl = NULL;
 
 #if defined(HPUX)
        DEBUG(5, ("reloading hpux printcap cache\n"));
@@ -48,7 +49,23 @@ bool sysv_cache_reload(struct pcap_cache **_pcache)
        DEBUG(5, ("reloading sysv printcap cache\n"));
 #endif
 
-       lines = file_lines_pload(talloc_tos(), "/usr/bin/lpstat -v", NULL);
+       argl = talloc_zero_array(talloc_tos(), char *, 3);
+       if (argl == NULL) {
+               return false;
+       }
+       argl[0] = talloc_strdup(argl, "/usr/bin/lpstat");
+       if (argl[0] == NULL) {
+               TALLOC_FREE(argl);
+               return false;
+       }
+       argl[1] = talloc_strdup(argl, "-v");
+       if (argl[1] == NULL) {
+               TALLOC_FREE(argl);
+               return false;
+       }
+       argl[2] = NULL;
+
+       lines = file_lines_ploadv(talloc_tos(), argl, NULL);
        if (lines == NULL) {
 #if defined(HPUX)
       
@@ -59,7 +76,14 @@ bool sysv_cache_reload(struct pcap_cache **_pcache)
                */
 
                char **scheduler;
-                scheduler = file_lines_pload("/usr/bin/lpstat -r", NULL);
+
+               argl[1] = talloc_strdup(argl, "-r");
+               if (argl[1] == NULL) {
+                       TALLOC_FREE(argl);
+                       return false;
+               }
+               scheduler = file_lines_ploadv(talloc_tos(), argl, NULL);
+               TALLOC_FREE(argl);
                 if(!strcmp(*scheduler,"scheduler is running")){
                         DEBUG(3,("No Printers found!!!\n"));
                        TALLOC_FREE(scheduler);
@@ -75,6 +99,7 @@ bool sysv_cache_reload(struct pcap_cache **_pcache)
                return False;
 #endif
        }
+       TALLOC_FREE(argl);
 
        for (i = 0; lines[i]; i++) {
                char *name, *tmp;