Fossil SCM

Only prompt to use Fossil username/password for Basic Authorization if they are available.

andybradford 2014-02-11 03:58 http-auth
Commit 9223f0226c7da8e63a8b91cce6d84f8eb714d12a
1 file changed +7 -10
+7 -10
--- src/http.c
+++ src/http.c
@@ -135,18 +135,13 @@
135135
** Use Fossil credentials for HTTP Basic Authorization prompt
136136
*/
137137
static int use_fossil_creds_for_httpauth_prompt(void){
138138
Blob x;
139139
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);
145141
c = blob_str(&x)[0];
146142
blob_reset(&x);
147
- free(zPrompt);
148143
return ( c=='y' || c=='Y' );
149144
}
150145
151146
/*
152147
** Prompt to save HTTP Basic Authorization information
@@ -170,14 +165,16 @@
170165
char *zUser;
171166
char *zPw;
172167
char *zPrompt;
173168
char *zHttpAuth = 0;
174169
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);
179176
}else{
180177
prompt_user("Basic Authorization user: ", &x);
181178
zUser = mprintf("%b", &x);
182179
zPrompt = mprintf("HTTP password for %b: ", &x);
183180
blob_reset(&x);
184181
--- 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

Keyboard Shortcuts

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