Fossil

Check-in [8bdc3ccd]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Avoid clobbering the last-sync-pw when doing sync --once.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | url-password-fixes
Files: files | file ages | folders
SHA1:8bdc3ccd2bb8bb6f8edd27944b12c9938dbd4e7c
User & Date: andybradford 2013-11-01 08:11:19
Context
2013-11-02
06:17
It appears that calls to url_parse(0,x) are used to establish who the user is using user_select(). In this case we should not overwrite a password that has been provided prior to calling user_select() with one from the database. check-in: a01c714c user: andybradford tags: url-password-fixes
2013-11-01
08:11
Avoid clobbering the last-sync-pw when doing sync --once. check-in: 8bdc3ccd user: andybradford tags: url-password-fixes
05:14
Prompt to remember password when password is embedded in URL. Also improve password failure prompting during clone/sync operations. check-in: 1ccbb651 user: andybradford tags: url-password-fixes
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/url.c.

112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
...
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
    for(i=iStart; (c=zUrl[i])!=0 && c!='/' && c!='@'; i++){}
    if( c=='@' ){
      /* Parse up the user-id and password */
      for(j=iStart; j<i && zUrl[j]!=':'; j++){}
      g.urlUser = mprintf("%.*s", j-iStart, &zUrl[iStart]);
      dehttpize(g.urlUser);
      if( j<i ){
        urlFlags |= URL_ASK_REMEMBER_PW;
        g.urlPasswd = mprintf("%.*s", i-j-1, &zUrl[j+1]);
        dehttpize(g.urlPasswd);
      }
      if( g.urlIsSsh && g.urlPasswd ){
        zLogin = mprintf("%t:*@", g.urlUser);
      }else{
        zLogin = mprintf("%t@", g.urlUser);
................................................................................
    g.urlPath = "";
    g.urlName = mprintf("%b", &cfile);
    g.urlCanonical = mprintf("file://%T", g.urlName);
    blob_reset(&cfile);
  }else if( g.urlUser!=0 && g.urlPasswd==0 && (urlFlags & URL_PROMPT_PW) ){
    url_prompt_for_password();
    bPrompted = 1;
  }else if( g.urlUser!=0 && (urlFlags & URL_ASK_REMEMBER_PW ) &&
            save_password_prompt() ){
    g.urlFlags = urlFlags |= URL_REMEMBER_PW;
  }
  if( urlFlags & URL_REMEMBER ){
    if( bSetUrl ){
      db_set("last-sync-url", g.urlCanonical, 0);
    }







|







 







|







112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
...
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
    for(i=iStart; (c=zUrl[i])!=0 && c!='/' && c!='@'; i++){}
    if( c=='@' ){
      /* Parse up the user-id and password */
      for(j=iStart; j<i && zUrl[j]!=':'; j++){}
      g.urlUser = mprintf("%.*s", j-iStart, &zUrl[iStart]);
      dehttpize(g.urlUser);
      if( j<i ){
        if( urlFlags & URL_REMEMBER ) urlFlags |= URL_ASK_REMEMBER_PW;
        g.urlPasswd = mprintf("%.*s", i-j-1, &zUrl[j+1]);
        dehttpize(g.urlPasswd);
      }
      if( g.urlIsSsh && g.urlPasswd ){
        zLogin = mprintf("%t:*@", g.urlUser);
      }else{
        zLogin = mprintf("%t@", g.urlUser);
................................................................................
    g.urlPath = "";
    g.urlName = mprintf("%b", &cfile);
    g.urlCanonical = mprintf("file://%T", g.urlName);
    blob_reset(&cfile);
  }else if( g.urlUser!=0 && g.urlPasswd==0 && (urlFlags & URL_PROMPT_PW) ){
    url_prompt_for_password();
    bPrompted = 1;
  }else if( g.urlUser!=0 && ( urlFlags & URL_ASK_REMEMBER_PW ) &&
            save_password_prompt() ){
    g.urlFlags = urlFlags |= URL_REMEMBER_PW;
  }
  if( urlFlags & URL_REMEMBER ){
    if( bSetUrl ){
      db_set("last-sync-url", g.urlCanonical, 0);
    }

Changes to src/xfer.c.

1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
          fossil_force_newline();
          fossil_print("Error: %s\n", zMsg);
          if( fossil_strcmp(zMsg, "login failed")==0 ){
            if( nCycle<2 ){
              g.urlPasswd = 0;
              go = 1;
              if( g.cgiOutput==0 ){
                g.urlFlags |= URL_PROMPT_PW | URL_ASK_REMEMBER_PW;
                g.urlFlags |= URL_REMEMBER;
                url_prompt_for_password();
              }
            }
          }else{
            blob_appendf(&xfer.err, "server says: %s\n", zMsg);
            nErr++;
          }







|
<







1778
1779
1780
1781
1782
1783
1784
1785

1786
1787
1788
1789
1790
1791
1792
          fossil_force_newline();
          fossil_print("Error: %s\n", zMsg);
          if( fossil_strcmp(zMsg, "login failed")==0 ){
            if( nCycle<2 ){
              g.urlPasswd = 0;
              go = 1;
              if( g.cgiOutput==0 ){
                g.urlFlags |= URL_PROMPT_PW;

                url_prompt_for_password();
              }
            }
          }else{
            blob_appendf(&xfer.err, "server says: %s\n", zMsg);
            nErr++;
          }