diff --git a/bin/Makefile.am b/bin/Makefile.am index dfea1131..bcbf0833 100644 --- a/bin/Makefile.am +++ b/bin/Makefile.am @@ -80,7 +80,8 @@ libbbfdm_la_SOURCES += \ ../dmtree/tr181/datamodelversion.c \ ../dmtree/tr181/gre.c \ ../dmtree/tr181/dynamicdns.c \ - ../dmtree/tr181/security.c + ../dmtree/tr181/security.c \ + ../dmtree/tr181/lanconfigsecurity.c endif if GENERIC_OPENWRT diff --git a/dmtree/tr181/device.c b/dmtree/tr181/device.c index 4aa15570..f040ba74 100644 --- a/dmtree/tr181/device.c +++ b/dmtree/tr181/device.c @@ -45,6 +45,7 @@ #include "datamodelversion.h" #include "gre.h" #include "dynamicdns.h" +#include "lanconfigsecurity.h" #include "security.h" #ifdef BBF_TR104 #include "voice_services.h" @@ -106,6 +107,7 @@ DMOBJ tRoot_181_Obj[] = { {"DynamicDNS", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tDynamicDNSObj, tDynamicDNSParams, NULL, BBFDM_BOTH}, {"QoS", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tQoSObj, tQoSParams, NULL, BBFDM_BOTH}, {"XMPP", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tXMPPObj, tXMPPParams, NULL, BBFDM_BOTH}, +{"LANConfigSecurity", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tLANConfigSecurityParams, NULL, BBFDM_BOTH}, #ifdef BBF_TR157 {"BulkData", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tBulkDataObj, tBulkDataParams, NULL, BBFDM_BOTH}, {"SoftwareModules", &DMREAD, NULL, NULL, NULL, NULL, NULL, &DMNONE, NULL, tSoftwareModulesObj, tSoftwareModulesParams, NULL, BBFDM_BOTH}, diff --git a/dmtree/tr181/lanconfigsecurity.c b/dmtree/tr181/lanconfigsecurity.c new file mode 100644 index 00000000..c67ec718 --- /dev/null +++ b/dmtree/tr181/lanconfigsecurity.c @@ -0,0 +1,26 @@ +#include "lanconfigsecurity.h" + +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, 0, NULL, 0)) + 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, NULL, NULL, BBFDM_BOTH}, +{0} +}; diff --git a/dmtree/tr181/lanconfigsecurity.h b/dmtree/tr181/lanconfigsecurity.h new file mode 100644 index 00000000..38ba169c --- /dev/null +++ b/dmtree/tr181/lanconfigsecurity.h @@ -0,0 +1,8 @@ +#ifndef __LANCONFIGSECURITY_H +#define __LANCONFIGSECURITY_H + +#include + +extern DMLEAF tLANConfigSecurityParams[]; + +#endif diff --git a/json/tr181.json b/json/tr181.json index 1e30325a..9092234c 100644 --- a/json/tr181.json +++ b/json/tr181.json @@ -52212,6 +52212,21 @@ { "max": 64 } + ], + "mapping": [ + { + "type": "uci", + "uci": { + "file": "users", + "section": { + "type": "user", + "name": "user" + }, + "option": { + "name": "password" + } + } + } ] } },