Fossil SCM

Correct (non-)fetching of sensitive properties for (non-)Setup users.

stephan 2023-01-19 23:38 json-settings-command
Commit f3d3d1be59728b5dde702a605e9dda556915ea47a019d34205584754846d7eeb
1 file changed +16 -14
+16 -14
--- src/json_config.c
+++ src/json_config.c
@@ -262,13 +262,12 @@
262262
cson_object_set(jSet, "defaultValue", (pSet->def && pSet->def[0])
263263
? json_new_string(pSet->def)
264264
: cson_value_null());
265265
if( 0==pSet->sensitive || 0!=g.perm.Setup ){
266266
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 */
270269
if( 0!=zUuid ){
271270
/* Attempt to find a versioned setting stored in the given
272271
** check-in version. */
273272
db_bind_text(&qFoci, ":name", pSet->name);
274273
if( SQLITE_ROW==db_step(&qFoci) ){
@@ -282,11 +281,14 @@
282281
blob_reset(&content);
283282
}
284283
db_reset(&qFoci);
285284
}
286285
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);
288290
blob_appendf(&versionedPathname, "%s.fossil-settings/%s",
289291
g.zLocalRoot, pSet->name);
290292
if( file_size(blob_str(&versionedPathname), ExtFILE)>=0 ){
291293
Blob content;
292294
blob_zero(&content);
@@ -295,20 +297,20 @@
295297
pVal = json_new_string(blob_str(&content));
296298
blob_reset(&content);
297299
}
298300
blob_reset(&versionedPathname);
299301
}
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
+ }
310312
}
311313
}
312314
cson_object_set(jSet, "valueSource", pSrc ? pSrc : cson_value_null());
313315
cson_object_set(jSet, "value", pVal ? pVal : cson_value_null());
314316
}/*aSetting loop*/
315317
--- 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

Keyboard Shortcuts

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