Skip to content
Snippets Groups Projects
Verified Commit fa6a85c1 authored by Vivek Dutta's avatar Vivek Dutta
Browse files

Remove RemoteAccessCapable and updated logging

parent b6f34ac2
Branches
No related tags found
1 merge request!39Remove RemoteAccessCapable and updated logging
Pipeline #204690 passed
......@@ -247,8 +247,37 @@ static int register_config_change(struct ubus_context *uctx)
return 0;
}
static void usage(const char *prog)
{
fprintf(stderr, "Usage: %s [options]\n", prog);
fprintf(stderr, "\n");
fprintf(stderr, "options:\n");
fprintf(stderr, " -l <0-7> Set the loglevel\n");
fprintf(stderr, " -h Displays this help\n");
fprintf(stderr, "\n");
}
int main(int argc, char **argv)
{
int log_level = 7;
int c = 0;
while ((c = getopt(argc, argv, "hl:")) != -1) {
switch (c) {
case 'l':
log_level = (int)strtod(optarg, NULL);
if (log_level < 0 || log_level > 7) {
log_level = 7;
}
break;
case 'h':
usage(argv[0]);
exit(0);
default:
usage(argv[0]);
exit(0);
}
}
load_system_users();
load_system_groups();
......@@ -258,7 +287,7 @@ int main(int argc, char **argv)
create_users();
bbfdm_ubus_set_service_name(&bbfdm_ctx, "usermngr");
bbfdm_ubus_set_log_level(3);
bbfdm_ubus_set_log_level(log_level);
bbfdm_ubus_load_data_model(tDynamicObj);
if (bbfdm_ubus_regiter_init(&bbfdm_ctx))
......
......@@ -810,12 +810,6 @@ static int get_user_password(char *refparam, struct dmctx *ctx, void *data, char
return 0;
}
static int get_user_remote_accessable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
*value = bbf_uci_get_value_by_section_fallback_def(((struct dm_data *)data)->config_section, "remote_access", "1");
return 0;
}
static int get_user_group_participation(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
char *groups = NULL;
......@@ -1165,22 +1159,6 @@ static int set_user_password(char *refparam, struct dmctx *ctx, void *data, char
return 0;
}
static int set_user_remote_accessable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
bool b;
switch (action) {
case VALUECHECK:
if (bbfdm_validate_boolean(ctx, value))
return FAULT_9007;
break;
case VALUESET:
bbf_convert_string_to_bool(value, &b);
bbf_uci_set_value_by_section(((struct dm_data *)data)->config_section, "remote_access", b ? "1" : "0");
break;
}
return 0;
}
static int set_user_group_participation(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
struct dm_reference reference = {0};
......@@ -1425,7 +1403,6 @@ DMLEAF tUsersUserParams[] = {
{"UserID", &DMREAD, DMT_UNINT, get_user_id, NULL, BBFDM_BOTH, DM_FLAG_UNIQUE},
{"Username", &DMWRITE, DMT_STRING, get_param_name, set_user_username, BBFDM_BOTH, DM_FLAG_UNIQUE},
{"Password", &DMWRITE, DMT_STRING, get_user_password, set_user_password, BBFDM_BOTH, DM_FLAG_SECURE},
{"RemoteAccessCapable", &DMWRITE, DMT_BOOL, get_user_remote_accessable, set_user_remote_accessable, BBFDM_BOTH},
{"GroupParticipation", &DMWRITE, DMT_STRING, get_user_group_participation, set_user_group_participation, BBFDM_BOTH, DM_FLAG_REFERENCE},
{"RoleParticipation", &DMWRITE, DMT_STRING, get_role_participation, set_role_participation, BBFDM_BOTH, DM_FLAG_REFERENCE},
{"StaticUser", &DMREAD, DMT_BOOL, get_user_static_user, NULL, BBFDM_BOTH},
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment