Fossil SCM

Musn't forget about autosync commands that also need the Basic Authorization.

andybradford 2014-02-03 07:59 http-auth
Commit 06bff8c629bc0c668d9ee17f4ab5f2fa381affaf
3 files changed +17 -3 +1 -1 +1
+17 -3
--- src/clone.c
+++ src/clone.c
@@ -212,20 +212,34 @@
212212
if( zHttpAuth && zHttpAuth[0] ){
213213
g.zHttpAuth = mprintf("%s", zHttpAuth);
214214
}
215215
if( fRemember ){
216216
if( g.zHttpAuth && g.zHttpAuth[0] ){
217
- db_set("http-auth", obscure(g.zHttpAuth), 0);
217
+ set_httpauth(g.zHttpAuth);
218218
}else if( zUrl && zUrl[0] ){
219219
db_unset("http-auth", 0);
220220
}else{
221
- g.zHttpAuth = unobscure(db_get("http-auth",0));
221
+ g.zHttpAuth = get_httpauth();
222222
}
223223
}else if( g.zHttpAuth==0 && zUrl==0 ){
224
- g.zHttpAuth = unobscure(db_get("http-auth",0));
224
+ g.zHttpAuth = get_httpauth();
225225
}
226226
}
227
+
228
+/*
229
+** Get the HTTP Authorization preference from db.
230
+*/
231
+char *get_httpauth(void){
232
+ return unobscure(db_get("http-auth", 0));
233
+}
234
+
235
+/*
236
+** Set the HTTP Authorization preference in db.
237
+*/
238
+void set_httpauth(const char *zHttpAuth){
239
+ db_set("http-auth", obscure(zHttpAuth), 0);
240
+}
227241
228242
/*
229243
** Look for SSH clone command line options and setup in globals.
230244
*/
231245
void clone_ssh_find_options(void){
232246
--- src/clone.c
+++ src/clone.c
@@ -212,20 +212,34 @@
212 if( zHttpAuth && zHttpAuth[0] ){
213 g.zHttpAuth = mprintf("%s", zHttpAuth);
214 }
215 if( fRemember ){
216 if( g.zHttpAuth && g.zHttpAuth[0] ){
217 db_set("http-auth", obscure(g.zHttpAuth), 0);
218 }else if( zUrl && zUrl[0] ){
219 db_unset("http-auth", 0);
220 }else{
221 g.zHttpAuth = unobscure(db_get("http-auth",0));
222 }
223 }else if( g.zHttpAuth==0 && zUrl==0 ){
224 g.zHttpAuth = unobscure(db_get("http-auth",0));
225 }
226 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
227
228 /*
229 ** Look for SSH clone command line options and setup in globals.
230 */
231 void clone_ssh_find_options(void){
232
--- src/clone.c
+++ src/clone.c
@@ -212,20 +212,34 @@
212 if( zHttpAuth && zHttpAuth[0] ){
213 g.zHttpAuth = mprintf("%s", zHttpAuth);
214 }
215 if( fRemember ){
216 if( g.zHttpAuth && g.zHttpAuth[0] ){
217 set_httpauth(g.zHttpAuth);
218 }else if( zUrl && zUrl[0] ){
219 db_unset("http-auth", 0);
220 }else{
221 g.zHttpAuth = get_httpauth();
222 }
223 }else if( g.zHttpAuth==0 && zUrl==0 ){
224 g.zHttpAuth = get_httpauth();
225 }
226 }
227
228 /*
229 ** Get the HTTP Authorization preference from db.
230 */
231 char *get_httpauth(void){
232 return unobscure(db_get("http-auth", 0));
233 }
234
235 /*
236 ** Set the HTTP Authorization preference in db.
237 */
238 void set_httpauth(const char *zHttpAuth){
239 db_set("http-auth", obscure(zHttpAuth), 0);
240 }
241
242 /*
243 ** Look for SSH clone command line options and setup in globals.
244 */
245 void clone_ssh_find_options(void){
246
+1 -1
--- src/http.c
+++ src/http.c
@@ -180,11 +180,11 @@
180180
blob_reset(&x);
181181
free(zUser);
182182
free(zPw);
183183
}
184184
if( save_httpauth_prompt() ){
185
- db_set("http-auth", obscure(zHttpAuth), 0);
185
+ set_httpauth(zHttpAuth);
186186
}
187187
return zHttpAuth;
188188
}
189189
190190
/*
191191
--- src/http.c
+++ src/http.c
@@ -180,11 +180,11 @@
180 blob_reset(&x);
181 free(zUser);
182 free(zPw);
183 }
184 if( save_httpauth_prompt() ){
185 db_set("http-auth", obscure(zHttpAuth), 0);
186 }
187 return zHttpAuth;
188 }
189
190 /*
191
--- src/http.c
+++ src/http.c
@@ -180,11 +180,11 @@
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 }
189
190 /*
191
+1
--- src/sync.c
+++ src/sync.c
@@ -54,10 +54,11 @@
5454
if( g.urlUser!=0 && g.urlPasswd==0 ){
5555
g.urlPasswd = unobscure(db_get("last-sync-pw", 0));
5656
g.urlFlags |= URL_PROMPT_PW;
5757
url_prompt_for_password();
5858
}
59
+ g.zHttpAuth = get_httpauth();
5960
url_remember();
6061
#if 0 /* Disabled for now */
6162
if( (flags & AUTOSYNC_PULL)!=0 && db_get_boolean("auto-shun",1) ){
6263
/* When doing an automatic pull, also automatically pull shuns from
6364
** the server if pull_shuns is enabled.
6465
--- src/sync.c
+++ src/sync.c
@@ -54,10 +54,11 @@
54 if( g.urlUser!=0 && g.urlPasswd==0 ){
55 g.urlPasswd = unobscure(db_get("last-sync-pw", 0));
56 g.urlFlags |= URL_PROMPT_PW;
57 url_prompt_for_password();
58 }
 
59 url_remember();
60 #if 0 /* Disabled for now */
61 if( (flags & AUTOSYNC_PULL)!=0 && db_get_boolean("auto-shun",1) ){
62 /* When doing an automatic pull, also automatically pull shuns from
63 ** the server if pull_shuns is enabled.
64
--- src/sync.c
+++ src/sync.c
@@ -54,10 +54,11 @@
54 if( g.urlUser!=0 && g.urlPasswd==0 ){
55 g.urlPasswd = unobscure(db_get("last-sync-pw", 0));
56 g.urlFlags |= URL_PROMPT_PW;
57 url_prompt_for_password();
58 }
59 g.zHttpAuth = get_httpauth();
60 url_remember();
61 #if 0 /* Disabled for now */
62 if( (flags & AUTOSYNC_PULL)!=0 && db_get_boolean("auto-shun",1) ){
63 /* When doing an automatic pull, also automatically pull shuns from
64 ** the server if pull_shuns is enabled.
65

Keyboard Shortcuts

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