Fossil

Check-in [f0cdbd8b95]
Login

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

Overview
Comment:On the /urllist page, hyperlinks to URLs that include a username omit the username.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: f0cdbd8b95f5b8eb69ebe21bdd2d30cd47a5827a13c53d1ea5072e6a2bdd2e9e
User & Date: drh 2021-12-23 13:16:46.779
Context
2021-12-23
14:09
Fix the URL parser so that it only has access to the CONFIG table entries for URL aliases if the URL_USE_CONFIG flag is set in the second parameter. check-in: 0aff8d8744 user: drh tags: trunk
13:16
On the /urllist page, hyperlinks to URLs that include a username omit the username. check-in: f0cdbd8b95 user: drh tags: trunk
12:50
Show the "remote list" values on the /urllist page. check-in: 964ec660a2 user: drh tags: trunk
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/db.c.
1407
1408
1409
1410
1411
1412
1413
1414

1415
1416
1417
1418
1419
1420
1421
1422
  sqlite3_create_function(db, "display_name", 1, SQLITE_UTF8, 0,
                          alert_display_name_func, 0, 0);
  sqlite3_create_function(db, "obscure", 1, SQLITE_UTF8, 0,
                          db_obscure, 0, 0);
  sqlite3_create_function(db, "protected_setting", 1, SQLITE_UTF8, 0,
                          db_protected_setting_func, 0, 0);
  sqlite3_create_function(db, "win_reserved", 1, SQLITE_UTF8, 0,
                          db_win_reserved_func,0,0

  );
}

#if USE_SEE
/*
** This is a pointer to the saved database encryption key string.
*/
static char *zSavedKey = 0;







|
>
|







1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
  sqlite3_create_function(db, "display_name", 1, SQLITE_UTF8, 0,
                          alert_display_name_func, 0, 0);
  sqlite3_create_function(db, "obscure", 1, SQLITE_UTF8, 0,
                          db_obscure, 0, 0);
  sqlite3_create_function(db, "protected_setting", 1, SQLITE_UTF8, 0,
                          db_protected_setting_func, 0, 0);
  sqlite3_create_function(db, "win_reserved", 1, SQLITE_UTF8, 0,
                          db_win_reserved_func,0,0);
  sqlite3_create_function(db, "url_nouser", 1, SQLITE_UTF8, 0,
                          url_nouser_func,0,0);
}

#if USE_SEE
/*
** This is a pointer to the saved database encryption key string.
*/
static char *zSavedKey = 0;
Changes to src/stat.c.
649
650
651
652
653
654
655

656
657
658
659
660
661
662
663

664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
    total += cnt;
  }

  cnt = 0;
  db_prepare(&q,
    "SELECT"
    " value,"

    " substr(name,10),"
    " datetime(mtime,'unixepoch')"
    "FROM config\n"
    "WHERE name GLOB 'sync-url:*'\n"
    "ORDER BY 2"
  );
  while( db_step(&q)==SQLITE_ROW ){
    const char *zUrl = db_column_text(&q, 0);

    const char *zName = db_column_text(&q, 1);
    if( cnt++==0 ){
      @ <div class="section">Defined sync targets</div>
      @ <table border='0' width='100%%'>
    }
    @ <tr><td>%h(zName)</td><td>&nbsp;&nbsp;</td>
    @ <td width='95%%'><a href='%h(zUrl)'>%h(zUrl)</a></td>
    @ <td><nobr>%h(db_column_text(&q,2))</nobr></td></tr>
  }
  db_finalize(&q);
  fossil_free(zPriorRepo);
  if( cnt ){
    @ </table>
    total += cnt;
  }


  if( total==0 ){







>








>
|





|
|


<







649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675

676
677
678
679
680
681
682
    total += cnt;
  }

  cnt = 0;
  db_prepare(&q,
    "SELECT"
    " value,"
    " url_nouser(value),"
    " substr(name,10),"
    " datetime(mtime,'unixepoch')"
    "FROM config\n"
    "WHERE name GLOB 'sync-url:*'\n"
    "ORDER BY 2"
  );
  while( db_step(&q)==SQLITE_ROW ){
    const char *zUrl = db_column_text(&q, 0);
    const char *zLink = db_column_text(&q, 1);
    const char *zName = db_column_text(&q, 2);
    if( cnt++==0 ){
      @ <div class="section">Defined sync targets</div>
      @ <table border='0' width='100%%'>
    }
    @ <tr><td>%h(zName)</td><td>&nbsp;&nbsp;</td>
    @ <td width='95%%'><a href='%h(zLink)'>%h(zUrl)</a></td>
    @ <td><nobr>%h(db_column_text(&q,3))</nobr></td></tr>
  }
  db_finalize(&q);

  if( cnt ){
    @ </table>
    total += cnt;
  }


  if( total==0 ){
Changes to src/url.c.
326
327
328
329
330
331
332





































333
334
335
336
337
338
339
  if( p->dfltPort!=p->port ){
    blob_appendf(&x, ":%d", p->port);
  }
  blob_appendf(&x, "%T", p->path);
  (void)blob_str(&x);
  return x.aData;
}






































/*
** Reclaim malloced memory from a UrlData object
*/
void url_unparse(UrlData *p){
  if( p==0 ){
    p = &g.url;







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
  if( p->dfltPort!=p->port ){
    blob_appendf(&x, ":%d", p->port);
  }
  blob_appendf(&x, "%T", p->path);
  (void)blob_str(&x);
  return x.aData;
}

/*
** Construct a URL for a UrlData object that omits the
** login name and password, into memory obtained from fossil_malloc()
** and return a pointer to that URL text.
*/
char *url_nouser(const UrlData *p){
  Blob x = BLOB_INITIALIZER;
  if( p->isFile || p->user==0 || p->user[0]==0 ){
    return fossil_strdup(p->canonical);
  }
  blob_appendf(&x, "%s://", p->protocol);
  blob_appendf(&x, "%T", p->name);
  if( p->dfltPort!=p->port ){
    blob_appendf(&x, ":%d", p->port);
  }
  blob_appendf(&x, "%T", p->path);
  (void)blob_str(&x);
  return x.aData;
}

/*
** SQL function to remove the username/password from a URL
*/
void url_nouser_func(
  sqlite3_context *context,
  int argc,
  sqlite3_value **argv
){
  const char *zOrig = (const char*)sqlite3_value_text(argv[0]);
  UrlData x;
  if( zOrig==0 ) return;
  memset(&x, 0, sizeof(x));
  url_parse_local(zOrig, URL_OMIT_USER, &x);
  sqlite3_result_text(context, x.canonical, -1, SQLITE_TRANSIENT);
  url_unparse(&x);
}

/*
** Reclaim malloced memory from a UrlData object
*/
void url_unparse(UrlData *p){
  if( p==0 ){
    p = &g.url;