205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
|
/*
** If user chooses to use HTTP Authentication over unencrypted HTTP,
** remember decision. Otherwise, if the URL is being changed and no preference
** has been indicated, err on the safe side and revert the decision.
** Set the global preference if the URL is not being changed.
*/
void remember_or_get_http_auth(const char *zHttpAuth, int fRemember, const char *zUrl){
if( zHttpAuth && zHttpAuth[0] ){
g.zHttpAuth = mprintf("%s", zHttpAuth);
}
if( fRemember ){
if( g.zHttpAuth && g.zHttpAuth[0] ){
set_httpauth(g.zHttpAuth);
}else if( zUrl && zUrl[0] ){
db_unset("http-auth", 0);
}else{
g.zHttpAuth = get_httpauth();
}
}else if( g.zHttpAuth==0 && zUrl==0 ){
g.zHttpAuth = get_httpauth();
}
}
/*
** Get the HTTP Authorization preference from db.
*/
char *get_httpauth(void){
return unobscure(db_get("http-auth", 0));
}
/*
** Set the HTTP Authorization preference in db.
*/
void set_httpauth(const char *zHttpAuth){
db_set("http-auth", obscure(zHttpAuth), 0);
}
/*
** Look for SSH clone command line options and setup in globals.
*/
void clone_ssh_find_options(void){
const char *zSshCmd; /* SSH command string */
|
>
|
>
>
|
>
>
|
>
|
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
|
/*
** If user chooses to use HTTP Authentication over unencrypted HTTP,
** remember decision. Otherwise, if the URL is being changed and no preference
** has been indicated, err on the safe side and revert the decision.
** Set the global preference if the URL is not being changed.
*/
void remember_or_get_http_auth(const char *zHttpAuth, int fRemember, const char *zUrl){
char *zKey = mprintf("http-auth:%s", g.urlCanonical);
if( zHttpAuth && zHttpAuth[0] ){
g.zHttpAuth = mprintf("%s", zHttpAuth);
}
if( fRemember ){
if( g.zHttpAuth && g.zHttpAuth[0] ){
set_httpauth(g.zHttpAuth);
}else if( zUrl && zUrl[0] ){
db_unset(zKey, 0);
}else{
g.zHttpAuth = get_httpauth();
}
}else if( g.zHttpAuth==0 && zUrl==0 ){
g.zHttpAuth = get_httpauth();
}
free(zKey);
}
/*
** Get the HTTP Authorization preference from db.
*/
char *get_httpauth(void){
char *zKey = mprintf("http-auth:%s", g.urlCanonical);
return unobscure(db_get(zKey, 0));
free(zKey);
}
/*
** Set the HTTP Authorization preference in db.
*/
void set_httpauth(const char *zHttpAuth){
char *zKey = mprintf("http-auth:%s", g.urlCanonical);
db_set(zKey, obscure(zHttpAuth), 0);
free(zKey);
}
/*
** Look for SSH clone command line options and setup in globals.
*/
void clone_ssh_find_options(void){
const char *zSshCmd; /* SSH command string */
|