Fossil SCM

Disable prompts for a password if fossil is not running on an interactive terminal.

drh 2010-03-05 00:08 UTC trunk
Commit 554d4caa5ab04443e1be2445d8e9cbb97d924f25
1 file changed +11 -6
+11 -6
--- src/url.c
+++ src/url.c
@@ -310,12 +310,17 @@
310310
/*
311311
** Prompt the user for the password for g.urlUser. Store the result
312312
** in g.urlPasswd.
313313
*/
314314
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
+ }
321326
}
322327
--- 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

Keyboard Shortcuts

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