s3:client:Use DEVICE_URI, instead of argv[0],for Device URI
authorBryan Mason <bmason@redhat.com>
Mon, 16 Sep 2019 19:35:06 +0000 (12:35 -0700)
committerAndreas Schneider <asn@cryptomilk.org>
Wed, 18 Sep 2019 12:31:10 +0000 (12:31 +0000)
CUPS sanitizes argv[0] by removing username/password, so use
DEVICE_URI environment variable first.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14128

Signed-off-by: Bryan Mason <bmason@redhat.com>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Wed Sep 18 12:31:11 UTC 2019 on sn-devel-184

source3/client/smbspool.c

index ad988eb0df944b9e9b1bd83305949901b2dfde73..36f7f67ca94ade6d822b85210ece0eb0e70b8f44 100644 (file)
@@ -256,13 +256,15 @@ main(int argc,                    /* I - Number of command-line arguments */
 
        /*
         * Find the URI ...
-        */
-       if (dev_uri == NULL) {
-               env = getenv("DEVICE_URI");
-               if (env != NULL && env[0] != '\0') {
-                       dev_uri = env;
-               }
-       }
+         *
+         * The URI in argv[0] is sanitized to remove username/password, so
+         * use DEVICE_URI if available. Otherwise keep the URI already
+         * discovered in argv.
+         */
+        env = getenv("DEVICE_URI");
+        if (env != NULL && env[0] != '\0') {
+          dev_uri = env;
+        }
 
        if (dev_uri == NULL) {
                fprintf(stderr,