Fossil SCM
Correct (non-)fetching of sensitive properties for (non-)Setup users.
Commit
f3d3d1be59728b5dde702a605e9dda556915ea47a019d34205584754846d7eeb
Parent
d0bf9682a91eaed…
1 file changed
+16
-14
+16
-14
| --- src/json_config.c | ||
| +++ src/json_config.c | ||
| @@ -262,13 +262,12 @@ | ||
| 262 | 262 | cson_object_set(jSet, "defaultValue", (pSet->def && pSet->def[0]) |
| 263 | 263 | ? json_new_string(pSet->def) |
| 264 | 264 | : cson_value_null()); |
| 265 | 265 | if( 0==pSet->sensitive || 0!=g.perm.Setup ){ |
| 266 | 266 | if( pSet->versionable ){ |
| 267 | - /* Check to see if this is overridden by a versionable settings file */ | |
| 268 | - Blob versionedPathname; | |
| 269 | - blob_zero(&versionedPathname); | |
| 267 | + /* Check to see if this is overridden by a versionable | |
| 268 | + ** settings file */ | |
| 270 | 269 | if( 0!=zUuid ){ |
| 271 | 270 | /* Attempt to find a versioned setting stored in the given |
| 272 | 271 | ** check-in version. */ |
| 273 | 272 | db_bind_text(&qFoci, ":name", pSet->name); |
| 274 | 273 | if( SQLITE_ROW==db_step(&qFoci) ){ |
| @@ -282,11 +281,14 @@ | ||
| 282 | 281 | blob_reset(&content); |
| 283 | 282 | } |
| 284 | 283 | db_reset(&qFoci); |
| 285 | 284 | } |
| 286 | 285 | if( 0==pSrc && g.localOpen ){ |
| 287 | - /* Pull value from a local .fossil-settings/X file, if one exists. */ | |
| 286 | + /* Pull value from a local .fossil-settings/X file, if one | |
| 287 | + ** exists. */ | |
| 288 | + Blob versionedPathname; | |
| 289 | + blob_zero(&versionedPathname); | |
| 288 | 290 | blob_appendf(&versionedPathname, "%s.fossil-settings/%s", |
| 289 | 291 | g.zLocalRoot, pSet->name); |
| 290 | 292 | if( file_size(blob_str(&versionedPathname), ExtFILE)>=0 ){ |
| 291 | 293 | Blob content; |
| 292 | 294 | blob_zero(&content); |
| @@ -295,20 +297,20 @@ | ||
| 295 | 297 | pVal = json_new_string(blob_str(&content)); |
| 296 | 298 | blob_reset(&content); |
| 297 | 299 | } |
| 298 | 300 | blob_reset(&versionedPathname); |
| 299 | 301 | } |
| 300 | - } | |
| 301 | - if( 0==pSrc ){ | |
| 302 | - /* We had no versioned value, so use the value from | |
| 303 | - ** localdb.vvar or repository.config (in that order). */ | |
| 304 | - db_bind_text(&q, ":name", pSet->name); | |
| 305 | - if( SQLITE_ROW==db_step(&q) ){ | |
| 306 | - pSrc = json_new_string(db_column_text(&q, 0)); | |
| 307 | - pVal = json_new_string(db_column_text(&q, 1)); | |
| 308 | - } | |
| 309 | - db_reset(&q); | |
| 302 | + if( 0==pSrc ){ | |
| 303 | + /* We had no versioned value, so use the value from | |
| 304 | + ** localdb.vvar or repository.config (in that order). */ | |
| 305 | + db_bind_text(&q, ":name", pSet->name); | |
| 306 | + if( SQLITE_ROW==db_step(&q) ){ | |
| 307 | + pSrc = json_new_string(db_column_text(&q, 0)); | |
| 308 | + pVal = json_new_string(db_column_text(&q, 1)); | |
| 309 | + } | |
| 310 | + db_reset(&q); | |
| 311 | + } | |
| 310 | 312 | } |
| 311 | 313 | } |
| 312 | 314 | cson_object_set(jSet, "valueSource", pSrc ? pSrc : cson_value_null()); |
| 313 | 315 | cson_object_set(jSet, "value", pVal ? pVal : cson_value_null()); |
| 314 | 316 | }/*aSetting loop*/ |
| 315 | 317 |
| --- src/json_config.c | |
| +++ src/json_config.c | |
| @@ -262,13 +262,12 @@ | |
| 262 | cson_object_set(jSet, "defaultValue", (pSet->def && pSet->def[0]) |
| 263 | ? json_new_string(pSet->def) |
| 264 | : cson_value_null()); |
| 265 | if( 0==pSet->sensitive || 0!=g.perm.Setup ){ |
| 266 | if( pSet->versionable ){ |
| 267 | /* Check to see if this is overridden by a versionable settings file */ |
| 268 | Blob versionedPathname; |
| 269 | blob_zero(&versionedPathname); |
| 270 | if( 0!=zUuid ){ |
| 271 | /* Attempt to find a versioned setting stored in the given |
| 272 | ** check-in version. */ |
| 273 | db_bind_text(&qFoci, ":name", pSet->name); |
| 274 | if( SQLITE_ROW==db_step(&qFoci) ){ |
| @@ -282,11 +281,14 @@ | |
| 282 | blob_reset(&content); |
| 283 | } |
| 284 | db_reset(&qFoci); |
| 285 | } |
| 286 | if( 0==pSrc && g.localOpen ){ |
| 287 | /* Pull value from a local .fossil-settings/X file, if one exists. */ |
| 288 | blob_appendf(&versionedPathname, "%s.fossil-settings/%s", |
| 289 | g.zLocalRoot, pSet->name); |
| 290 | if( file_size(blob_str(&versionedPathname), ExtFILE)>=0 ){ |
| 291 | Blob content; |
| 292 | blob_zero(&content); |
| @@ -295,20 +297,20 @@ | |
| 295 | pVal = json_new_string(blob_str(&content)); |
| 296 | blob_reset(&content); |
| 297 | } |
| 298 | blob_reset(&versionedPathname); |
| 299 | } |
| 300 | } |
| 301 | if( 0==pSrc ){ |
| 302 | /* We had no versioned value, so use the value from |
| 303 | ** localdb.vvar or repository.config (in that order). */ |
| 304 | db_bind_text(&q, ":name", pSet->name); |
| 305 | if( SQLITE_ROW==db_step(&q) ){ |
| 306 | pSrc = json_new_string(db_column_text(&q, 0)); |
| 307 | pVal = json_new_string(db_column_text(&q, 1)); |
| 308 | } |
| 309 | db_reset(&q); |
| 310 | } |
| 311 | } |
| 312 | cson_object_set(jSet, "valueSource", pSrc ? pSrc : cson_value_null()); |
| 313 | cson_object_set(jSet, "value", pVal ? pVal : cson_value_null()); |
| 314 | }/*aSetting loop*/ |
| 315 |
| --- src/json_config.c | |
| +++ src/json_config.c | |
| @@ -262,13 +262,12 @@ | |
| 262 | cson_object_set(jSet, "defaultValue", (pSet->def && pSet->def[0]) |
| 263 | ? json_new_string(pSet->def) |
| 264 | : cson_value_null()); |
| 265 | if( 0==pSet->sensitive || 0!=g.perm.Setup ){ |
| 266 | if( pSet->versionable ){ |
| 267 | /* Check to see if this is overridden by a versionable |
| 268 | ** settings file */ |
| 269 | if( 0!=zUuid ){ |
| 270 | /* Attempt to find a versioned setting stored in the given |
| 271 | ** check-in version. */ |
| 272 | db_bind_text(&qFoci, ":name", pSet->name); |
| 273 | if( SQLITE_ROW==db_step(&qFoci) ){ |
| @@ -282,11 +281,14 @@ | |
| 281 | blob_reset(&content); |
| 282 | } |
| 283 | db_reset(&qFoci); |
| 284 | } |
| 285 | if( 0==pSrc && g.localOpen ){ |
| 286 | /* Pull value from a local .fossil-settings/X file, if one |
| 287 | ** exists. */ |
| 288 | Blob versionedPathname; |
| 289 | blob_zero(&versionedPathname); |
| 290 | blob_appendf(&versionedPathname, "%s.fossil-settings/%s", |
| 291 | g.zLocalRoot, pSet->name); |
| 292 | if( file_size(blob_str(&versionedPathname), ExtFILE)>=0 ){ |
| 293 | Blob content; |
| 294 | blob_zero(&content); |
| @@ -295,20 +297,20 @@ | |
| 297 | pVal = json_new_string(blob_str(&content)); |
| 298 | blob_reset(&content); |
| 299 | } |
| 300 | blob_reset(&versionedPathname); |
| 301 | } |
| 302 | if( 0==pSrc ){ |
| 303 | /* We had no versioned value, so use the value from |
| 304 | ** localdb.vvar or repository.config (in that order). */ |
| 305 | db_bind_text(&q, ":name", pSet->name); |
| 306 | if( SQLITE_ROW==db_step(&q) ){ |
| 307 | pSrc = json_new_string(db_column_text(&q, 0)); |
| 308 | pVal = json_new_string(db_column_text(&q, 1)); |
| 309 | } |
| 310 | db_reset(&q); |
| 311 | } |
| 312 | } |
| 313 | } |
| 314 | cson_object_set(jSet, "valueSource", pSrc ? pSrc : cson_value_null()); |
| 315 | cson_object_set(jSet, "value", pVal ? pVal : cson_value_null()); |
| 316 | }/*aSetting loop*/ |
| 317 |