Check-in [9cbef7a104]
Not logged in
Overview

SHA1 Hash:9cbef7a104e5d6168895a1ab99ad0a68484be369
Date: 2009-08-13 14:36:54
User: drh
Comment:In the "remote-url" command, omit the userid and password from the URL unless the "--show-pw" command-line option is used.
Timelines: ancestors | descendants | both | trunk
Other Links: files | ZIP archive | manifest

Tags And Properties
Changes
[hide diffs]

Modified src/sync.c from [5c954ccd14] to [5eb1f32d91].

@@ -154,26 +154,26 @@
 }
 
 /*
 ** COMMAND: remote-url
 **
-** Usage: %fossil remote-url ?URL|off?
+** Usage: %fossil remote-url ?URL|off? --show-pw
 **
 ** Query and optional change the default server named used for syncing
 ** the current check-out.
 **
-** WARNING: If the username and password are part of the URL then the
-** username and password will be displayed by this command.  The user
-** name and password are normally suppressed when echoing the remote-url
-** during an auto-sync.
+** The userid and password are stripped from the URL and are not printed
+** unless the --show-pw option is used on the command-line.
 **
 ** The remote-url is set automatically by a "clone" command or by any
 ** "sync", "push", or "pull" command that specifies an explicit URL.
 ** The default remote-url is used by auto-syncing and by "sync", "push",
 ** "pull" that omit the server URL.
 */
 void remote_url_cmd(void){
+  char *zUrl;
+  int showPw = find_option("show-pw",0,0)!=0;
   db_must_be_within_tree();
   if( g.argc!=2 && g.argc!=3 ){
     usage("remote-url ?URL|off?");
   }
   if( g.argc==3 ){
@@ -182,7 +182,16 @@
     }else{
       url_parse(g.argv[2]);
       db_set("last-sync-url", g.urlCanonical, 0);
     }
   }
-  printf("%s\n", db_get("last-sync-url", "off"));
+  zUrl = db_get("last-sync-url", 0);
+  if( zUrl==0 ){
+    printf("off\n");
+    return;
+  }else if( showPw ){
+    g.urlCanonical = zUrl;
+  }else{
+    url_parse(zUrl);
+  }
+  printf("%s\n", g.urlCanonical);
 }