bbfdm/dmtree/tr181/lanconfigsecurity.c
Amin Ben Ramdhane cdad11d92d Ticket refs #4386: dm_validate_string in libbbf_api requires length of enumeration and pattern arrays to be hardcoded at caller
- use NULL-terminated arrays instead of providing length by the caller
2021-02-15 21:13:18 +01:00

27 lines
792 B
C

#include "lanconfigsecurity.h"
/*#Device.LANConfigSecurity.ConfigPassword!UCI:users/user,user/password*/
static int get_LANConfigSecurity_ConfigPassword(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
*value = "";
return 0;
}
static int set_LANConfigSecurity_ConfigPassword(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
switch (action) {
case VALUECHECK:
if (dm_validate_string(value, -1, 64, NULL, NULL))
return FAULT_9007;
break;
case VALUESET:
dmuci_set_value("users", "user", "password", value);
break;
}
return 0;
}
DMLEAF tLANConfigSecurityParams[] = {
{"ConfigPassword", &DMWRITE, DMT_STRING, get_LANConfigSecurity_ConfigPassword, set_LANConfigSecurity_ConfigPassword, BBFDM_BOTH},
{0}
};