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.
Commit
d254fcaa9d3eb38cfc5249cfdab72912f9d78670a23b0ab56772dff6a473f7a7
Parent
e8d328cbd320e24…
1 file changed
+15
+15
| --- src/configure.c | ||
| +++ src/configure.c | ||
| @@ -243,13 +243,23 @@ | ||
| 243 | 243 | ** information. |
| 244 | 244 | */ |
| 245 | 245 | int configure_is_exportable(const char *zName){ |
| 246 | 246 | int i; |
| 247 | 247 | int n = strlen(zName); |
| 248 | + Setting *pSet; | |
| 248 | 249 | if( n>2 && zName[0]=='\'' && zName[n-1]=='\'' ){ |
| 250 | + char * zCpy; | |
| 249 | 251 | zName++; |
| 250 | 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; | |
| 251 | 261 | } |
| 252 | 262 | for(i=0; i<count(aConfig); i++){ |
| 253 | 263 | if( strncmp(zName, aConfig[i].zName, n)==0 && aConfig[i].zName[n]==0 ){ |
| 254 | 264 | int m = aConfig[i].groupMask; |
| 255 | 265 | if( !g.perm.Admin ){ |
| @@ -414,10 +424,15 @@ | ||
| 414 | 424 | if( nToken>=count(azToken)-1 ) break; |
| 415 | 425 | } |
| 416 | 426 | if( nToken<2 ) return; |
| 417 | 427 | if( aType[ii].zName[0]=='/' ){ |
| 418 | 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 | + } | |
| 419 | 434 | }else{ |
| 420 | 435 | thisMask = configure_is_exportable(aType[ii].zName); |
| 421 | 436 | } |
| 422 | 437 | if( (thisMask & groupMask)==0 ) return; |
| 423 | 438 | if( (thisMask & checkMask)!=0 ){ |
| 424 | 439 |
| --- 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 |