Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | Implement propagating settings that are sent to clients that pull. The warning-policy is used as example, but not yet applied. |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | warn-on-merging-private-branch |
| Files: | files | file ages | folders |
| SHA3-256: |
f812fedc44d831076bc8b00f7e7f9af4 |
| User & Date: | preben 2023-10-16 14:33:52.731 |
Context
|
2023-10-16
| ||
| 14:37 | Add warning-policy setting functionality. check-in: af73acb2df user: preben tags: warn-on-merging-private-branch | |
| 14:33 | Implement propagating settings that are sent to clients that pull. The warning-policy is used as example, but not yet applied. check-in: f812fedc44 user: preben tags: warn-on-merging-private-branch | |
|
2023-10-02
| ||
| 12:46 | Warn user of before merging private to public, or afterwards with --force. check-in: f3fef43c2e user: preben tags: warn-on-merging-private-branch | |
Changes
Changes to src/configure.c.
| ︙ | ︙ | |||
39 40 41 42 43 44 45 46 47 48 49 50 51 52 | #define CONFIGSET_XFER 0x000080 /* Transfer configuration */ #define CONFIGSET_ALIAS 0x000100 /* URL Aliases */ #define CONFIGSET_SCRIBER 0x000200 /* Email subscribers */ #define CONFIGSET_IWIKI 0x000400 /* Interwiki codes */ #define CONFIGSET_ALL 0x0007ff /* Everything */ #define CONFIGSET_OVERWRITE 0x100000 /* Causes overwrite instead of merge */ /* ** This mask is used for the common TH1 configuration settings (i.e. those ** that are not specific to one particular subsystem, such as the transfer ** subsystem). */ #define CONFIGSET_TH1 (CONFIGSET_SKIN|CONFIGSET_TKT|CONFIGSET_XFER) | > | 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | #define CONFIGSET_XFER 0x000080 /* Transfer configuration */ #define CONFIGSET_ALIAS 0x000100 /* URL Aliases */ #define CONFIGSET_SCRIBER 0x000200 /* Email subscribers */ #define CONFIGSET_IWIKI 0x000400 /* Interwiki codes */ #define CONFIGSET_ALL 0x0007ff /* Everything */ #define CONFIGSET_OVERWRITE 0x100000 /* Causes overwrite instead of merge */ #define CONFIGSET_PROPAGATE 0x200000 /* Propagating setting */ /* ** This mask is used for the common TH1 configuration settings (i.e. those ** that are not specific to one particular subsystem, such as the transfer ** subsystem). */ #define CONFIGSET_TH1 (CONFIGSET_SKIN|CONFIGSET_TKT|CONFIGSET_XFER) |
| ︙ | ︙ | |||
179 180 181 182 183 184 185 186 187 188 189 190 191 192 |
{ "@interwiki", CONFIGSET_IWIKI },
{ "xfer-common-script", CONFIGSET_XFER },
{ "xfer-push-script", CONFIGSET_XFER },
{ "xfer-commit-script", CONFIGSET_XFER },
{ "xfer-ticket-script", CONFIGSET_XFER },
};
static int iConfig = 0;
/*
** Return name of first configuration property matching the given mask.
*/
| > | 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 |
{ "@interwiki", CONFIGSET_IWIKI },
{ "xfer-common-script", CONFIGSET_XFER },
{ "xfer-push-script", CONFIGSET_XFER },
{ "xfer-commit-script", CONFIGSET_XFER },
{ "xfer-ticket-script", CONFIGSET_XFER },
{ "warning-policy", CONFIGSET_PROJ | CONFIGSET_PROPAGATE },
};
static int iConfig = 0;
/*
** Return name of first configuration property matching the given mask.
*/
|
| ︙ | ︙ | |||
422 423 424 425 426 427 428 |
if( (thisMask & CONFIGSET_SCRIBER)!=0 ){
alert_schema(1);
}
checkMask &= ~thisMask;
}
blob_zero(&sql);
| | | 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 |
if( (thisMask & CONFIGSET_SCRIBER)!=0 ){
alert_schema(1);
}
checkMask &= ~thisMask;
}
blob_zero(&sql);
if( groupMask & CONFIGSET_OVERWRITE || thisMask & CONFIGSET_PROPAGATE ){
if( (thisMask & configHasBeenReset)==0 && aType[ii].zName[0]!='/' ){
db_multi_exec("DELETE FROM \"%w\"", &aType[ii].zName[1]);
configHasBeenReset |= thisMask;
}
blob_append_sql(&sql, "REPLACE INTO ");
}else{
blob_append_sql(&sql, "INSERT OR IGNORE INTO ");
|
| ︙ | ︙ | |||
695 696 697 698 699 700 701 702 703 704 705 706 707 708 |
}
db_reset(&q);
}
}
db_finalize(&q);
return nCard;
}
/*
** Identify a configuration group by name. Return its mask.
** Throw an error if no match.
*/
int configure_name_to_mask(const char *z, int notFoundIsFatal){
int i;
| > > > > > > > > > > > > > > > > > > | 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 |
}
db_reset(&q);
}
}
db_finalize(&q);
return nCard;
}
/*
** Send the warning-policy, writing it to pOut.
*/
void configure_send_warning_policy(Blob *pOut){
const char *zRec;
zRec = db_text(0,
"SELECT mtime || ' ' || quote(name) || ' value ' || quote(value)"
" FROM config"
" WHERE name='warning-policy'");
if( zRec==0 ){
/* If not set, send the default value. */
zRec = db_text(0,
"SELECT now() || ' ' || quote(%Q) || ' value ' || quote(%Q)",
"warning-policy", db_get("warning-policy", 0));
}
blob_appendf(pOut, "config /config %d\n%s\n", strlen(zRec), zRec);
}
/*
** Identify a configuration group by name. Return its mask.
** Throw an error if no match.
*/
int configure_name_to_mask(const char *z, int notFoundIsFatal){
int i;
|
| ︙ | ︙ |
Changes to src/db.c.
| ︙ | ︙ | |||
4369 4370 4371 4372 4373 4374 4375 4376 4377 4378 4379 4380 4381 4382 |
struct Setting {
const char *name; /* Name of the setting */
const char *var; /* Internal variable name used by db_set() */
int width; /* Width of display. 0 for boolean values and
** negative for values which should not appear
** on the /setup_settings page. */
char versionable; /* Is this setting versionable? */
char forceTextArea; /* Force using a text area for display? */
char sensitive; /* True if this a security-sensitive setting */
const char *def; /* Default value */
};
#endif /* INTERFACE */
/*
| > | 4369 4370 4371 4372 4373 4374 4375 4376 4377 4378 4379 4380 4381 4382 4383 |
struct Setting {
const char *name; /* Name of the setting */
const char *var; /* Internal variable name used by db_set() */
int width; /* Width of display. 0 for boolean values and
** negative for values which should not appear
** on the /setup_settings page. */
char versionable; /* Is this setting versionable? */
char propagating; /* Is this setting propagating? */
char forceTextArea; /* Force using a text area for display? */
char sensitive; /* True if this a security-sensitive setting */
const char *def; /* Default value */
};
#endif /* INTERFACE */
/*
|
| ︙ | ︙ | |||
5014 5015 5016 5017 5018 5019 5020 5021 5022 5023 5024 5025 5026 5027 | /* ** SETTING: large-file-size width=10 default=200000000 ** Fossil considers any file whose size is greater than this value ** to be a "large file". Fossil might issue warnings if you try to ** "add" or "commit" a "large file". Set this value to 0 or less ** to disable all such warnings. */ /* ** Look up a control setting by its name. Return a pointer to the Setting ** object, or NULL if there is no such setting. ** ** If allowPrefix is true, then the Setting returned is the first one for ** which zName is a prefix of the Setting name. | > > > > > > | 5015 5016 5017 5018 5019 5020 5021 5022 5023 5024 5025 5026 5027 5028 5029 5030 5031 5032 5033 5034 |
/*
** SETTING: large-file-size width=10 default=200000000
** Fossil considers any file whose size is greater than this value
** to be a "large file". Fossil might issue warnings if you try to
** "add" or "commit" a "large file". Set this value to 0 or less
** to disable all such warnings.
*/
/*
** SETTING: warning-policy width=40 block-text propagating default={}
** Policy for showing warnings under various conditions.
**
** TODO: Applying the setting. Default reflects intended JSON syntax.
*/
/*
** Look up a control setting by its name. Return a pointer to the Setting
** object, or NULL if there is no such setting.
**
** If allowPrefix is true, then the Setting returned is the first one for
** which zName is a prefix of the Setting name.
|
| ︙ | ︙ | |||
5062 5063 5064 5065 5066 5067 5068 5069 5070 5071 5072 5073 5074 5075 5076 5077 5078 5079 5080 5081 5082 5083 5084 5085 5086 5087 5088 5089 5090 5091 5092 5093 5094 |
** The "settings" command with no arguments lists all settings and their
** values. With just a SETTING name it shows the current value of that setting.
** With a VALUE argument it changes the property for the current repository.
**
** Settings marked as versionable are overridden by the contents of the
** file named .fossil-settings/PROPERTY in the check-out root, if that
** file exists.
**
** The "unset" command clears a setting.
**
** Settings can have both a "local" repository-only value and "global" value
** that applies to all repositories. The local values are stored in the
** "config" table of the repository and the global values are stored in the
** configuration database. If both a local and a global value exists for a
** setting, the local value takes precedence. This command normally operates
** on the local settings. Use the --global option to change global settings.
**
** Options:
** --global Set or unset the given property globally instead of
** setting or unsetting it for the open repository only
** --exact Only consider exact name matches
** --value Only show the value of a given property (implies --exact)
**
** See also: [[configuration]]
*/
void setting_cmd(void){
int i;
int globalFlag = find_option("global","g",0)!=0;
int exactFlag = find_option("exact",0,0)!=0;
int valueFlag = find_option("value",0,0)!=0;
/* Undocumented "--test-for-subsystem SUBSYS" option used to test
** the db_get_for_subsystem() interface: */
const char *zSubsys = find_option("test-for-subsystem",0,1);
| > > > > | 5069 5070 5071 5072 5073 5074 5075 5076 5077 5078 5079 5080 5081 5082 5083 5084 5085 5086 5087 5088 5089 5090 5091 5092 5093 5094 5095 5096 5097 5098 5099 5100 5101 5102 5103 5104 5105 |
** The "settings" command with no arguments lists all settings and their
** values. With just a SETTING name it shows the current value of that setting.
** With a VALUE argument it changes the property for the current repository.
**
** Settings marked as versionable are overridden by the contents of the
** file named .fossil-settings/PROPERTY in the check-out root, if that
** file exists.
**
** Settings marked as propagating will be overridden if a new value is received
** when pulling from a repository.
**
** The "unset" command clears a setting.
**
** Settings can have both a "local" repository-only value and "global" value
** that applies to all repositories. The local values are stored in the
** "config" table of the repository and the global values are stored in the
** configuration database. If both a local and a global value exists for a
** setting, the local value takes precedence. This command normally operates
** on the local settings. Use the --global option to change global settings.
**
** Options:
** --global Set or unset the given property globally instead of
** setting or unsetting it for the open repository only
** --exact Only consider exact name matches
** --value Only show the value of a given property (implies --exact)
**
** See also: [[configuration]]
*/
void setting_cmd(void){
static const char *aLocalOnly[] = { "manifest", "warning-policy" };
int i;
int globalFlag = find_option("global","g",0)!=0;
int exactFlag = find_option("exact",0,0)!=0;
int valueFlag = find_option("value",0,0)!=0;
/* Undocumented "--test-for-subsystem SUBSYS" option used to test
** the db_get_for_subsystem() interface: */
const char *zSubsys = find_option("test-for-subsystem",0,1);
|
| ︙ | ︙ | |||
5121 5122 5123 5124 5125 5126 5127 |
}else if( g.argc==3 || g.argc==4 ){
const char *zName = g.argv[2];
int n = (int)strlen(zName);
const Setting *pSetting = db_find_setting(zName, !exactFlag);
if( pSetting==0 ){
fossil_fatal("no such setting: %s", zName);
}
| | > > | > > < < < | 5132 5133 5134 5135 5136 5137 5138 5139 5140 5141 5142 5143 5144 5145 5146 5147 5148 5149 5150 5151 5152 5153 5154 5155 5156 5157 5158 5159 5160 5161 5162 5163 5164 5165 5166 |
}else if( g.argc==3 || g.argc==4 ){
const char *zName = g.argv[2];
int n = (int)strlen(zName);
const Setting *pSetting = db_find_setting(zName, !exactFlag);
if( pSetting==0 ){
fossil_fatal("no such setting: %s", zName);
}
if( globalFlag ){
for(i=0; i<count(aLocalOnly); i++){
if( fossil_strcmp(pSetting->name, aLocalOnly[i])==0 ){
fossil_fatal("cannot set '%s' globally", aLocalOnly[i]);
}
}
}
if( unsetFlag || g.argc==4 ){
int isManifest = fossil_strcmp(pSetting->name, "manifest")==0;
if( n!=(int)strlen(pSetting[0].name) && pSetting[1].name &&
fossil_strncmp(pSetting[1].name, zName, n)==0 ){
Blob x;
int i;
blob_init(&x,0,0);
for(i=0; pSetting[i].name; i++){
if( fossil_strncmp(pSetting[i].name,zName,n)!=0 ) break;
blob_appendf(&x, " %s", pSetting[i].name);
}
fossil_fatal("ambiguous setting \"%s\" - might be:%s",
zName, blob_str(&x));
}
if( unsetFlag ){
db_unset(pSetting->name/*works-like:"x"*/, globalFlag);
}else{
db_protect_only(PROTECT_NONE);
db_set(pSetting->name/*works-like:"x"*/, g.argv[3], globalFlag);
db_protect_pop();
}
|
| ︙ | ︙ |
Changes to src/dispatch.c.
| ︙ | ︙ | |||
52 53 54 55 56 57 58 59 60 61 62 63 64 65 | #define CMDFLAG_BOOLEAN 0x0100 /* A boolean setting */ #define CMDFLAG_RAWCONTENT 0x0200 /* Do not interpret POST content */ /* NOTE: 0x0400 = CMDFLAG_SENSITIVE in mkindex.c! */ #define CMDFLAG_HIDDEN 0x0800 /* Elide from most listings */ #define CMDFLAG_LDAVG_EXEMPT 0x1000 /* Exempt from load_control() */ #define CMDFLAG_ALIAS 0x2000 /* Command aliases */ #define CMDFLAG_KEEPEMPTY 0x4000 /* Do not unset empty settings */ /**************************************************************************/ /* Values for the 2nd parameter to dispatch_name_search() */ #define CMDFLAG_ANY 0x0038 /* Match anything */ #define CMDFLAG_PREFIX 0x0200 /* Prefix match is ok */ #endif /* INTERFACE */ | > | 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 | #define CMDFLAG_BOOLEAN 0x0100 /* A boolean setting */ #define CMDFLAG_RAWCONTENT 0x0200 /* Do not interpret POST content */ /* NOTE: 0x0400 = CMDFLAG_SENSITIVE in mkindex.c! */ #define CMDFLAG_HIDDEN 0x0800 /* Elide from most listings */ #define CMDFLAG_LDAVG_EXEMPT 0x1000 /* Exempt from load_control() */ #define CMDFLAG_ALIAS 0x2000 /* Command aliases */ #define CMDFLAG_KEEPEMPTY 0x4000 /* Do not unset empty settings */ #define CMDFLAG_PROPAGATES 0x8000 /* Propagates from server to client */ /**************************************************************************/ /* Values for the 2nd parameter to dispatch_name_search() */ #define CMDFLAG_ANY 0x0038 /* Match anything */ #define CMDFLAG_PREFIX 0x0200 /* Prefix match is ok */ #endif /* INTERFACE */ |
| ︙ | ︙ | |||
603 604 605 606 607 608 609 |
fossil_print("# %s\n", aCommand[bktHelp[aCommand[i].iHelp][j]].zName);
fossil_print("%s\n\n", aCommand[i].zHelp);
}else{
Blob txt;
blob_init(&txt, 0, 0);
help_to_text(aCommand[i].zHelp, &txt);
for(j=0; j<occHelp[aCommand[i].iHelp]; j++){
| | | > > | 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 |
fossil_print("# %s\n", aCommand[bktHelp[aCommand[i].iHelp][j]].zName);
fossil_print("%s\n\n", aCommand[i].zHelp);
}else{
Blob txt;
blob_init(&txt, 0, 0);
help_to_text(aCommand[i].zHelp, &txt);
for(j=0; j<occHelp[aCommand[i].iHelp]; j++){
fossil_print("# %s%s%s\n",
aCommand[bktHelp[aCommand[i].iHelp][j]].zName,
(aCommand[i].eCmdFlags & CMDFLAG_VERSIONABLE)!=0 ?
" (versionable)" : "",
(aCommand[i].eCmdFlags & CMDFLAG_PROPAGATES)!=0 ?
" (propagating)" : "");
}
fossil_print("%s\n\n", blob_str(&txt));
blob_reset(&txt);
}
occHelp[aCommand[i].iHelp] = 0;
}
}
|
| ︙ | ︙ | |||
1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 |
zDesc = "web page";
}
}else{
blob_reset(&buf);
if( e & CMDFLAG_VERSIONABLE ){
blob_appendf(&buf, "versionable ");
}
if( e & CMDFLAG_BLOCKTEXT ){
blob_appendf(&buf, "block-text ");
}
if( e & CMDFLAG_BOOLEAN ){
blob_appendf(&buf, "boolean ");
}
blob_appendf(&buf,"setting");
| > > > | 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 |
zDesc = "web page";
}
}else{
blob_reset(&buf);
if( e & CMDFLAG_VERSIONABLE ){
blob_appendf(&buf, "versionable ");
}
if( e & CMDFLAG_PROPAGATES ){
blob_appendf(&buf, "propagating ");
}
if( e & CMDFLAG_BLOCKTEXT ){
blob_appendf(&buf, "block-text ");
}
if( e & CMDFLAG_BOOLEAN ){
blob_appendf(&buf, "boolean ");
}
blob_appendf(&buf,"setting");
|
| ︙ | ︙ | |||
1284 1285 1286 1287 1288 1289 1290 |
}
if( pCmd->eCmdFlags & CMDFLAG_SETTING ){
const Setting *pSetting = db_find_setting(pCmd->zName, 0);
char *zDflt = 0;
if( pSetting!=0 && pSetting->def!=0 && *pSetting->def!=0 ){
zDflt = mprintf(" (default: %s)", pSetting->def);
}
| | | > | 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 |
}
if( pCmd->eCmdFlags & CMDFLAG_SETTING ){
const Setting *pSetting = db_find_setting(pCmd->zName, 0);
char *zDflt = 0;
if( pSetting!=0 && pSetting->def!=0 && *pSetting->def!=0 ){
zDflt = mprintf(" (default: %s)", pSetting->def);
}
fossil_print("Setting: \"%s\"%s%s%s\n\n",
pCmd->zName, zDflt!=0 ? zDflt : "",
(pCmd->eCmdFlags & CMDFLAG_VERSIONABLE)!=0 ? " (versionable)" : "",
(pCmd->eCmdFlags & CMDFLAG_PROPAGATES)!=0 ? " (propagating)" : ""
);
fossil_free(zDflt);
}
blob_init(&txt, 0, 0);
if( useHtml ){
help_to_html(z, &txt);
}else{
|
| ︙ | ︙ |
Changes to src/json_config.c.
| ︙ | ︙ | |||
256 257 258 259 260 261 262 263 264 265 266 267 268 269 |
for(i=0; i<nSetting; ++i){
const Setting *pSet = &aSetting[i];
cson_object * jSet;
cson_value * pVal = 0, * pSrc = 0;
jSet = cson_new_object();
cson_object_set(pay, pSet->name, cson_object_value(jSet));
cson_object_set(jSet, "versionable", cson_value_new_bool(pSet->versionable));
cson_object_set(jSet, "sensitive", cson_value_new_bool(pSet->sensitive));
cson_object_set(jSet, "defaultValue", (pSet->def && pSet->def[0])
? json_new_string(pSet->def)
: cson_value_null());
if( 0==pSet->sensitive || 0!=g.perm.Setup ){
if( pSet->versionable ){
/* Check to see if this is overridden by a versionable
| > | 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 |
for(i=0; i<nSetting; ++i){
const Setting *pSet = &aSetting[i];
cson_object * jSet;
cson_value * pVal = 0, * pSrc = 0;
jSet = cson_new_object();
cson_object_set(pay, pSet->name, cson_object_value(jSet));
cson_object_set(jSet, "versionable", cson_value_new_bool(pSet->versionable));
cson_object_set(jSet, "propagating", cson_value_new_bool(pSet->propagating));
cson_object_set(jSet, "sensitive", cson_value_new_bool(pSet->sensitive));
cson_object_set(jSet, "defaultValue", (pSet->def && pSet->def[0])
? json_new_string(pSet->def)
: cson_value_null());
if( 0==pSet->sensitive || 0!=g.perm.Setup ){
if( pSet->versionable ){
/* Check to see if this is overridden by a versionable
|
| ︙ | ︙ |
Changes to src/setup.c.
| ︙ | ︙ | |||
960 961 962 963 964 965 966 |
db_open_local(0);
}
db_begin_transaction();
@ <p>Settings marked with (v) are "versionable" and will be overridden
@ by the contents of managed files named
@ "<tt>.fossil-settings/</tt><i>SETTING-NAME</i>".
@ If the file for a versionable setting exists, the value cannot be
| | > > > > > > > > > | 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 |
db_open_local(0);
}
db_begin_transaction();
@ <p>Settings marked with (v) are "versionable" and will be overridden
@ by the contents of managed files named
@ "<tt>.fossil-settings/</tt><i>SETTING-NAME</i>".
@ If the file for a versionable setting exists, the value cannot be
@ changed on this screen.</p>
@ <p>Settings marked with (p) are "propagating" and will be overridden
@ if a remote sends an updated setting.</p>
@ <hr><p>
@
@ <form action="%R/setup_settings" method="post"><div>
@ <table border="0"><tr><td valign="top">
login_insert_csrf_secret();
for(i=0, pSet=aSetting; i<nSetting; i++, pSet++){
if( pSet->width==0 ){
int hasVersionableValue = pSet->versionable &&
(db_get_versioned(pSet->name, NULL)!=0);
onoff_attribute("", pSet->name,
pSet->var!=0 ? pSet->var : pSet->name /*works-like:"x"*/,
is_truth(pSet->def), hasVersionableValue);
@ <a href='%R/help?cmd=%s(pSet->name)'>%h(pSet->name)</a>
if( pSet->versionable ){
@ (v)<br>
}else if( pSet->propagating ){
@ (p)<br>
} else {
@ <br>
}
}
}
@ <br><input type="submit" name="submit" value="Apply Changes">
@ </td><td style="width:50px;"></td><td valign="top">
@ <table>
for(i=0, pSet=aSetting; i<nSetting; i++, pSet++){
if( pSet->width>0 && !pSet->forceTextArea ){
int hasVersionableValue = pSet->versionable &&
(db_get_versioned(pSet->name, NULL)!=0);
@ <tr><td>
@ <a href='%R/help?cmd=%s(pSet->name)'>%h(pSet->name)</a>
if( pSet->versionable ){
@ (v)
}else if( pSet->propagating ){
@ (p)<br>
} else {
@
}
@</td><td>
entry_attribute("", /*pSet->width*/ 25, pSet->name,
pSet->var!=0 ? pSet->var : pSet->name /*works-like:"x"*/,
(char*)pSet->def, hasVersionableValue);
@</td></tr>
}
}
@</table>
@ </td><td style="width:50px;"></td><td valign="top">
for(i=0, pSet=aSetting; i<nSetting; i++, pSet++){
if( pSet->width>0 && pSet->forceTextArea ){
int hasVersionableValue = db_get_versioned(pSet->name, NULL)!=0;
@ <a href='%R/help?cmd=%s(pSet->name)'>%s(pSet->name)</a>
if( pSet->versionable ){
@ (v)<br>
}else if( pSet->propagating ){
@ (p)<br>
} else {
@ <br>
}
textarea_attribute("", /*rows*/ 2, /*cols*/ 35, pSet->name,
pSet->var!=0 ? pSet->var : pSet->name /*works-like:"x"*/,
(char*)pSet->def, hasVersionableValue);
@<br>
|
| ︙ | ︙ |
Changes to src/xfer.c.
| ︙ | ︙ | |||
1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 |
if( !g.perm.Read ){
cgi_reset_content();
@ error not\sauthorized\sto\sread
nErr++;
break;
}
isPull = 1;
}else{
if( !g.perm.Write ){
if( !isPull ){
cgi_reset_content();
@ error not\sauthorized\sto\swrite
nErr++;
}else{
| > > | 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 |
if( !g.perm.Read ){
cgi_reset_content();
@ error not\sauthorized\sto\sread
nErr++;
break;
}
isPull = 1;
/* Client is pulling, so may be about to commit or merge. */
configure_send_warning_policy(xfer.pOut);
}else{
if( !g.perm.Write ){
if( !isPull ){
cgi_reset_content();
@ error not\sauthorized\sto\swrite
nErr++;
}else{
|
| ︙ | ︙ | |||
2563 2564 2565 2566 2567 2568 2569 |
if( blob_eq(&xfer.aToken[0],"config") && xfer.nToken==3
&& blob_is_int(&xfer.aToken[2], &size) ){
const char *zName = blob_str(&xfer.aToken[1]);
Blob content;
blob_zero(&content);
blob_extract(xfer.pIn, size, &content);
g.perm.Admin = g.perm.RdAddr = 1;
| | > | 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 |
if( blob_eq(&xfer.aToken[0],"config") && xfer.nToken==3
&& blob_is_int(&xfer.aToken[2], &size) ){
const char *zName = blob_str(&xfer.aToken[1]);
Blob content;
blob_zero(&content);
blob_extract(xfer.pIn, size, &content);
g.perm.Admin = g.perm.RdAddr = 1;
configure_receive(zName, &content,
origConfigRcvMask | CONFIGSET_PROPAGATE);
nCardRcvd++;
nArtifactRcvd++;
blob_reset(&content);
blob_seek(xfer.pIn, 1, BLOB_SEEK_CUR);
}else
|
| ︙ | ︙ |
Changes to tools/mkindex.c.
| ︙ | ︙ | |||
98 99 100 101 102 103 104 105 106 107 108 109 110 111 |
#define CMDFLAG_BOOLEAN 0x0100 /* A boolean setting */
#define CMDFLAG_RAWCONTENT 0x0200 /* Do not interpret webpage content */
#define CMDFLAG_SENSITIVE 0x0400 /* Security-sensitive setting */
#define CMDFLAG_HIDDEN 0x0800 /* Elide from most listings */
#define CMDFLAG_LDAVG_EXEMPT 0x1000 /* Exempt from load_control() */
#define CMDFLAG_ALIAS 0x2000 /* Command aliases */
#define CMDFLAG_KEEPEMPTY 0x4000 /* Do not unset empty settings */
/**************************************************************************/
/*
** Each entry looks like this:
*/
typedef struct Entry {
int eType; /* CMDFLAG_* values */
| > | 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 |
#define CMDFLAG_BOOLEAN 0x0100 /* A boolean setting */
#define CMDFLAG_RAWCONTENT 0x0200 /* Do not interpret webpage content */
#define CMDFLAG_SENSITIVE 0x0400 /* Security-sensitive setting */
#define CMDFLAG_HIDDEN 0x0800 /* Elide from most listings */
#define CMDFLAG_LDAVG_EXEMPT 0x1000 /* Exempt from load_control() */
#define CMDFLAG_ALIAS 0x2000 /* Command aliases */
#define CMDFLAG_KEEPEMPTY 0x4000 /* Do not unset empty settings */
#define CMDFLAG_PROPAGATES 0x8000 /* Propagates from server to client */
/**************************************************************************/
/*
** Each entry looks like this:
*/
typedef struct Entry {
int eType; /* CMDFLAG_* values */
|
| ︙ | ︙ | |||
278 279 280 281 282 283 284 285 286 287 288 289 290 291 |
aEntry[nUsed].zDflt = string_dup(&zLine[i+8], j-8);
}else if( j>9 && strncmp(&zLine[i], "variable=", 9)==0 ){
aEntry[nUsed].zVar = string_dup(&zLine[i+9], j-9);
}else if( j==6 && strncmp(&zLine[i], "hidden", 6)==0 ){
aEntry[nUsed].eType |= CMDFLAG_HIDDEN;
}else if( j==14 && strncmp(&zLine[i], "loadavg-exempt", 14)==0 ){
aEntry[nUsed].eType |= CMDFLAG_LDAVG_EXEMPT;
}else{
fprintf(stderr, "%s:%d: unknown option: '%.*s'\n",
zFile, nLine, j, &zLine[i]);
nErr++;
}
}
| > > | 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 |
aEntry[nUsed].zDflt = string_dup(&zLine[i+8], j-8);
}else if( j>9 && strncmp(&zLine[i], "variable=", 9)==0 ){
aEntry[nUsed].zVar = string_dup(&zLine[i+9], j-9);
}else if( j==6 && strncmp(&zLine[i], "hidden", 6)==0 ){
aEntry[nUsed].eType |= CMDFLAG_HIDDEN;
}else if( j==14 && strncmp(&zLine[i], "loadavg-exempt", 14)==0 ){
aEntry[nUsed].eType |= CMDFLAG_LDAVG_EXEMPT;
}else if( j==11 && strncmp(&zLine[i], "propagating", 11)==0 ){
aEntry[nUsed].eType |= CMDFLAG_PROPAGATES;
}else{
fprintf(stderr, "%s:%d: unknown option: '%.*s'\n",
zFile, nLine, j, &zLine[i]);
nErr++;
}
}
|
| ︙ | ︙ | |||
505 506 507 508 509 510 511 |
}
printf(" { \"%s\",%*s", z, (int)(20-strlen(z)), "");
if( zVar ){
printf(" \"%s\",%*s", zVar, (int)(15-strlen(zVar)), "");
}else{
printf(" 0,%*s", 16, "");
}
| | > | 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 |
}
printf(" { \"%s\",%*s", z, (int)(20-strlen(z)), "");
if( zVar ){
printf(" \"%s\",%*s", zVar, (int)(15-strlen(zVar)), "");
}else{
printf(" 0,%*s", 16, "");
}
printf(" %3d, %d, %d, %d, %d, \"%s\"%*s },\n",
aEntry[i].iWidth,
(aEntry[i].eType & CMDFLAG_VERSIONABLE)!=0,
(aEntry[i].eType & CMDFLAG_PROPAGATES)!=0,
(aEntry[i].eType & CMDFLAG_BLOCKTEXT)!=0,
(aEntry[i].eType & CMDFLAG_SENSITIVE)!=0,
zDef, (int)(10-strlen(zDef)), ""
);
if( aEntry[i].zIf ){
printf("#endif\n");
}
|
| ︙ | ︙ |