367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
|
/*
** Prompt the user for the password for g.urlUser. Store the result
** in g.urlPasswd.
*/
void url_prompt_for_password(void){
if( isatty(fileno(stdin)) ){
char *zPrompt = mprintf("password for %s: ", g.urlUser);
Blob x;
prompt_for_password(zPrompt, &x, 0);
free(zPrompt);
g.urlPasswd = mprintf("%b", &x);
blob_reset(&x);
}else{
fossil_fatal("missing or incorrect password for user \"%s\"",
g.urlUser);
}
}
|
|
>
>
>
>
>
>
>
>
>
>
>
>
|
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
|
/*
** Prompt the user for the password for g.urlUser. Store the result
** in g.urlPasswd.
*/
void url_prompt_for_password(void){
if( isatty(fileno(stdin)) ){
char *zPrompt = mprintf("\rpassword for %s: ", g.urlUser);
Blob x;
prompt_for_password(zPrompt, &x, 0);
free(zPrompt);
g.urlPasswd = mprintf("%b", &x);
blob_reset(&x);
}else{
fossil_fatal("missing or incorrect password for user \"%s\"",
g.urlUser);
}
}
/* Preemptively prompt for a password if a username is given in the
** URL but no password.
*/
void url_get_password_if_needed(void){
if( (g.urlUser && g.urlUser[0])
&& (g.urlPasswd==0 || g.urlPasswd[0]==0)
&& isatty(fileno(stdin))
){
url_prompt_for_password();
}
}
|