Fossil SCM

Use function that will prompt twice for sanity check.

andybradford 2014-02-03 08:27 http-auth
Commit 6289a97e40315d0220dcef11de4c375866544447
1 file changed +7 -2
+7 -2
--- src/http.c
+++ src/http.c
@@ -164,24 +164,29 @@
164164
*/
165165
char *prompt_for_httpauth_creds(void){
166166
Blob x;
167167
char *zUser;
168168
char *zPw;
169
+ char *zPrompt;
169170
char *zHttpAuth = 0;
170171
if( !isatty(fileno(stdin)) ) return 0;
171172
if ( use_fossil_creds_for_httpauth_prompt() ){
172173
if( g.urlUser && g.urlPasswd ){
173174
zHttpAuth = mprintf("%s:%s", g.urlUser, g.urlPasswd);
174175
}
175176
}else{
176177
prompt_user("Basic Authorization user: ", &x);
177178
zUser = mprintf("%b", &x);
178
- zPw = prompt_for_user_password(zUser);
179
- zHttpAuth = mprintf("%s:%s", zUser, zPw);
179
+ zPrompt = mprintf("HTTP password for %b: ", &x);
180180
blob_reset(&x);
181
+ prompt_for_password(zPrompt, &x, 1);
182
+ zPw = mprintf("%b", &x);
183
+ zHttpAuth = mprintf("%s:%s", zUser, zPw);
181184
free(zUser);
182185
free(zPw);
186
+ free(zPrompt);
187
+ blob_reset(&x);
183188
}
184189
if( save_httpauth_prompt() ){
185190
set_httpauth(zHttpAuth);
186191
}
187192
return zHttpAuth;
188193
--- src/http.c
+++ src/http.c
@@ -164,24 +164,29 @@
164 */
165 char *prompt_for_httpauth_creds(void){
166 Blob x;
167 char *zUser;
168 char *zPw;
 
169 char *zHttpAuth = 0;
170 if( !isatty(fileno(stdin)) ) return 0;
171 if ( use_fossil_creds_for_httpauth_prompt() ){
172 if( g.urlUser && g.urlPasswd ){
173 zHttpAuth = mprintf("%s:%s", g.urlUser, g.urlPasswd);
174 }
175 }else{
176 prompt_user("Basic Authorization user: ", &x);
177 zUser = mprintf("%b", &x);
178 zPw = prompt_for_user_password(zUser);
179 zHttpAuth = mprintf("%s:%s", zUser, zPw);
180 blob_reset(&x);
 
 
 
181 free(zUser);
182 free(zPw);
 
 
183 }
184 if( save_httpauth_prompt() ){
185 set_httpauth(zHttpAuth);
186 }
187 return zHttpAuth;
188
--- src/http.c
+++ src/http.c
@@ -164,24 +164,29 @@
164 */
165 char *prompt_for_httpauth_creds(void){
166 Blob x;
167 char *zUser;
168 char *zPw;
169 char *zPrompt;
170 char *zHttpAuth = 0;
171 if( !isatty(fileno(stdin)) ) return 0;
172 if ( use_fossil_creds_for_httpauth_prompt() ){
173 if( g.urlUser && g.urlPasswd ){
174 zHttpAuth = mprintf("%s:%s", g.urlUser, g.urlPasswd);
175 }
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 prompt_for_password(zPrompt, &x, 1);
182 zPw = mprintf("%b", &x);
183 zHttpAuth = mprintf("%s:%s", zUser, zPw);
184 free(zUser);
185 free(zPw);
186 free(zPrompt);
187 blob_reset(&x);
188 }
189 if( save_httpauth_prompt() ){
190 set_httpauth(zHttpAuth);
191 }
192 return zHttpAuth;
193

Keyboard Shortcuts

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