Fossil SCM

Do not prompt for the sync password more than once.

drh 2013-02-21 14:54 trunk
Commit 1cd61c96bcfa53433d724c18f7c312f0f18db0fc
1 file changed +6 -1
+6 -1
--- src/url.c
+++ src/url.c
@@ -26,10 +26,11 @@
2626
*/
2727
#define URL_PROMPT_PW 0x001 /* Prompt for password if needed */
2828
#define URL_REMEMBER 0x002 /* Remember the url for later reuse */
2929
#define URL_ASK_REMEMBER_PW 0x004 /* Ask whether to remember prompted pw */
3030
#define URL_REMEMBER_PW 0x008 /* Should remember pw */
31
+#define URL_PROMPTED 0x010 /* Prompted for PW already */
3132
3233
#endif /* INTERFACE */
3334
3435
3536
/*
@@ -428,18 +429,22 @@
428429
/*
429430
** Prompt the user for the password for g.urlUser. Store the result
430431
** in g.urlPasswd.
431432
*/
432433
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
+ ){
434438
char *zPrompt = mprintf("\rpassword for %s: ", g.urlUser);
435439
Blob x;
436440
fossil_force_newline();
437441
prompt_for_password(zPrompt, &x, 0);
438442
free(zPrompt);
439443
g.urlPasswd = mprintf("%b", &x);
440444
blob_reset(&x);
445
+ g.urlFlags |= URL_PROMPTED;
441446
if( g.urlPasswd[0]
442447
&& (g.urlFlags & (URL_REMEMBER|URL_ASK_REMEMBER_PW))!=0
443448
){
444449
char c;
445450
prompt_user("remember password (Y/n)? ", &x);
446451
--- 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

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button