Fossil SCM
In the "remote-url" command, omit the userid and password from the URL unless the "--show-pw" command-line option is used.
Commit
9cbef7a104e5d6168895a1ab99ad0a68484be369
Parent
00ac7945a9ead72…
1 file changed
+15
-6
+15
-6
| --- src/sync.c | ||
| +++ src/sync.c | ||
| @@ -154,26 +154,26 @@ | ||
| 154 | 154 | } |
| 155 | 155 | |
| 156 | 156 | /* |
| 157 | 157 | ** COMMAND: remote-url |
| 158 | 158 | ** |
| 159 | -** Usage: %fossil remote-url ?URL|off? | |
| 159 | +** Usage: %fossil remote-url ?URL|off? --show-pw | |
| 160 | 160 | ** |
| 161 | 161 | ** Query and optional change the default server named used for syncing |
| 162 | 162 | ** the current check-out. |
| 163 | 163 | ** |
| 164 | -** WARNING: If the username and password are part of the URL then the | |
| 165 | -** username and password will be displayed by this command. The user | |
| 166 | -** name and password are normally suppressed when echoing the remote-url | |
| 167 | -** during an auto-sync. | |
| 164 | +** The userid and password are stripped from the URL and are not printed | |
| 165 | +** unless the --show-pw option is used on the command-line. | |
| 168 | 166 | ** |
| 169 | 167 | ** The remote-url is set automatically by a "clone" command or by any |
| 170 | 168 | ** "sync", "push", or "pull" command that specifies an explicit URL. |
| 171 | 169 | ** The default remote-url is used by auto-syncing and by "sync", "push", |
| 172 | 170 | ** "pull" that omit the server URL. |
| 173 | 171 | */ |
| 174 | 172 | void remote_url_cmd(void){ |
| 173 | + char *zUrl; | |
| 174 | + int showPw = find_option("show-pw",0,0)!=0; | |
| 175 | 175 | db_must_be_within_tree(); |
| 176 | 176 | if( g.argc!=2 && g.argc!=3 ){ |
| 177 | 177 | usage("remote-url ?URL|off?"); |
| 178 | 178 | } |
| 179 | 179 | if( g.argc==3 ){ |
| @@ -182,7 +182,16 @@ | ||
| 182 | 182 | }else{ |
| 183 | 183 | url_parse(g.argv[2]); |
| 184 | 184 | db_set("last-sync-url", g.urlCanonical, 0); |
| 185 | 185 | } |
| 186 | 186 | } |
| 187 | - printf("%s\n", db_get("last-sync-url", "off")); | |
| 187 | + zUrl = db_get("last-sync-url", 0); | |
| 188 | + if( zUrl==0 ){ | |
| 189 | + printf("off\n"); | |
| 190 | + return; | |
| 191 | + }else if( showPw ){ | |
| 192 | + g.urlCanonical = zUrl; | |
| 193 | + }else{ | |
| 194 | + url_parse(zUrl); | |
| 195 | + } | |
| 196 | + printf("%s\n", g.urlCanonical); | |
| 188 | 197 | } |
| 189 | 198 |
| --- src/sync.c | |
| +++ src/sync.c | |
| @@ -154,26 +154,26 @@ | |
| 154 | } |
| 155 | |
| 156 | /* |
| 157 | ** COMMAND: remote-url |
| 158 | ** |
| 159 | ** Usage: %fossil remote-url ?URL|off? |
| 160 | ** |
| 161 | ** Query and optional change the default server named used for syncing |
| 162 | ** the current check-out. |
| 163 | ** |
| 164 | ** WARNING: If the username and password are part of the URL then the |
| 165 | ** username and password will be displayed by this command. The user |
| 166 | ** name and password are normally suppressed when echoing the remote-url |
| 167 | ** during an auto-sync. |
| 168 | ** |
| 169 | ** The remote-url is set automatically by a "clone" command or by any |
| 170 | ** "sync", "push", or "pull" command that specifies an explicit URL. |
| 171 | ** The default remote-url is used by auto-syncing and by "sync", "push", |
| 172 | ** "pull" that omit the server URL. |
| 173 | */ |
| 174 | void remote_url_cmd(void){ |
| 175 | db_must_be_within_tree(); |
| 176 | if( g.argc!=2 && g.argc!=3 ){ |
| 177 | usage("remote-url ?URL|off?"); |
| 178 | } |
| 179 | if( g.argc==3 ){ |
| @@ -182,7 +182,16 @@ | |
| 182 | }else{ |
| 183 | url_parse(g.argv[2]); |
| 184 | db_set("last-sync-url", g.urlCanonical, 0); |
| 185 | } |
| 186 | } |
| 187 | printf("%s\n", db_get("last-sync-url", "off")); |
| 188 | } |
| 189 |
| --- src/sync.c | |
| +++ src/sync.c | |
| @@ -154,26 +154,26 @@ | |
| 154 | } |
| 155 | |
| 156 | /* |
| 157 | ** COMMAND: remote-url |
| 158 | ** |
| 159 | ** Usage: %fossil remote-url ?URL|off? --show-pw |
| 160 | ** |
| 161 | ** Query and optional change the default server named used for syncing |
| 162 | ** the current check-out. |
| 163 | ** |
| 164 | ** The userid and password are stripped from the URL and are not printed |
| 165 | ** unless the --show-pw option is used on the command-line. |
| 166 | ** |
| 167 | ** The remote-url is set automatically by a "clone" command or by any |
| 168 | ** "sync", "push", or "pull" command that specifies an explicit URL. |
| 169 | ** The default remote-url is used by auto-syncing and by "sync", "push", |
| 170 | ** "pull" that omit the server URL. |
| 171 | */ |
| 172 | void remote_url_cmd(void){ |
| 173 | char *zUrl; |
| 174 | int showPw = find_option("show-pw",0,0)!=0; |
| 175 | db_must_be_within_tree(); |
| 176 | if( g.argc!=2 && g.argc!=3 ){ |
| 177 | usage("remote-url ?URL|off?"); |
| 178 | } |
| 179 | if( g.argc==3 ){ |
| @@ -182,7 +182,16 @@ | |
| 182 | }else{ |
| 183 | url_parse(g.argv[2]); |
| 184 | db_set("last-sync-url", g.urlCanonical, 0); |
| 185 | } |
| 186 | } |
| 187 | zUrl = db_get("last-sync-url", 0); |
| 188 | if( zUrl==0 ){ |
| 189 | printf("off\n"); |
| 190 | return; |
| 191 | }else if( showPw ){ |
| 192 | g.urlCanonical = zUrl; |
| 193 | }else{ |
| 194 | url_parse(zUrl); |
| 195 | } |
| 196 | printf("%s\n", g.urlCanonical); |
| 197 | } |
| 198 |