Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | Fixed the 'add' Windows-reserved filename check to work with both filename and directory name input. It now always warns for such named s but permits them if --allow-reserved is used. |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA3-256: |
d0a8582e014d0a9fe749a58f90a6325e |
| User & Date: | stephan 2021-03-26 19:32:36.449 |
Context
|
2021-03-26
| ||
| 20:16 | Append to the list of [/doc/trunk/www/changes.wiki#v2_15|changes in v2.15] an item about [/help?cmd=/whistory|/whistory]. ... (check-in: 920b7079f2 user: george tags: trunk) | |
| 19:32 | Fixed the 'add' Windows-reserved filename check to work with both filename and directory name input. It now always warns for such named s but permits them if --allow-reserved is used. ... (check-in: d0a8582e01 user: stephan tags: trunk) | |
| 18:25 | Integrate <i>rptview-submenu-paralinks</i> branch. For this check-in parametric links in submenus are enabled on [/rptview?rn=6&wikismpl=rptview&rvsmpl=wiki/To+Do+List|/rptview] page (may be triggered by rvsmpl, rvsmplX, rptview_smpl, rptview_smplX parameter names) and also for [/wiki/To+Do+List?rn=6&wikismpl=rptview&rvsmpl=wiki/To+Do+List|/wiki] page (may be triggered by wikismpl, wikismplX parameter names). See also forum threads [forum:612170e310] and [forum:8cc4931e69]. ... (check-in: 5c5aa19cc5 user: george tags: trunk) | |
Changes
Changes to src/add.c.
| ︙ | ︙ | |||
437 438 439 440 441 442 443 |
char *zName;
int isDir;
Blob fullName = empty_blob;
/* file_tree_name() throws a fatal error if g.argv[i] is outside of the
** checkout. */
file_tree_name(g.argv[i], &fullName, 0, 1);
| < < < < < < < < < < < | 437 438 439 440 441 442 443 444 445 446 447 448 449 450 |
char *zName;
int isDir;
Blob fullName = empty_blob;
/* file_tree_name() throws a fatal error if g.argv[i] is outside of the
** checkout. */
file_tree_name(g.argv[i], &fullName, 0, 1);
blob_reset(&fullName);
file_canonical_name(g.argv[i], &fullName, 0);
zName = blob_str(&fullName);
isDir = file_isdir(zName, RepoFILE);
if( isDir==1 ){
vfile_scan(&fullName, nRoot-1, scanFlags, pClean, pIgnore, RepoFILE);
}else if( isDir==0 ){
|
| ︙ | ︙ | |||
484 485 486 487 488 489 490 491 492 493 494 495 496 497 |
);
}
blob_reset(&fullName);
}
glob_free(pIgnore);
glob_free(pClean);
add_files_in_sfile(vid);
db_end_transaction(0);
}
/*
** This function adds a file to list of files to delete from disk after
** the other actions required for the parent operation have completed
| > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 |
);
}
blob_reset(&fullName);
}
glob_free(pIgnore);
glob_free(pClean);
/** Check for Windows-reserved names and warn or exit, as
** appopriate. Note that the 'add' internal machinery already
** _silently_ skips over any names for which
** file_is_reserved_name() returns true or which is in the
** fossil_reserved_name() list. We do not need to warn for those,
** as they're outright verboten. */
if(db_exists("SELECT 1 FROM sfile WHERE win_reserved(pathname)")){
Stmt q = empty_Stmt;
db_prepare(&q,"SELECT pathname FROM sfile "
"WHERE win_reserved(pathname)");
int reservedCount = 0;
while( db_step(&q)==SQLITE_ROW ){
const char * zName = db_column_text(&q, 0);
++reservedCount;
if(allowReservedFlag){
fossil_warning("WARNING: Windows-reserved "
"filename: %s", zName);
}else{
fossil_warning("ERROR: Windows-reserved filename: %s", zName);
}
}
db_finalize(&q);
if(allowReservedFlag==0){
fossil_fatal("ERROR: %d Windows-reserved filename(s) added. "
"Use --allow-reserved to permit such names.",
reservedCount);
}
}
add_files_in_sfile(vid);
db_end_transaction(0);
}
/*
** This function adds a file to list of files to delete from disk after
** the other actions required for the parent operation have completed
|
| ︙ | ︙ |
Changes to src/db.c.
| ︙ | ︙ | |||
1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 |
alert_find_emailaddr_func, 0, 0);
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);
}
#if USE_SEE
/*
** This is a pointer to the saved database encryption key string.
*/
static char *zSavedKey = 0;
| > > > | 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 |
alert_find_emailaddr_func, 0, 0);
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;
|
| ︙ | ︙ | |||
2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 |
}else{
assert( argc==3 );
assert( rc==0 || rc==1 );
if( sqlite3_value_type(argv[2-rc])==SQLITE_NULL ) rc = 1-rc;
sqlite3_result_value(context, argv[2-rc]);
}
}
/*
** Convert the input string into a artifact hash. Make a notation in the
** CONCEALED table so that the hash can be undo using the db_reveal()
** function at some later time.
**
** The value returned is stored in static space and will be overwritten
| > > > > > > > > > > > > > > > > | 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 |
}else{
assert( argc==3 );
assert( rc==0 || rc==1 );
if( sqlite3_value_type(argv[2-rc])==SQLITE_NULL ) rc = 1-rc;
sqlite3_result_value(context, argv[2-rc]);
}
}
/*
** Implementation of the "win_reserved(X)" SQL function, a wrapper
** for file_is_win_reserved(X) which returns true if X is
** a Windows-reserved filename.
*/
LOCAL void db_win_reserved_func(
sqlite3_context *context,
int argc,
sqlite3_value **argv
){
const char * zName = (const char *)sqlite3_value_text(argv[0]);
if( zName!=0 ){
sqlite3_result_int(context, file_is_win_reserved(zName)!=0);
}
}
/*
** Convert the input string into a artifact hash. Make a notation in the
** CONCEALED table so that the hash can be undo using the db_reveal()
** function at some later time.
**
** The value returned is stored in static space and will be overwritten
|
| ︙ | ︙ |
Changes to src/sqlcmd.c.
| ︙ | ︙ | |||
144 145 146 147 148 149 150 |
int argc,
sqlite3_value **argv
){
gather_artifact_stats(1);
}
/*
| | | | 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 |
int argc,
sqlite3_value **argv
){
gather_artifact_stats(1);
}
/*
** Add the content(), compress(), decompress(), and
** gather_artifact_stats() SQL functions to database connection db.
*/
int add_content_sql_commands(sqlite3 *db){
sqlite3_create_function(db, "content", 1, SQLITE_UTF8, 0,
sqlcmd_content, 0, 0);
sqlite3_create_function(db, "compress", 1, SQLITE_UTF8, 0,
sqlcmd_compress, 0, 0);
sqlite3_create_function(db, "decompress", 1, SQLITE_UTF8, 0,
|
| ︙ | ︙ | |||
169 170 171 172 173 174 175 | ** db_protect(X) ** db_protect_pop(X) ** ** These invoke the corresponding C routines. ** ** WARNING: ** Do not instantiate these functions for any Fossil webpage or command | | | | 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 |
** db_protect(X)
** db_protect_pop(X)
**
** These invoke the corresponding C routines.
**
** WARNING:
** Do not instantiate these functions for any Fossil webpage or command
** method other than the "fossil sql" command. If an attacker gains access
** to these functions, he will be able to disable other defense mechanisms.
**
** This routines are for interactiving testing only. They are experimental
** and undocumented (apart from this comments) and might go away or change
** in future releases.
**
** 2020-11-29: These functions are now only available if the "fossil sql"
** command is started with the --test option.
*/
static void sqlcmd_db_protect(
sqlite3_context *context,
int argc,
sqlite3_value **argv
){
|
| ︙ | ︙ | |||
202 203 204 205 206 207 208 |
static void sqlcmd_db_protect_pop(
sqlite3_context *context,
int argc,
sqlite3_value **argv
){
if( !local_bSqlCmdTest ) db_protect_pop();
}
| < < < | 202 203 204 205 206 207 208 209 210 211 212 213 214 215 |
static void sqlcmd_db_protect_pop(
sqlite3_context *context,
int argc,
sqlite3_value **argv
){
if( !local_bSqlCmdTest ) db_protect_pop();
}
/*
** This is the "automatic extension" initializer that runs right after
** the connection to the repository database is opened. Set up the
** database connection to be more useful to the human operator.
*/
static int sqlcmd_autoinit(
|
| ︙ | ︙ |