|
@@ -274,6 +274,12 @@ int cfg_set_now(cfg_ctx_t *ctx, str *group_name, str *var_name,
|
|
/* look-up the group and the variable */
|
|
/* look-up the group and the variable */
|
|
if (cfg_lookup_var(group_name, var_name, &group, &var))
|
|
if (cfg_lookup_var(group_name, var_name, &group, &var))
|
|
return 1;
|
|
return 1;
|
|
|
|
+
|
|
|
|
+ /* check whether the variable is read-only */
|
|
|
|
+ if (var->def->type & CFG_READONLY) {
|
|
|
|
+ LOG(L_ERR, "ERROR: cfg_set_now(): variable is read-only\n");
|
|
|
|
+ goto error0;
|
|
|
|
+ }
|
|
|
|
|
|
/* check whether we have to convert the type */
|
|
/* check whether we have to convert the type */
|
|
if (convert_val(val_type, val, CFG_INPUT_TYPE(var), &v))
|
|
if (convert_val(val_type, val, CFG_INPUT_TYPE(var), &v))
|
|
@@ -513,6 +519,12 @@ int cfg_set_delayed(cfg_ctx_t *ctx, str *group_name, str *var_name,
|
|
if (cfg_lookup_var(group_name, var_name, &group, &var))
|
|
if (cfg_lookup_var(group_name, var_name, &group, &var))
|
|
return 1;
|
|
return 1;
|
|
|
|
|
|
|
|
+ /* check whether the variable is read-only */
|
|
|
|
+ if (var->def->type & CFG_READONLY) {
|
|
|
|
+ LOG(L_ERR, "ERROR: cfg_set_delayed(): variable is read-only\n");
|
|
|
|
+ goto error0;
|
|
|
|
+ }
|
|
|
|
+
|
|
/* check whether we have to convert the type */
|
|
/* check whether we have to convert the type */
|
|
if (convert_val(val_type, val, CFG_INPUT_TYPE(var), &v))
|
|
if (convert_val(val_type, val, CFG_INPUT_TYPE(var), &v))
|
|
goto error0;
|
|
goto error0;
|