Fossil

Check-in [1854e090]
Login

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

Overview
Comment:Make it so password prompts during commit are also honored.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | url-password-fixes
Files: files | file ages | folders
SHA1:1854e090fda7dd695551ea67271ced63f21f4461
User & Date: andybradford 2013-11-05 02:08:41
Context
2013-11-05
09:37
Add --once option to "fossil clone" check-in: c0cdb632 user: jan.nijtmans tags: url-password-fixes
02:08
Make it so password prompts during commit are also honored. check-in: 1854e090 user: andybradford tags: url-password-fixes
2013-11-04
15:12
Preserve any URL flags that get added when parsing the original URL. check-in: 23e51b9d user: andybradford tags: url-password-fixes
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/url.c.

68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
...
224
225
226
227
228
229
230
231
232

233
234




235
236
237
238
239
240
241
242
243
244
245
246
247
...
451
452
453
454
455
456
457


458
459
460
461
462
463
464
**
**     ssh://userid:password@host:port/path?fossil=path/to/fossil.exe
**
*/
void url_parse(const char *zUrl, unsigned int urlFlags){
  int i, j, c;
  char *zFile = 0;
  int bPrompted = 0;
  int bSetUrl = 1;
 
  if( zUrl==0 ){
    zUrl = db_get("last-sync-url", 0);
    if( zUrl==0 ) return;
    if( g.urlPasswd==0 ){
      g.urlPasswd = unobscure(db_get("last-sync-pw", 0));
................................................................................
    g.urlProtocol = "file";
    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 ) &&

            isatty(fileno(stdin)) && save_password_prompt() ){
    g.urlFlags = urlFlags |= URL_REMEMBER_PW;




  }
  if( urlFlags & URL_REMEMBER ){
    if( bSetUrl ){
      db_set("last-sync-url", g.urlCanonical, 0);
    }
    if( !bPrompted && g.urlPasswd && g.urlUser ){
      db_set("last-sync-pw", obscure(g.urlPasswd), 0);
    }
  }
}

/*
** COMMAND: test-urlparser
................................................................................
     && (g.urlFlags & (URL_REMEMBER|URL_ASK_REMEMBER_PW))!=0
    ){
      if( save_password_prompt() ){
        g.urlFlags |= URL_REMEMBER_PW;
        if( g.urlFlags & URL_REMEMBER ){
          db_set("last-sync-pw", obscure(g.urlPasswd), 0);
        }


      }
    }
  }else{
    fossil_fatal("missing or incorrect password for user \"%s\"",
                 g.urlUser);
  }
}







<







 







<
|
>
|
|
>
>
>
>





|







 







>
>







68
69
70
71
72
73
74

75
76
77
78
79
80
81
...
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
...
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
**
**     ssh://userid:password@host:port/path?fossil=path/to/fossil.exe
**
*/
void url_parse(const char *zUrl, unsigned int urlFlags){
  int i, j, c;
  char *zFile = 0;

  int bSetUrl = 1;
 
  if( zUrl==0 ){
    zUrl = db_get("last-sync-url", 0);
    if( zUrl==0 ) return;
    if( g.urlPasswd==0 ){
      g.urlPasswd = unobscure(db_get("last-sync-pw", 0));
................................................................................
    g.urlProtocol = "file";
    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();

  }else if( g.urlUser!=0 && ( urlFlags & URL_ASK_REMEMBER_PW ) ){
    if( isatty(fileno(stdin)) ){
      if( save_password_prompt() ){
        g.urlFlags = urlFlags |= URL_REMEMBER_PW;
      }else{
        g.urlFlags = urlFlags &= ~URL_REMEMBER_PW;
      }
    }
  }
  if( urlFlags & URL_REMEMBER ){
    if( bSetUrl ){
      db_set("last-sync-url", g.urlCanonical, 0);
    }
    if( g.urlPasswd && g.urlUser && ( g.urlFlags & URL_REMEMBER_PW ) ){
      db_set("last-sync-pw", obscure(g.urlPasswd), 0);
    }
  }
}

/*
** COMMAND: test-urlparser
................................................................................
     && (g.urlFlags & (URL_REMEMBER|URL_ASK_REMEMBER_PW))!=0
    ){
      if( save_password_prompt() ){
        g.urlFlags |= URL_REMEMBER_PW;
        if( g.urlFlags & URL_REMEMBER ){
          db_set("last-sync-pw", obscure(g.urlPasswd), 0);
        }
      }else{
        g.urlFlags &= ~URL_REMEMBER_PW;
      }
    }
  }else{
    fossil_fatal("missing or incorrect password for user \"%s\"",
                 g.urlUser);
  }
}