Fossil SCM
Only prompt to use Fossil username/password for Basic Authorization if they are available.
Commit
9223f0226c7da8e63a8b91cce6d84f8eb714d12a
Parent
3f8ddc28c6efc7d…
1 file changed
+7
-10
+7
-10
| --- src/http.c | ||
| +++ src/http.c | ||
| @@ -135,18 +135,13 @@ | ||
| 135 | 135 | ** Use Fossil credentials for HTTP Basic Authorization prompt |
| 136 | 136 | */ |
| 137 | 137 | static int use_fossil_creds_for_httpauth_prompt(void){ |
| 138 | 138 | Blob x; |
| 139 | 139 | char c; |
| 140 | - char *zPrompt = mprintf( | |
| 141 | - "\n%s Authorization required by:\n%s%s\n" | |
| 142 | - "Use Fossil username and password (y/N)? ", | |
| 143 | - g.urlIsHttps==1 ? "Encrypted HTTPS" : "Unencrypted HTTP", g.urlCanonical); | |
| 144 | - prompt_user(zPrompt, &x); | |
| 140 | + prompt_user("Use Fossil username and password (y/N)? ", &x); | |
| 145 | 141 | c = blob_str(&x)[0]; |
| 146 | 142 | blob_reset(&x); |
| 147 | - free(zPrompt); | |
| 148 | 143 | return ( c=='y' || c=='Y' ); |
| 149 | 144 | } |
| 150 | 145 | |
| 151 | 146 | /* |
| 152 | 147 | ** Prompt to save HTTP Basic Authorization information |
| @@ -170,14 +165,16 @@ | ||
| 170 | 165 | char *zUser; |
| 171 | 166 | char *zPw; |
| 172 | 167 | char *zPrompt; |
| 173 | 168 | char *zHttpAuth = 0; |
| 174 | 169 | if( !isatty(fileno(stdin)) ) return 0; |
| 175 | - if ( use_fossil_creds_for_httpauth_prompt() ){ | |
| 176 | - if( g.urlUser && g.urlPasswd ){ | |
| 177 | - zHttpAuth = mprintf("%s:%s", g.urlUser, g.urlPasswd); | |
| 178 | - } | |
| 170 | + zPrompt = mprintf("\n%s authorization required by\n%s\n", | |
| 171 | + g.urlIsHttps==1 ? "Encrypted HTTPS" : "Unencrypted HTTP", g.urlCanonical); | |
| 172 | + fossil_print(zPrompt); | |
| 173 | + free(zPrompt); | |
| 174 | + if ( g.urlUser && g.urlPasswd && use_fossil_creds_for_httpauth_prompt() ){ | |
| 175 | + zHttpAuth = mprintf("%s:%s", g.urlUser, g.urlPasswd); | |
| 179 | 176 | }else{ |
| 180 | 177 | prompt_user("Basic Authorization user: ", &x); |
| 181 | 178 | zUser = mprintf("%b", &x); |
| 182 | 179 | zPrompt = mprintf("HTTP password for %b: ", &x); |
| 183 | 180 | blob_reset(&x); |
| 184 | 181 |
| --- src/http.c | |
| +++ src/http.c | |
| @@ -135,18 +135,13 @@ | |
| 135 | ** Use Fossil credentials for HTTP Basic Authorization prompt |
| 136 | */ |
| 137 | static int use_fossil_creds_for_httpauth_prompt(void){ |
| 138 | Blob x; |
| 139 | char c; |
| 140 | char *zPrompt = mprintf( |
| 141 | "\n%s Authorization required by:\n%s%s\n" |
| 142 | "Use Fossil username and password (y/N)? ", |
| 143 | g.urlIsHttps==1 ? "Encrypted HTTPS" : "Unencrypted HTTP", g.urlCanonical); |
| 144 | prompt_user(zPrompt, &x); |
| 145 | c = blob_str(&x)[0]; |
| 146 | blob_reset(&x); |
| 147 | free(zPrompt); |
| 148 | return ( c=='y' || c=='Y' ); |
| 149 | } |
| 150 | |
| 151 | /* |
| 152 | ** Prompt to save HTTP Basic Authorization information |
| @@ -170,14 +165,16 @@ | |
| 170 | char *zUser; |
| 171 | char *zPw; |
| 172 | char *zPrompt; |
| 173 | char *zHttpAuth = 0; |
| 174 | if( !isatty(fileno(stdin)) ) return 0; |
| 175 | if ( use_fossil_creds_for_httpauth_prompt() ){ |
| 176 | if( g.urlUser && g.urlPasswd ){ |
| 177 | zHttpAuth = mprintf("%s:%s", g.urlUser, g.urlPasswd); |
| 178 | } |
| 179 | }else{ |
| 180 | prompt_user("Basic Authorization user: ", &x); |
| 181 | zUser = mprintf("%b", &x); |
| 182 | zPrompt = mprintf("HTTP password for %b: ", &x); |
| 183 | blob_reset(&x); |
| 184 |
| --- src/http.c | |
| +++ src/http.c | |
| @@ -135,18 +135,13 @@ | |
| 135 | ** Use Fossil credentials for HTTP Basic Authorization prompt |
| 136 | */ |
| 137 | static int use_fossil_creds_for_httpauth_prompt(void){ |
| 138 | Blob x; |
| 139 | char c; |
| 140 | prompt_user("Use Fossil username and password (y/N)? ", &x); |
| 141 | c = blob_str(&x)[0]; |
| 142 | blob_reset(&x); |
| 143 | return ( c=='y' || c=='Y' ); |
| 144 | } |
| 145 | |
| 146 | /* |
| 147 | ** Prompt to save HTTP Basic Authorization information |
| @@ -170,14 +165,16 @@ | |
| 165 | char *zUser; |
| 166 | char *zPw; |
| 167 | char *zPrompt; |
| 168 | char *zHttpAuth = 0; |
| 169 | if( !isatty(fileno(stdin)) ) return 0; |
| 170 | zPrompt = mprintf("\n%s authorization required by\n%s\n", |
| 171 | g.urlIsHttps==1 ? "Encrypted HTTPS" : "Unencrypted HTTP", g.urlCanonical); |
| 172 | fossil_print(zPrompt); |
| 173 | free(zPrompt); |
| 174 | if ( g.urlUser && g.urlPasswd && use_fossil_creds_for_httpauth_prompt() ){ |
| 175 | zHttpAuth = mprintf("%s:%s", g.urlUser, g.urlPasswd); |
| 176 | }else{ |
| 177 | prompt_user("Basic Authorization user: ", &x); |
| 178 | zUser = mprintf("%b", &x); |
| 179 | zPrompt = mprintf("HTTP password for %b: ", &x); |
| 180 | blob_reset(&x); |
| 181 |