Hello,

I  found  the  cause  for  why  fossil sync  --once  does  not  use  the
password embedded in  the URL. sync.c calls  user_select() after calling
url_parse(...), but  user_select() has a  call to url_parse(0,  0) which
effectively overwrites the g.urlPasswd variable:

  if( zUrl==0 ){
    zUrl = db_get("last-sync-url", 0);
    if( zUrl==0 ) return;
    g.urlPasswd = unobscure(db_get("last-sync-pw", 0));
    bSetUrl = 0;
  }

Should this be prevented if already set:

--- url.c
+++ url.c
@@ -76,11 +76,13 @@
   int bSetUrl = 1;
  
   if( zUrl==0 ){
     zUrl = db_get("last-sync-url", 0);
     if( zUrl==0 ) return;
-    g.urlPasswd = unobscure(db_get("last-sync-pw", 0));
+    if( g.urlPasswd==0 ){
+      g.urlPasswd = unobscure(db_get("last-sync-pw", 0));
+    }
     bSetUrl = 0;
   }
 
   if( strncmp(zUrl, "http://";, 7)==0
    || strncmp(zUrl, "https://";, 8)==0


Or should the call to user_select() be moved up above url_parse():

--- sync.c
+++ sync.c
@@ -114,16 +114,16 @@
     zUrl = g.argv[2];
   }
   if( urlFlags & URL_REMEMBER ){
     clone_ssh_db_set_options();
   }
+  user_select();
   url_parse(zUrl, urlFlags);
   if( g.urlProtocol==0 ){
     if( urlOptional ) fossil_exit(0);
     usage("URL");
   }
-  user_select();
   if( g.argc==2 ){
     if( ((*pSyncFlags) & (SYNC_PUSH|SYNC_PULL))==(SYNC_PUSH|SYNC_PULL) ){
       fossil_print("Sync with %s\n", g.urlCanonical);
     }else if( (*pSyncFlags) & SYNC_PUSH ){
       fossil_print("Push to %s\n", g.urlCanonical);


Thanks,

Andy
-- 
TAI64 timestamp: 4000000052735531


_______________________________________________
fossil-users mailing list
[email protected]
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users

Reply via email to