Fossil SCM
Disable prompts for a password if fossil is not running on an interactive terminal.
Commit
554d4caa5ab04443e1be2445d8e9cbb97d924f25
Parent
62b4df4ea445656…
1 file changed
+11
-6
+11
-6
| --- src/url.c | ||
| +++ src/url.c | ||
| @@ -310,12 +310,17 @@ | ||
| 310 | 310 | /* |
| 311 | 311 | ** Prompt the user for the password for g.urlUser. Store the result |
| 312 | 312 | ** in g.urlPasswd. |
| 313 | 313 | */ |
| 314 | 314 | void url_prompt_for_password(void){ |
| 315 | - char *zPrompt = mprintf("password for %s: ", g.urlUser); | |
| 316 | - Blob x; | |
| 317 | - prompt_for_password(zPrompt, &x, 0); | |
| 318 | - free(zPrompt); | |
| 319 | - g.urlPasswd = mprintf("%b", &x); | |
| 320 | - blob_reset(&x); | |
| 315 | + if( isatty(fileno(stdin)) ){ | |
| 316 | + char *zPrompt = mprintf("password for %s: ", g.urlUser); | |
| 317 | + Blob x; | |
| 318 | + prompt_for_password(zPrompt, &x, 0); | |
| 319 | + free(zPrompt); | |
| 320 | + g.urlPasswd = mprintf("%b", &x); | |
| 321 | + blob_reset(&x); | |
| 322 | + }else{ | |
| 323 | + fossil_fatal("missing or incorrect password for user \"%s\"", | |
| 324 | + g.urlUser); | |
| 325 | + } | |
| 321 | 326 | } |
| 322 | 327 |
| --- src/url.c | |
| +++ src/url.c | |
| @@ -310,12 +310,17 @@ | |
| 310 | /* |
| 311 | ** Prompt the user for the password for g.urlUser. Store the result |
| 312 | ** in g.urlPasswd. |
| 313 | */ |
| 314 | void url_prompt_for_password(void){ |
| 315 | char *zPrompt = mprintf("password for %s: ", g.urlUser); |
| 316 | Blob x; |
| 317 | prompt_for_password(zPrompt, &x, 0); |
| 318 | free(zPrompt); |
| 319 | g.urlPasswd = mprintf("%b", &x); |
| 320 | blob_reset(&x); |
| 321 | } |
| 322 |
| --- src/url.c | |
| +++ src/url.c | |
| @@ -310,12 +310,17 @@ | |
| 310 | /* |
| 311 | ** Prompt the user for the password for g.urlUser. Store the result |
| 312 | ** in g.urlPasswd. |
| 313 | */ |
| 314 | void url_prompt_for_password(void){ |
| 315 | if( isatty(fileno(stdin)) ){ |
| 316 | char *zPrompt = mprintf("password for %s: ", g.urlUser); |
| 317 | Blob x; |
| 318 | prompt_for_password(zPrompt, &x, 0); |
| 319 | free(zPrompt); |
| 320 | g.urlPasswd = mprintf("%b", &x); |
| 321 | blob_reset(&x); |
| 322 | }else{ |
| 323 | fossil_fatal("missing or incorrect password for user \"%s\"", |
| 324 | g.urlUser); |
| 325 | } |
| 326 | } |
| 327 |