s3:client:Use DEVICE_URI, instead of argv[0],for Device URI
[samba.git] / 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,