Fossil SCM

Part of a proposed solution for the problem reported in [forum:6179500deadf6ec7 | forum post 6179500deadf6ec7], in which synching from a repo which is built --with-tcl is not possible if the 'tcl' or 'tcl-setup' settings are set. configure_is_exportable() now returns 0 for any settings which are flagged as sensitive (so they won't be imported). We should also elide all sensitive settings from the server side, but that would not help folks synching from an older server instance built --with-tcl, so we need this half of the fix too.

stephan 2024-10-14 17:01 trunk
Commit d254fcaa9d3eb38cfc5249cfdab72912f9d78670a23b0ab56772dff6a473f7a7
1 file changed +15
--- src/configure.c
+++ src/configure.c
@@ -243,13 +243,23 @@
243243
** information.
244244
*/
245245
int configure_is_exportable(const char *zName){
246246
int i;
247247
int n = strlen(zName);
248
+ Setting *pSet;
248249
if( n>2 && zName[0]=='\'' && zName[n-1]=='\'' ){
250
+ char * zCpy;
249251
zName++;
250252
n -= 2;
253
+ zCpy = fossil_strndup(zName, (ssize_t)n);
254
+ pSet = db_find_setting(zCpy, 0);
255
+ fossil_free(zCpy);
256
+ }else{
257
+ pSet = db_find_setting(zName, 0);
258
+ }
259
+ if( pSet && pSet->sensitive ){
260
+ return 0;
251261
}
252262
for(i=0; i<count(aConfig); i++){
253263
if( strncmp(zName, aConfig[i].zName, n)==0 && aConfig[i].zName[n]==0 ){
254264
int m = aConfig[i].groupMask;
255265
if( !g.perm.Admin ){
@@ -414,10 +424,15 @@
414424
if( nToken>=count(azToken)-1 ) break;
415425
}
416426
if( nToken<2 ) return;
417427
if( aType[ii].zName[0]=='/' ){
418428
thisMask = configure_is_exportable(azToken[1]);
429
+ if( 0==thisMask ){
430
+ fossil_warning("Skipping non-exportable setting: %s = %s",
431
+ azToken[1], nToken>3 ? azToken[3] : "?");
432
+ /* Will be skipped below */
433
+ }
419434
}else{
420435
thisMask = configure_is_exportable(aType[ii].zName);
421436
}
422437
if( (thisMask & groupMask)==0 ) return;
423438
if( (thisMask & checkMask)!=0 ){
424439
--- src/configure.c
+++ src/configure.c
@@ -243,13 +243,23 @@
243 ** information.
244 */
245 int configure_is_exportable(const char *zName){
246 int i;
247 int n = strlen(zName);
 
248 if( n>2 && zName[0]=='\'' && zName[n-1]=='\'' ){
 
249 zName++;
250 n -= 2;
 
 
 
 
 
 
 
 
251 }
252 for(i=0; i<count(aConfig); i++){
253 if( strncmp(zName, aConfig[i].zName, n)==0 && aConfig[i].zName[n]==0 ){
254 int m = aConfig[i].groupMask;
255 if( !g.perm.Admin ){
@@ -414,10 +424,15 @@
414 if( nToken>=count(azToken)-1 ) break;
415 }
416 if( nToken<2 ) return;
417 if( aType[ii].zName[0]=='/' ){
418 thisMask = configure_is_exportable(azToken[1]);
 
 
 
 
 
419 }else{
420 thisMask = configure_is_exportable(aType[ii].zName);
421 }
422 if( (thisMask & groupMask)==0 ) return;
423 if( (thisMask & checkMask)!=0 ){
424
--- src/configure.c
+++ src/configure.c
@@ -243,13 +243,23 @@
243 ** information.
244 */
245 int configure_is_exportable(const char *zName){
246 int i;
247 int n = strlen(zName);
248 Setting *pSet;
249 if( n>2 && zName[0]=='\'' && zName[n-1]=='\'' ){
250 char * zCpy;
251 zName++;
252 n -= 2;
253 zCpy = fossil_strndup(zName, (ssize_t)n);
254 pSet = db_find_setting(zCpy, 0);
255 fossil_free(zCpy);
256 }else{
257 pSet = db_find_setting(zName, 0);
258 }
259 if( pSet && pSet->sensitive ){
260 return 0;
261 }
262 for(i=0; i<count(aConfig); i++){
263 if( strncmp(zName, aConfig[i].zName, n)==0 && aConfig[i].zName[n]==0 ){
264 int m = aConfig[i].groupMask;
265 if( !g.perm.Admin ){
@@ -414,10 +424,15 @@
424 if( nToken>=count(azToken)-1 ) break;
425 }
426 if( nToken<2 ) return;
427 if( aType[ii].zName[0]=='/' ){
428 thisMask = configure_is_exportable(azToken[1]);
429 if( 0==thisMask ){
430 fossil_warning("Skipping non-exportable setting: %s = %s",
431 azToken[1], nToken>3 ? azToken[3] : "?");
432 /* Will be skipped below */
433 }
434 }else{
435 thisMask = configure_is_exportable(aType[ii].zName);
436 }
437 if( (thisMask & groupMask)==0 ) return;
438 if( (thisMask & checkMask)!=0 ){
439

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button