Fossil SCM
Use function that will prompt twice for sanity check.
Commit
6289a97e40315d0220dcef11de4c375866544447
Parent
06bff8c629bc0c6…
1 file changed
+7
-2
+7
-2
| --- src/http.c | ||
| +++ src/http.c | ||
| @@ -164,24 +164,29 @@ | ||
| 164 | 164 | */ |
| 165 | 165 | char *prompt_for_httpauth_creds(void){ |
| 166 | 166 | Blob x; |
| 167 | 167 | char *zUser; |
| 168 | 168 | char *zPw; |
| 169 | + char *zPrompt; | |
| 169 | 170 | char *zHttpAuth = 0; |
| 170 | 171 | if( !isatty(fileno(stdin)) ) return 0; |
| 171 | 172 | if ( use_fossil_creds_for_httpauth_prompt() ){ |
| 172 | 173 | if( g.urlUser && g.urlPasswd ){ |
| 173 | 174 | zHttpAuth = mprintf("%s:%s", g.urlUser, g.urlPasswd); |
| 174 | 175 | } |
| 175 | 176 | }else{ |
| 176 | 177 | prompt_user("Basic Authorization user: ", &x); |
| 177 | 178 | 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); | |
| 180 | 180 | blob_reset(&x); |
| 181 | + prompt_for_password(zPrompt, &x, 1); | |
| 182 | + zPw = mprintf("%b", &x); | |
| 183 | + zHttpAuth = mprintf("%s:%s", zUser, zPw); | |
| 181 | 184 | free(zUser); |
| 182 | 185 | free(zPw); |
| 186 | + free(zPrompt); | |
| 187 | + blob_reset(&x); | |
| 183 | 188 | } |
| 184 | 189 | if( save_httpauth_prompt() ){ |
| 185 | 190 | set_httpauth(zHttpAuth); |
| 186 | 191 | } |
| 187 | 192 | return zHttpAuth; |
| 188 | 193 |
| --- 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 |