| | @@ -69,14 +69,25 @@ |
| 69 | 69 | azOther = fossil_realloc(azOther, sizeof(*azOther)*(nOther+1)); |
| 70 | 70 | azOther[nOther++] = fossil_strdup(zUrl); |
| 71 | 71 | } |
| 72 | 72 | db_finalize(&q); |
| 73 | 73 | for(i=0; i<nOther; i++){ |
| 74 | + int rc; |
| 74 | 75 | url_unparse(&g.url); |
| 75 | | - url_parse(azOther[i], URL_PROMPT_PW); |
| 76 | + url_parse(azOther[i], URL_PROMPT_PW|URL_ASK_REMEMBER_PW); |
| 76 | 77 | sync_explain(syncFlags); |
| 77 | | - nErr += client_sync(syncFlags, configRcvMask, configSendMask, zAltPCode); |
| 78 | + rc = client_sync(syncFlags, configRcvMask, configSendMask, zAltPCode); |
| 79 | + nErr += rc; |
| 80 | + if( (g.url.flags & URL_REMEMBER_PW)!=0 && rc==0 ){ |
| 81 | + char *zKey = mprintf("sync-pw:%s", azOther[i]); |
| 82 | + char *zPw = obscure(g.url.passwd); |
| 83 | + if( zPw && zPw[0] ){ |
| 84 | + db_set(zKey/*works-like:""*/, zPw, 0); |
| 85 | + } |
| 86 | + fossil_free(zPw); |
| 87 | + fossil_free(zKey); |
| 88 | + } |
| 78 | 89 | fossil_free(azOther[i]); |
| 79 | 90 | azOther[i] = 0; |
| 80 | 91 | } |
| 81 | 92 | fossil_free(azOther); |
| 82 | 93 | return nErr; |
| | @@ -466,10 +477,16 @@ |
| 466 | 477 | ** "fossil remote NAME" to select a previously-set named URL. |
| 467 | 478 | ** |
| 468 | 479 | ** To disable use of the default remote without forgetting its URL, |
| 469 | 480 | ** say "fossil set autosync 0" instead. |
| 470 | 481 | ** |
| 482 | +** > fossil remote scrub |
| 483 | +** |
| 484 | +** Forget any saved passwords for remote repositories, but continue |
| 485 | +** to remember the URLs themselves. You will be prompted for the |
| 486 | +** password the next time it is needed. |
| 487 | +** |
| 471 | 488 | ** > fossil remote REF |
| 472 | 489 | ** |
| 473 | 490 | ** Make REF the new default URL, replacing the prior default. |
| 474 | 491 | ** REF may be a URL or a NAME from a prior "add". |
| 475 | 492 | */ |
| | @@ -559,10 +576,20 @@ |
| 559 | 576 | db_multi_exec("DELETE FROM config WHERE name glob 'sync-url:%q'", zName); |
| 560 | 577 | db_multi_exec("DELETE FROM config WHERE name glob 'sync-pw:%q'", zName); |
| 561 | 578 | db_protect_pop(); |
| 562 | 579 | db_commit_transaction(); |
| 563 | 580 | return; |
| 581 | + } |
| 582 | + if( strncmp(zArg, "scrub", nArg)==0 ){ |
| 583 | + if( g.argc!=3 ) usage("scrub"); |
| 584 | + db_begin_write(); |
| 585 | + db_unprotect(PROTECT_CONFIG); |
| 586 | + db_multi_exec("DELETE FROM config WHERE name glob 'sync-pw:*'"); |
| 587 | + db_multi_exec("DELETE FROM config WHERE name = 'last-sync-pw'"); |
| 588 | + db_protect_pop(); |
| 589 | + db_commit_transaction(); |
| 590 | + return; |
| 564 | 591 | } |
| 565 | 592 | if( sqlite3_strlike("http://%",zArg,0)==0 |
| 566 | 593 | || sqlite3_strlike("https://%",zArg,0)==0 |
| 567 | 594 | || sqlite3_strlike("ssh:%",zArg,0)==0 |
| 568 | 595 | || sqlite3_strlike("file:%",zArg,0)==0 |
| 569 | 596 | |