Fossil SCM
Do not prompt for the sync password more than once.
Commit
1cd61c96bcfa53433d724c18f7c312f0f18db0fc
Parent
871a949296b6325…
1 file changed
+6
-1
+6
-1
| --- src/url.c | ||
| +++ src/url.c | ||
| @@ -26,10 +26,11 @@ | ||
| 26 | 26 | */ |
| 27 | 27 | #define URL_PROMPT_PW 0x001 /* Prompt for password if needed */ |
| 28 | 28 | #define URL_REMEMBER 0x002 /* Remember the url for later reuse */ |
| 29 | 29 | #define URL_ASK_REMEMBER_PW 0x004 /* Ask whether to remember prompted pw */ |
| 30 | 30 | #define URL_REMEMBER_PW 0x008 /* Should remember pw */ |
| 31 | +#define URL_PROMPTED 0x010 /* Prompted for PW already */ | |
| 31 | 32 | |
| 32 | 33 | #endif /* INTERFACE */ |
| 33 | 34 | |
| 34 | 35 | |
| 35 | 36 | /* |
| @@ -428,18 +429,22 @@ | ||
| 428 | 429 | /* |
| 429 | 430 | ** Prompt the user for the password for g.urlUser. Store the result |
| 430 | 431 | ** in g.urlPasswd. |
| 431 | 432 | */ |
| 432 | 433 | void url_prompt_for_password(void){ |
| 433 | - if( isatty(fileno(stdin)) && (g.urlFlags & URL_PROMPT_PW)!=0 ){ | |
| 434 | + if( isatty(fileno(stdin)) | |
| 435 | + && (g.urlFlags & URL_PROMPT_PW)!=0 | |
| 436 | + && (g.urlFlags & URL_PROMPTED)==0 | |
| 437 | + ){ | |
| 434 | 438 | char *zPrompt = mprintf("\rpassword for %s: ", g.urlUser); |
| 435 | 439 | Blob x; |
| 436 | 440 | fossil_force_newline(); |
| 437 | 441 | prompt_for_password(zPrompt, &x, 0); |
| 438 | 442 | free(zPrompt); |
| 439 | 443 | g.urlPasswd = mprintf("%b", &x); |
| 440 | 444 | blob_reset(&x); |
| 445 | + g.urlFlags |= URL_PROMPTED; | |
| 441 | 446 | if( g.urlPasswd[0] |
| 442 | 447 | && (g.urlFlags & (URL_REMEMBER|URL_ASK_REMEMBER_PW))!=0 |
| 443 | 448 | ){ |
| 444 | 449 | char c; |
| 445 | 450 | prompt_user("remember password (Y/n)? ", &x); |
| 446 | 451 |
| --- src/url.c | |
| +++ src/url.c | |
| @@ -26,10 +26,11 @@ | |
| 26 | */ |
| 27 | #define URL_PROMPT_PW 0x001 /* Prompt for password if needed */ |
| 28 | #define URL_REMEMBER 0x002 /* Remember the url for later reuse */ |
| 29 | #define URL_ASK_REMEMBER_PW 0x004 /* Ask whether to remember prompted pw */ |
| 30 | #define URL_REMEMBER_PW 0x008 /* Should remember pw */ |
| 31 | |
| 32 | #endif /* INTERFACE */ |
| 33 | |
| 34 | |
| 35 | /* |
| @@ -428,18 +429,22 @@ | |
| 428 | /* |
| 429 | ** Prompt the user for the password for g.urlUser. Store the result |
| 430 | ** in g.urlPasswd. |
| 431 | */ |
| 432 | void url_prompt_for_password(void){ |
| 433 | if( isatty(fileno(stdin)) && (g.urlFlags & URL_PROMPT_PW)!=0 ){ |
| 434 | char *zPrompt = mprintf("\rpassword for %s: ", g.urlUser); |
| 435 | Blob x; |
| 436 | fossil_force_newline(); |
| 437 | prompt_for_password(zPrompt, &x, 0); |
| 438 | free(zPrompt); |
| 439 | g.urlPasswd = mprintf("%b", &x); |
| 440 | blob_reset(&x); |
| 441 | if( g.urlPasswd[0] |
| 442 | && (g.urlFlags & (URL_REMEMBER|URL_ASK_REMEMBER_PW))!=0 |
| 443 | ){ |
| 444 | char c; |
| 445 | prompt_user("remember password (Y/n)? ", &x); |
| 446 |
| --- src/url.c | |
| +++ src/url.c | |
| @@ -26,10 +26,11 @@ | |
| 26 | */ |
| 27 | #define URL_PROMPT_PW 0x001 /* Prompt for password if needed */ |
| 28 | #define URL_REMEMBER 0x002 /* Remember the url for later reuse */ |
| 29 | #define URL_ASK_REMEMBER_PW 0x004 /* Ask whether to remember prompted pw */ |
| 30 | #define URL_REMEMBER_PW 0x008 /* Should remember pw */ |
| 31 | #define URL_PROMPTED 0x010 /* Prompted for PW already */ |
| 32 | |
| 33 | #endif /* INTERFACE */ |
| 34 | |
| 35 | |
| 36 | /* |
| @@ -428,18 +429,22 @@ | |
| 429 | /* |
| 430 | ** Prompt the user for the password for g.urlUser. Store the result |
| 431 | ** in g.urlPasswd. |
| 432 | */ |
| 433 | void url_prompt_for_password(void){ |
| 434 | if( isatty(fileno(stdin)) |
| 435 | && (g.urlFlags & URL_PROMPT_PW)!=0 |
| 436 | && (g.urlFlags & URL_PROMPTED)==0 |
| 437 | ){ |
| 438 | char *zPrompt = mprintf("\rpassword for %s: ", g.urlUser); |
| 439 | Blob x; |
| 440 | fossil_force_newline(); |
| 441 | prompt_for_password(zPrompt, &x, 0); |
| 442 | free(zPrompt); |
| 443 | g.urlPasswd = mprintf("%b", &x); |
| 444 | blob_reset(&x); |
| 445 | g.urlFlags |= URL_PROMPTED; |
| 446 | if( g.urlPasswd[0] |
| 447 | && (g.urlFlags & (URL_REMEMBER|URL_ASK_REMEMBER_PW))!=0 |
| 448 | ){ |
| 449 | char c; |
| 450 | prompt_user("remember password (Y/n)? ", &x); |
| 451 |