From 2a44343127f7396fd55a145409a41d05883600e2 Mon Sep 17 00:00:00 2001 From: Amin Ben Ramdhane Date: Mon, 22 Feb 2021 12:17:15 +0100 Subject: [PATCH] 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 --- dmtree/tr104/servicesvoiceservice.c | 2 +- .../tr104/servicesvoiceservicecallcontrol.c | 10 +- .../tr104/servicesvoiceservicecodecprofile.c | 2 +- dmtree/tr104/servicesvoiceservicepots.c | 2 +- dmtree/tr104/servicesvoiceservicesip.c | 24 ++-- .../tr104/servicesvoiceservicevoipprofile.c | 6 +- dmtree/tr143/diagnostics.c | 50 +++---- dmtree/tr157/softwaremodules.c | 6 +- dmtree/tr181/atm.c | 8 +- dmtree/tr181/bridging.c | 26 ++-- dmtree/tr181/deviceinfo.c | 10 +- dmtree/tr181/dhcpv4.c | 44 +++--- dmtree/tr181/dhcpv6.c | 14 +- dmtree/tr181/dns.c | 20 +-- dmtree/tr181/dsl.c | 6 +- dmtree/tr181/dynamicdns.c | 24 ++-- dmtree/tr181/ethernet.c | 18 +-- dmtree/tr181/firewall.c | 32 ++--- dmtree/tr181/gre.c | 4 +- dmtree/tr181/hosts-iopsyswrt.c | 2 +- dmtree/tr181/hosts-openwrt.c | 2 +- dmtree/tr181/ieee1905.c | 12 +- dmtree/tr181/interfacestack.c | 2 +- dmtree/tr181/ip.c | 28 ++-- dmtree/tr181/lanconfigsecurity.c | 2 +- dmtree/tr181/managementserver.c | 28 ++-- dmtree/tr181/nat.c | 16 +-- dmtree/tr181/ppp.c | 12 +- dmtree/tr181/ptm.c | 2 +- dmtree/tr181/qos-iopsyswrt.c | 40 +++--- dmtree/tr181/qos-openwrt.c | 80 +++++------ dmtree/tr181/routing.c | 20 +-- dmtree/tr181/times.c | 4 +- dmtree/tr181/usb.c | 8 +- dmtree/tr181/userinterface.c | 2 +- dmtree/tr181/users.c | 8 +- dmtree/tr181/wifi.c | 58 ++++---- dmtree/tr181/x_iopsys_eu_buttons.c | 2 +- dmtree/tr181/x_iopsys_eu_dropbear.c | 2 +- dmtree/tr181/x_iopsys_eu_igmp.c | 8 +- dmtree/tr181/x_iopsys_eu_mld.c | 4 +- dmtree/tr181/x_iopsys_eu_owsd.c | 2 +- json/generate_source_code.py | 32 ++--- libbbf_api/dmcommon.c | 130 +++++++++--------- libbbf_api/dmcommon.h | 4 +- 45 files changed, 400 insertions(+), 418 deletions(-) diff --git a/dmtree/tr104/servicesvoiceservice.c b/dmtree/tr104/servicesvoiceservice.c index 0ee82839..a62e0048 100644 --- a/dmtree/tr104/servicesvoiceservice.c +++ b/dmtree/tr104/servicesvoiceservice.c @@ -243,7 +243,7 @@ static int set_service_alias(char *refparam, struct dmctx *ctx, void *data, char { switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 64, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 64, NULL, NULL)) return FAULT_9007; return 0; case VALUESET: diff --git a/dmtree/tr104/servicesvoiceservicecallcontrol.c b/dmtree/tr104/servicesvoiceservicecallcontrol.c index 30398300..ed534455 100644 --- a/dmtree/tr104/servicesvoiceservicecallcontrol.c +++ b/dmtree/tr104/servicesvoiceservicecallcontrol.c @@ -312,7 +312,7 @@ static int set_ServicesVoiceServiceCallControlLine_DirectoryNumber(char *refpara { switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 32, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 32, NULL, NULL)) return FAULT_9007; break; case VALUESET: @@ -342,7 +342,7 @@ static int set_ServicesVoiceServiceCallControlLine_Provider(char *refparam, stru switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 256, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 256, NULL, NULL)) return FAULT_9007; break; case VALUESET: @@ -397,7 +397,7 @@ static int set_ServicesVoiceServiceCallControlIncomingMap_Line(char *refparam, s switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 256, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 256, NULL, NULL)) return FAULT_9007; if ((dup = dmstrdup(value)) == NULL) @@ -443,7 +443,7 @@ static int set_ServicesVoiceServiceCallControlOutgoingMap_CLIPNoScreeningNumber( { switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 32, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 32, NULL, NULL)) return FAULT_9007; break; case VALUESET: @@ -533,7 +533,7 @@ static int set_ServicesVoiceServiceCallControlCallingFeaturesSetSCREJ_CallingNum { switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 32, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 32, NULL, NULL)) return FAULT_9007; break; case VALUESET: diff --git a/dmtree/tr104/servicesvoiceservicecodecprofile.c b/dmtree/tr104/servicesvoiceservicecodecprofile.c index bdb51c20..76163502 100644 --- a/dmtree/tr104/servicesvoiceservicecodecprofile.c +++ b/dmtree/tr104/servicesvoiceservicecodecprofile.c @@ -57,7 +57,7 @@ static int set_ServicesVoiceServiceCodecProfile_PacketizationPeriod(char *refpar { switch (action) { case VALUECHECK: - if (dm_validate_string_list(value, -1, -1, -1, -1, 64, NULL, 0, NULL, 0)) + if (dm_validate_string_list(value, -1, -1, -1, -1, 64, NULL, NULL)) return FAULT_9007; break; case VALUESET: diff --git a/dmtree/tr104/servicesvoiceservicepots.c b/dmtree/tr104/servicesvoiceservicepots.c index 3276b194..24fc3e18 100644 --- a/dmtree/tr104/servicesvoiceservicepots.c +++ b/dmtree/tr104/servicesvoiceservicepots.c @@ -54,7 +54,7 @@ static int set_ServicesVoiceServicePOTS_Region(char *refparam, struct dmctx *ctx { switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 2, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 2, NULL, NULL)) return FAULT_9007; break; case VALUESET: diff --git a/dmtree/tr104/servicesvoiceservicesip.c b/dmtree/tr104/servicesvoiceservicesip.c index d91469c0..63032877 100644 --- a/dmtree/tr104/servicesvoiceservicesip.c +++ b/dmtree/tr104/servicesvoiceservicesip.c @@ -300,7 +300,7 @@ static int set_ServicesVoiceServiceSIPClient_AuthUserName(char *refparam, struct { switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 128, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 128, NULL, NULL)) return FAULT_9007; break; case VALUESET: @@ -321,7 +321,7 @@ static int set_ServicesVoiceServiceSIPClient_AuthPassword(char *refparam, struct { switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 128, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 128, NULL, NULL)) return FAULT_9007; break; case VALUESET: @@ -342,7 +342,7 @@ static int set_ServicesVoiceServiceSIPClient_RegisterURI(char *refparam, struct { switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 389, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 389, NULL, NULL)) return FAULT_9007; break; case VALUESET: @@ -587,7 +587,7 @@ static int set_ServicesVoiceServiceSIPNetwork_ProxyServer(char *refparam, struct { switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 256, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 256, NULL, NULL)) return FAULT_9007; break; case VALUESET: @@ -634,7 +634,7 @@ static int set_ServicesVoiceServiceSIPNetwork_ProxyServerTransport(char *refpara { switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, -1, ProxyServerTransport, 4, NULL, 0)) + if (dm_validate_string(value, -1, -1, ProxyServerTransport, NULL)) return FAULT_9007; break; case VALUESET: @@ -655,7 +655,7 @@ static int set_ServicesVoiceServiceSIPNetwork_RegistrarServer(char *refparam, st { switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 256, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 256, NULL, NULL)) return FAULT_9007; break; case VALUESET: @@ -701,7 +701,7 @@ static int set_ServicesVoiceServiceSIPNetwork_RegistrarServerTransport(char *ref { switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, -1, RegistrarServerTransport, 4, NULL, 0)) + if (dm_validate_string(value, -1, -1, RegistrarServerTransport, NULL)) return FAULT_9007; break; case VALUESET: @@ -722,7 +722,7 @@ static int set_ServicesVoiceServiceSIPNetwork_UserAgentDomain(char *refparam, st { switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 256, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 256, NULL, NULL)) return FAULT_9007; break; case VALUESET: @@ -742,7 +742,7 @@ static int set_ServicesVoiceServiceSIPNetwork_OutboundProxy(char *refparam, stru { switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 256, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 256, NULL, NULL)) return FAULT_9007; break; case VALUESET: @@ -783,7 +783,7 @@ static int set_ServicesVoiceServiceSIPNetwork_STUNServer(char *refparam, struct { switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 256, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 256, NULL, NULL)) return FAULT_9007; break; case VALUESET: @@ -825,7 +825,7 @@ static int set_ServicesVoiceServiceSIPNetwork_Realm(char *refparam, struct dmctx { switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, -1, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, -1, NULL, NULL)) return FAULT_9007; break; case VALUESET: @@ -1002,7 +1002,7 @@ static int set_ServicesVoiceServiceSIPNetworkFQDNServer_Domain(char *refparam, s } switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 256, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 256, NULL, NULL)) return FAULT_9007; break; case VALUESET: diff --git a/dmtree/tr104/servicesvoiceservicevoipprofile.c b/dmtree/tr104/servicesvoiceservicevoipprofile.c index 45fbfbb1..f0e83f3e 100644 --- a/dmtree/tr104/servicesvoiceservicevoipprofile.c +++ b/dmtree/tr104/servicesvoiceservicevoipprofile.c @@ -38,7 +38,7 @@ static int set_ServicesVoiceServiceVoIPProfile_DTMFMethod(char *refparam, struct switch (action) { case VALUECHECK: - if (dm_validate_string_list(value, -1, -1, -1, -1, -1, DTMFMethod, 3, NULL, 0)) + if (dm_validate_string_list(value, -1, -1, -1, -1, -1, DTMFMethod, NULL)) return FAULT_9007; break; case VALUESET: @@ -161,7 +161,7 @@ static int set_ServicesVoiceServiceVoIPProfileRTP_JitterBufferType(char *refpara { switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, -1, JitterBufferType, 2, NULL, 0)) + if (dm_validate_string(value, -1, -1, JitterBufferType, NULL)) return FAULT_9007; break; case VALUESET: @@ -247,7 +247,7 @@ static int set_ServicesVoiceServiceVoIPProfileRTPSRTP_KeyingMethods(char *refpar { switch (action) { case VALUECHECK: - if (dm_validate_string_list(value, -1, -1, -1, -1, -1, KeyingMethods, 4, NULL, 0)) + if (dm_validate_string_list(value, -1, -1, -1, -1, -1, KeyingMethods, NULL)) return FAULT_9007; break; case VALUESET: diff --git a/dmtree/tr143/diagnostics.c b/dmtree/tr143/diagnostics.c index a46505f7..6e53a905 100644 --- a/dmtree/tr143/diagnostics.c +++ b/dmtree/tr143/diagnostics.c @@ -46,7 +46,7 @@ static int set_ip_ping_diagnostics_state(char *refparam, struct dmctx *ctx, void switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, -1, DiagnosticsState, 5, NULL, 0)) + if (dm_validate_string(value, -1, -1, DiagnosticsState, NULL)) return FAULT_9007; return 0; case VALUESET: @@ -76,7 +76,7 @@ static int set_ip_ping_interface(char *refparam, struct dmctx *ctx, void *data, switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 256, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 256, NULL, NULL)) return FAULT_9007; return 0; case VALUESET: @@ -103,7 +103,7 @@ static int set_ip_ping_protocolversion(char *refparam, struct dmctx *ctx, void * switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, -1, ProtocolVersion, 3, NULL, 0)) + if (dm_validate_string(value, -1, -1, ProtocolVersion, NULL)) return FAULT_9007; return 0; case VALUESET: @@ -130,7 +130,7 @@ static int set_ip_ping_host(char *refparam, struct dmctx *ctx, void *data, char switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 256, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 256, NULL, NULL)) return FAULT_9007; return 0; case VALUESET: @@ -327,7 +327,7 @@ static int set_IPDiagnosticsTraceRoute_DiagnosticsState(char *refparam, struct d switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, -1, DiagnosticsState, 5, NULL, 0)) + if (dm_validate_string(value, -1, -1, DiagnosticsState, NULL)) return FAULT_9007; return 0; case VALUESET: @@ -357,7 +357,7 @@ static int set_IPDiagnosticsTraceRoute_Interface(char *refparam, struct dmctx *c switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 256, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 256, NULL, NULL)) return FAULT_9007; return 0; case VALUESET: @@ -384,7 +384,7 @@ static int set_IPDiagnosticsTraceRoute_ProtocolVersion(char *refparam, struct dm switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, -1, ProtocolVersion, 3, NULL, 0)) + if (dm_validate_string(value, -1, -1, ProtocolVersion, NULL)) return FAULT_9007; return 0; case VALUESET: @@ -411,7 +411,7 @@ static int set_IPDiagnosticsTraceRoute_Host(char *refparam, struct dmctx *ctx, v switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 256, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 256, NULL, NULL)) return FAULT_9007; return 0; case VALUESET: @@ -623,7 +623,7 @@ static int set_IPDiagnosticsDownloadDiagnostics_DiagnosticsState(char *refparam, switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, -1, DiagnosticsState, 5, NULL, 0)) + if (dm_validate_string(value, -1, -1, DiagnosticsState, NULL)) return FAULT_9007; return 0; case VALUESET: @@ -659,7 +659,7 @@ static int set_IPDiagnosticsDownloadDiagnostics_Interface(char *refparam, struct switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 256, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 256, NULL, NULL)) return FAULT_9007; return 0; case VALUESET: @@ -696,7 +696,7 @@ static int set_IPDiagnosticsDownloadDiagnostics_DownloadURL(char *refparam, stru struct uci_section *curr_section = NULL; switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 256, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 256, NULL, NULL)) return FAULT_9007; return 0; case VALUESET: @@ -789,7 +789,7 @@ static int set_IPDiagnosticsDownloadDiagnostics_ProtocolVersion(char *refparam, switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, -1, ProtocolVersion, 3, NULL, 0)) + if (dm_validate_string(value, -1, -1, ProtocolVersion, NULL)) return FAULT_9007; return 0; case VALUESET: @@ -1014,7 +1014,7 @@ static int set_IPDiagnosticsUploadDiagnostics_DiagnosticsState(char *refparam, s switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, -1, DiagnosticsState, 5, NULL, 0)) + if (dm_validate_string(value, -1, -1, DiagnosticsState, NULL)) return FAULT_9007; return 0; case VALUESET: @@ -1050,7 +1050,7 @@ static int set_IPDiagnosticsUploadDiagnostics_Interface(char *refparam, struct d switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 256, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 256, NULL, NULL)) return FAULT_9007; return 0; case VALUESET: @@ -1088,7 +1088,7 @@ static int set_IPDiagnosticsUploadDiagnostics_UploadURL(char *refparam, struct d switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 256, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 256, NULL, NULL)) return FAULT_9007; return 0; case VALUESET: @@ -1201,7 +1201,7 @@ static int set_IPDiagnosticsUploadDiagnostics_ProtocolVersion(char *refparam, st switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, -1, ProtocolVersion, 3, NULL, 0)) + if (dm_validate_string(value, -1, -1, ProtocolVersion, NULL)) return FAULT_9007; return 0; case VALUESET: @@ -1426,7 +1426,7 @@ static int set_IPDiagnosticsUDPEchoDiagnostics_DiagnosticsState(char *refparam, switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, -1, DiagnosticsState, 5, NULL, 0)) + if (dm_validate_string(value, -1, -1, DiagnosticsState, NULL)) return FAULT_9007; return 0; case VALUESET: @@ -1456,7 +1456,7 @@ static int set_IPDiagnosticsUDPEchoDiagnostics_Interface(char *refparam, struct switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 256, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 256, NULL, NULL)) return FAULT_9007; return 0; case VALUESET: @@ -1483,7 +1483,7 @@ static int set_IPDiagnosticsUDPEchoDiagnostics_Host(char *refparam, struct dmctx switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 256, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 256, NULL, NULL)) return FAULT_9007; return 0; case VALUESET: @@ -1672,7 +1672,7 @@ static int set_IPDiagnosticsUDPEchoDiagnostics_ProtocolVersion(char *refparam, s switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, -1, ProtocolVersion, 3, NULL, 0)) + if (dm_validate_string(value, -1, -1, ProtocolVersion, NULL)) return FAULT_9007; return 0; case VALUESET: @@ -1743,7 +1743,7 @@ static int set_IPDiagnosticsServerSelectionDiagnostics_DiagnosticsState(char *re switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, -1, DiagnosticsState, 5, NULL, 0)) + if (dm_validate_string(value, -1, -1, DiagnosticsState, NULL)) return FAULT_9007; return 0; case VALUESET: @@ -1773,7 +1773,7 @@ static int set_IPDiagnosticsServerSelectionDiagnostics_Interface(char *refparam, switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 256, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 256, NULL, NULL)) return FAULT_9007; return 0; case VALUESET: @@ -1800,7 +1800,7 @@ static int set_IPDiagnosticsServerSelectionDiagnostics_ProtocolVersion(char *ref switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, -1, ProtocolVersion, 3, NULL, 0)) + if (dm_validate_string(value, -1, -1, ProtocolVersion, NULL)) return FAULT_9007; return 0; case VALUESET: @@ -1827,7 +1827,7 @@ static int set_IPDiagnosticsServerSelectionDiagnostics_Protocol(char *refparam, switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, -1, ServerSelectionProtocol, 2, NULL, 0)) + if (dm_validate_string(value, -1, -1, ServerSelectionProtocol, NULL)) return FAULT_9007; return 0; case VALUESET: @@ -1881,7 +1881,7 @@ static int set_IPDiagnosticsServerSelectionDiagnostics_HostList(char *refparam, switch (action) { case VALUECHECK: - if (dm_validate_string_list(value, -1, 10, -1, -1, 256, NULL, 0, NULL, 0)) + if (dm_validate_string_list(value, -1, 10, -1, -1, 256, NULL, NULL)) return FAULT_9007; return 0; case VALUESET: diff --git a/dmtree/tr157/softwaremodules.c b/dmtree/tr157/softwaremodules.c index 6fe55fad..9a2ff493 100644 --- a/dmtree/tr157/softwaremodules.c +++ b/dmtree/tr157/softwaremodules.c @@ -228,7 +228,7 @@ static int set_SoftwareModulesExecEnv_Alias(char *refparam, struct dmctx *ctx, v switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 64, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 64, NULL, NULL)) return FAULT_9007; break; case VALUESET: @@ -388,7 +388,7 @@ static int set_SoftwareModulesDeploymentUnit_Alias(char *refparam, struct dmctx switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 64, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 64, NULL, NULL)) return FAULT_9007; break; case VALUESET: @@ -559,7 +559,7 @@ static int set_SoftwareModulesExecutionUnit_Alias(char *refparam, struct dmctx * switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 64, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 64, NULL, NULL)) return FAULT_9007; break; case VALUESET: diff --git a/dmtree/tr181/atm.c b/dmtree/tr181/atm.c index 38b24041..52ba11fc 100644 --- a/dmtree/tr181/atm.c +++ b/dmtree/tr181/atm.c @@ -61,7 +61,7 @@ static int set_atm_destination_address(char *refparam, struct dmctx *ctx, void * switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 256, NULL, 0, DestinationAddress, 1)) + if (dm_validate_string(value, -1, 256, NULL, DestinationAddress)) return FAULT_9007; return 0; case VALUESET: @@ -103,7 +103,7 @@ static int set_atm_encapsulation(char *refparam, struct dmctx *ctx, void *data, { switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, -1, Encapsulation, 2, NULL, 0)) + if (dm_validate_string(value, -1, -1, Encapsulation, NULL)) return FAULT_9007; return 0; case VALUESET: @@ -139,7 +139,7 @@ static int set_atm_link_type(char *refparam, struct dmctx *ctx, void *data, char { switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, -1, LinkType, 5, NULL, 0)) + if (dm_validate_string(value, -1, -1, LinkType, NULL)) return FAULT_9007; return 0; case VALUESET: @@ -337,7 +337,7 @@ static int set_atm_alias(char *refparam, struct dmctx *ctx, void *data, char *in switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 64, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 64, NULL, NULL)) return FAULT_9007; return 0; case VALUESET: diff --git a/dmtree/tr181/bridging.c b/dmtree/tr181/bridging.c index 84ce43fd..1b0ed03e 100644 --- a/dmtree/tr181/bridging.c +++ b/dmtree/tr181/bridging.c @@ -1964,7 +1964,7 @@ static int set_BridgingBridge_Alias(char *refparam, struct dmctx *ctx, void *dat switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 64, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 64, NULL, NULL)) return FAULT_9007; return 0; case VALUESET: @@ -1987,7 +1987,7 @@ static int set_BridgingBridge_Standard(char *refparam, struct dmctx *ctx, void * { switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, -1, BridgeStandard, 3, NULL, 0)) + if (dm_validate_string(value, -1, -1, BridgeStandard, NULL)) return FAULT_9007; return 0; case VALUESET: @@ -2109,7 +2109,7 @@ static int set_BridgingBridgePort_Alias(char *refparam, struct dmctx *ctx, void { switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 64, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 64, NULL, NULL)) return FAULT_9007; return 0; case VALUESET: @@ -2198,7 +2198,7 @@ static int set_BridgingBridgePort_LowerLayers(char *refparam, struct dmctx *ctx, switch (action) { case VALUECHECK: - if (dm_validate_string_list(value, -1, -1, 1024, -1, -1, NULL, 0, NULL, 0)) + if (dm_validate_string_list(value, -1, -1, 1024, -1, -1, NULL, NULL)) return FAULT_9007; return 0; case VALUESET: @@ -2735,7 +2735,7 @@ static int set_BridgingBridgeVLAN_Alias(char *refparam, struct dmctx *ctx, void { switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 64, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 64, NULL, NULL)) return FAULT_9007; return 0; case VALUESET: @@ -2756,7 +2756,7 @@ static int set_BridgingBridgeVLAN_Name(char *refparam, struct dmctx *ctx, void * struct uci_section *s = NULL; switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 64, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 64, NULL, NULL)) return FAULT_9007; return 0; case VALUESET: @@ -2884,7 +2884,7 @@ static int set_BridgingBridgeVLANPort_Alias(char *refparam, struct dmctx *ctx, v { switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 64, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 64, NULL, NULL)) return FAULT_9007; break; case VALUESET: @@ -2917,7 +2917,7 @@ static int set_BridgingBridgeVLANPort_VLAN(char *refparam, struct dmctx *ctx, vo switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 256, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 256, NULL, NULL)) return FAULT_9007; return 0; case VALUESET: @@ -3003,7 +3003,7 @@ static int set_BridgingBridgeVLANPort_Port(char *refparam, struct dmctx *ctx, vo switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 256, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 256, NULL, NULL)) return FAULT_9007; return 0; case VALUESET: @@ -3123,7 +3123,7 @@ int set_BridgingBridgeProviderBridge_Type(char *refparam, struct dmctx *ctx, voi { switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, -1, Provider_Bridge_Type, 2, NULL, 0)) + if (dm_validate_string(value, -1, -1, Provider_Bridge_Type, NULL)) return FAULT_9007; break; case VALUESET: @@ -3179,7 +3179,7 @@ static int set_BridgingBridgeProviderBridge_Alias(char *refparam, struct dmctx * { switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 64, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 64, NULL, NULL)) return FAULT_9007; break; case VALUESET: @@ -3205,7 +3205,7 @@ static int set_BridgingBridgeProviderBridge_SVLANcomponent(char *refparam, struc switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 256, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 256, NULL, NULL)) return FAULT_9007; // Validate input value and Check if bridge is present @@ -3262,7 +3262,7 @@ static int set_BridgingBridgeProviderBridge_CVLANcomponents(char *refparam, stru switch (action) { case VALUECHECK: /* Validate received list */ - if (dm_validate_string_list(value, -1, -1, -1, -1, 256, NULL, 0, NULL, 0)) + if (dm_validate_string_list(value, -1, -1, -1, -1, 256, NULL, NULL)) return FAULT_9007; // Validate each item in list and Check if bridge is present diff --git a/dmtree/tr181/deviceinfo.c b/dmtree/tr181/deviceinfo.c index bbac4861..26631c3d 100644 --- a/dmtree/tr181/deviceinfo.c +++ b/dmtree/tr181/deviceinfo.c @@ -160,7 +160,7 @@ static int set_device_provisioningcode(char *refparam, struct dmctx *ctx, void * { switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 64, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 64, NULL, NULL)) return FAULT_9007; return 0; case VALUESET: @@ -257,7 +257,7 @@ static int set_vcf_alias(char *refparam, struct dmctx *ctx, void *data, char *in { switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 64, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 64, NULL, NULL)) return FAULT_9007; return 0; case VALUESET: @@ -295,7 +295,7 @@ static int set_vlf_alias(char *refparam, struct dmctx *ctx, void *data, char *in { switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 64, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 64, NULL, NULL)) return FAULT_9007; return 0; case VALUESET: @@ -429,7 +429,7 @@ static int set_DeviceInfoProcessor_Alias(char *refparam, struct dmctx *ctx, void switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 64, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 64, NULL, NULL)) return FAULT_9007; break; case VALUESET: @@ -510,7 +510,7 @@ static int set_DeviceInfoSupportedDataModel_Alias(char *refparam, struct dmctx * switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 64, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 64, NULL, NULL)) return FAULT_9007; break; case VALUESET: diff --git a/dmtree/tr181/dhcpv4.c b/dmtree/tr181/dhcpv4.c index a79ed98f..11c4cfc1 100644 --- a/dmtree/tr181/dhcpv4.c +++ b/dmtree/tr181/dhcpv4.c @@ -141,7 +141,7 @@ int set_DHCP_Interface(struct dmctx *ctx, char *value, struct uci_section *confi switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 256, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 256, NULL, NULL)) return FAULT_9007; if (value && *value == '\0') @@ -604,7 +604,7 @@ static int set_server_pool_alias(char *refparam, struct dmctx *ctx, void *data, switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 64, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 64, NULL, NULL)) return FAULT_9007; return 0; case VALUESET: @@ -648,7 +648,7 @@ static int set_dns_server(char *refparam, struct dmctx *ctx, void *data, char *i switch (action) { case VALUECHECK: - if (dm_validate_string_list(value, -1, 4, -1, -1, 15, NULL, 0, IPv4Address, 1)) + if (dm_validate_string_list(value, -1, 4, -1, -1, 15, NULL, IPv4Address)) return FAULT_9007; return 0; case VALUESET: @@ -860,7 +860,7 @@ static int set_dhcp_address_min(char *refparam, struct dmctx *ctx, void *data, c switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 15, NULL, 0, IPv4Address, 1)) + if (dm_validate_string(value, -1, 15, NULL, IPv4Address)) return FAULT_9007; return 0; case VALUESET: @@ -908,7 +908,7 @@ static int set_dhcp_address_max(char *refparam, struct dmctx *ctx, void *data, c switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 15, NULL, 0, IPv4Address, 1)) + if (dm_validate_string(value, -1, 15, NULL, IPv4Address)) return FAULT_9007; return 0; case VALUESET: @@ -989,7 +989,7 @@ static int set_dhcp_reserved_addresses(char *refparam, struct dmctx *ctx, void * switch (action) { case VALUECHECK: - if (dm_validate_string_list(value, -1, 32, -1, -1, 15, NULL, 0, IPv4Address, 1)) + if (dm_validate_string_list(value, -1, 32, -1, -1, 15, NULL, IPv4Address)) return FAULT_9007; return 0; case VALUESET: @@ -1055,7 +1055,7 @@ static int set_dhcp_subnetmask(char *refparam, struct dmctx *ctx, void *data, ch switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 15, NULL, 0, IPv4Address, 1)) + if (dm_validate_string(value, -1, 15, NULL, IPv4Address)) return FAULT_9007; return 0; case VALUESET: @@ -1082,7 +1082,7 @@ static int set_dhcp_iprouters(char *refparam, struct dmctx *ctx, void *data, cha switch (action) { case VALUECHECK: - if (dm_validate_string_list(value, -1, 4, -1, -1, 15, NULL, 0, IPv4Address, 1)) + if (dm_validate_string_list(value, -1, 4, -1, -1, 15, NULL, IPv4Address)) return FAULT_9007; return 0; case VALUESET: @@ -1199,7 +1199,7 @@ static int set_dhcp_interface_linker_parameter(char *refparam, struct dmctx *ctx switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 256, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 256, NULL, NULL)) return FAULT_9007; return 0; case VALUESET: @@ -1245,7 +1245,7 @@ static int set_dhcp_domainname(char *refparam, struct dmctx *ctx, void *data, ch switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 64, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 64, NULL, NULL)) return FAULT_9007; return 0; case VALUESET: @@ -1309,7 +1309,7 @@ static int set_dhcp_static_alias(char *refparam, struct dmctx *ctx, void *data, switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 64, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 64, NULL, NULL)) return FAULT_9007; return 0; case VALUESET: @@ -1339,7 +1339,7 @@ static int set_dhcp_staticaddress_chaddr(char *refparam, struct dmctx *ctx, void switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 17, NULL, 0, MACAddress, 1)) + if (dm_validate_string(value, -1, 17, NULL, MACAddress)) return FAULT_9007; return 0; case VALUESET: @@ -1364,7 +1364,7 @@ static int set_dhcp_staticaddress_yiaddr(char *refparam, struct dmctx *ctx, void { switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 15, NULL, 0, IPv4Address, 1)) + if (dm_validate_string(value, -1, 15, NULL, IPv4Address)) return FAULT_9007; return 0; case VALUESET: @@ -1401,7 +1401,7 @@ static int set_dhcp_client_alias(char *refparam, struct dmctx *ctx, void *data, switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 64, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 64, NULL, NULL)) return FAULT_9007; break; case VALUESET: @@ -1514,7 +1514,7 @@ static int set_DHCPv4Client_Alias(char *refparam, struct dmctx *ctx, void *data, { switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 64, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 64, NULL, NULL)) return FAULT_9007; break; case VALUESET: @@ -1743,7 +1743,7 @@ static int set_DHCPv4ClientSentOption_Alias(char *refparam, struct dmctx *ctx, v { switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 64, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 64, NULL, NULL)) return FAULT_9007; break; case VALUESET: @@ -1877,7 +1877,7 @@ static int set_DHCPv4ClientReqOption_Alias(char *refparam, struct dmctx *ctx, vo { switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 64, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 64, NULL, NULL)) return FAULT_9007; break; case VALUESET: @@ -2008,7 +2008,7 @@ static int set_DHCPv4ServerPoolOption_Alias(char *refparam, struct dmctx *ctx, v { switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 64, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 64, NULL, NULL)) return FAULT_9007; break; case VALUESET: @@ -2144,7 +2144,7 @@ static int set_DHCPv4RelayForwarding_Alias(char *refparam, struct dmctx *ctx, vo { switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 64, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 64, NULL, NULL)) return FAULT_9007; break; case VALUESET: @@ -2182,7 +2182,7 @@ static int set_DHCPv4RelayForwarding_VendorClassID(char *refparam, struct dmctx { switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 255, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 255, NULL, NULL)) return FAULT_9007; break; case VALUESET: @@ -2229,7 +2229,7 @@ static int set_DHCPv4RelayForwarding_Chaddr(char *refparam, struct dmctx *ctx, v { switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 17, NULL, 0, MACAddress, 1)) + if (dm_validate_string(value, -1, 17, NULL, MACAddress)) return FAULT_9007; break; case VALUESET: @@ -2274,7 +2274,7 @@ static int set_DHCPv4RelayForwarding_ChaddrMask(char *refparam, struct dmctx *ct { switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 17, NULL, 0, MACAddress, 1)) + if (dm_validate_string(value, -1, 17, NULL, MACAddress)) return FAULT_9007; break; case VALUESET: diff --git a/dmtree/tr181/dhcpv6.c b/dmtree/tr181/dhcpv6.c index b0fabb7d..7cd21365 100644 --- a/dmtree/tr181/dhcpv6.c +++ b/dmtree/tr181/dhcpv6.c @@ -531,7 +531,7 @@ static int set_DHCPv6Client_Alias(char *refparam, struct dmctx *ctx, void *data, { switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 64, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 64, NULL, NULL)) return FAULT_9007; break; case VALUESET: @@ -794,7 +794,7 @@ static int set_DHCPv6ServerPool_Alias(char *refparam, struct dmctx *ctx, void *d switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 64, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 64, NULL, NULL)) return FAULT_9007; return 0; case VALUESET: @@ -850,7 +850,7 @@ static int set_DHCPv6ServerPool_Interface(char *refparam, struct dmctx *ctx, voi switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 256, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 256, NULL, NULL)) return FAULT_9007; break; case VALUESET: @@ -956,7 +956,7 @@ static int set_DHCPv6ServerPool_SourceAddress(char *refparam, struct dmctx *ctx, { switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 45, NULL, 0, IPv6Address, 1)) + if (dm_validate_string(value, -1, 45, NULL, IPv6Address)) return FAULT_9007; break; case VALUESET: @@ -1001,7 +1001,7 @@ static int set_DHCPv6ServerPool_SourceAddressMask(char *refparam, struct dmctx * { switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 45, NULL, 0, IPv6Address, 1)) + if (dm_validate_string(value, -1, 45, NULL, IPv6Address)) return FAULT_9007; break; case VALUESET: @@ -1076,7 +1076,7 @@ static int set_DHCPv6ServerPoolClient_Alias(char *refparam, struct dmctx *ctx, v switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 64, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 64, NULL, NULL)) return FAULT_9007; break; case VALUESET: @@ -1237,7 +1237,7 @@ static int set_DHCPv6ServerPoolOption_Alias(char *refparam, struct dmctx *ctx, v { switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 64, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 64, NULL, NULL)) return FAULT_9007; break; case VALUESET: diff --git a/dmtree/tr181/dns.c b/dmtree/tr181/dns.c index 5fdba742..76b3bdaa 100644 --- a/dmtree/tr181/dns.c +++ b/dmtree/tr181/dns.c @@ -581,7 +581,7 @@ static int set_server_alias(char *refparam, struct dmctx *ctx, void *data, char { switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 64, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 64, NULL, NULL)) return FAULT_9007; break; case VALUESET: @@ -601,7 +601,7 @@ static int set_server_dns_server(char *refparam, struct dmctx *ctx, void *data, switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 45, NULL, 0, IPAddress, 2)) + if (dm_validate_string(value, -1, 45, NULL, IPAddress)) return FAULT_9007; break; case VALUESET: @@ -643,7 +643,7 @@ static int set_server_interface(char *refparam, struct dmctx *ctx, void *data, c switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 256, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 256, NULL, NULL)) return FAULT_9007; break; case VALUESET: @@ -718,7 +718,7 @@ static int set_forwarding_alias(char *refparam, struct dmctx *ctx, void *data, c { switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 64, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 64, NULL, NULL)) return FAULT_9007; break; case VALUESET: @@ -738,7 +738,7 @@ static int set_forwarding_dns_server(char *refparam, struct dmctx *ctx, void *da switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 45, NULL, 0, IPAddress, 2)) + if (dm_validate_string(value, -1, 45, NULL, IPAddress)) return FAULT_9007; break; case VALUESET: @@ -780,7 +780,7 @@ static int set_forwarding_interface(char *refparam, struct dmctx *ctx, void *dat switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 256, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 256, NULL, NULL)) return FAULT_9007; break; case VALUESET: @@ -810,7 +810,7 @@ static int set_nslookupdiagnostics_diagnostics_state(char *refparam, struct dmct switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, -1, DiagnosticsState, 5, NULL, 0)) + if (dm_validate_string(value, -1, -1, DiagnosticsState, NULL)) return FAULT_9007; return 0; case VALUESET: @@ -834,7 +834,7 @@ static int set_nslookupdiagnostics_interface(char *refparam, struct dmctx *ctx, switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 256, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 256, NULL, NULL)) return FAULT_9007; return 0; case VALUESET: @@ -855,7 +855,7 @@ static int set_nslookupdiagnostics_host_name(char *refparam, struct dmctx *ctx, switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 256, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 256, NULL, NULL)) return FAULT_9007; return 0; case VALUESET: @@ -876,7 +876,7 @@ static int set_nslookupdiagnostics_d_n_s_server(char *refparam, struct dmctx *ct switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 256, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 256, NULL, NULL)) return FAULT_9007; return 0; case VALUESET: diff --git a/dmtree/tr181/dsl.c b/dmtree/tr181/dsl.c index 2b1a0ebe..b032e5f0 100644 --- a/dmtree/tr181/dsl.c +++ b/dmtree/tr181/dsl.c @@ -284,7 +284,7 @@ static int set_DSLLine_Alias(char *refparam, struct dmctx *ctx, void *data, char { switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 64, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 64, NULL, NULL)) return FAULT_9007; break; case VALUESET: @@ -310,7 +310,7 @@ static int set_DSLLine_LowerLayers(char *refparam, struct dmctx *ctx, void *data { switch (action) { case VALUECHECK: - if (dm_validate_string_list(value, -1, -1, 1024, -1, -1, NULL, 0, NULL, 0)) + if (dm_validate_string_list(value, -1, -1, 1024, -1, -1, NULL, NULL)) return FAULT_9007; break; case VALUESET: @@ -913,7 +913,7 @@ static int set_DSLChannel_Alias(char *refparam, struct dmctx *ctx, void *data, c { switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 64, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 64, NULL, NULL)) return FAULT_9007; break; case VALUESET: diff --git a/dmtree/tr181/dynamicdns.c b/dmtree/tr181/dynamicdns.c index b7cb5efc..508aaebe 100644 --- a/dmtree/tr181/dynamicdns.c +++ b/dmtree/tr181/dynamicdns.c @@ -413,7 +413,7 @@ static int set_DynamicDNSClient_Alias(char *refparam, struct dmctx *ctx, void *d switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 64, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 64, NULL, NULL)) return FAULT_9007; break; case VALUESET: @@ -477,7 +477,7 @@ static int set_DynamicDNSClient_Server(char *refparam, struct dmctx *ctx, void * switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 256, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 256, NULL, NULL)) return FAULT_9007; break; case VALUESET: @@ -509,7 +509,7 @@ static int set_DynamicDNSClient_Interface(char *refparam, struct dmctx *ctx, voi switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 256, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 256, NULL, NULL)) return FAULT_9007; break; case VALUESET: @@ -535,7 +535,7 @@ static int set_DynamicDNSClient_Username(char *refparam, struct dmctx *ctx, void { switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 256, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 256, NULL, NULL)) return FAULT_9007; break; case VALUESET: @@ -556,7 +556,7 @@ static int set_DynamicDNSClient_Password(char *refparam, struct dmctx *ctx, void { switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 256, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 256, NULL, NULL)) return FAULT_9007; break; case VALUESET: @@ -640,7 +640,7 @@ static int set_DynamicDNSClientHostname_Name(char *refparam, struct dmctx *ctx, { switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 256, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 256, NULL, NULL)) return FAULT_9007; break; case VALUESET: @@ -710,7 +710,7 @@ static int set_DynamicDNSServer_Enable(char *refparam, struct dmctx *ctx, void * switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 64, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 64, NULL, NULL)) return FAULT_9007; break; case VALUESET: @@ -737,7 +737,7 @@ static int set_DynamicDNSServer_Name(char *refparam, struct dmctx *ctx, void *da switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 64, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 64, NULL, NULL)) return FAULT_9007; break; case VALUESET: @@ -764,7 +764,7 @@ static int set_DynamicDNSServer_Alias(char *refparam, struct dmctx *ctx, void *d { switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 64, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 64, NULL, NULL)) return FAULT_9007; break; case VALUESET: @@ -788,7 +788,7 @@ static int set_DynamicDNSServer_ServiceName(char *refparam, struct dmctx *ctx, v switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 256, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 256, NULL, NULL)) return FAULT_9007; break; case VALUESET: @@ -843,7 +843,7 @@ static int set_DynamicDNSServer_ServerAddress(char *refparam, struct dmctx *ctx, switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 256, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 256, NULL, NULL)) return FAULT_9007; break; case VALUESET: @@ -935,7 +935,7 @@ static int set_DynamicDNSServer_Protocol(char *refparam, struct dmctx *ctx, void switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, -1, SupportedProtocols, 2, NULL, 0)) + if (dm_validate_string(value, -1, -1, SupportedProtocols, NULL)) return FAULT_9007; break; case VALUESET: diff --git a/dmtree/tr181/ethernet.c b/dmtree/tr181/ethernet.c index 8020b766..67c635a2 100644 --- a/dmtree/tr181/ethernet.c +++ b/dmtree/tr181/ethernet.c @@ -575,7 +575,7 @@ static int set_EthernetInterface_Alias(char *refparam, struct dmctx *ctx, void * switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 64, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 64, NULL, NULL)) return FAULT_9007; return 0; case VALUESET: @@ -625,7 +625,7 @@ static int set_EthernetInterface_LowerLayers(char *refparam, struct dmctx *ctx, { switch (action) { case VALUECHECK: - if (dm_validate_string_list(value, -1, -1, 1024, -1, -1, NULL, 0, NULL, 0)) + if (dm_validate_string_list(value, -1, -1, 1024, -1, -1, NULL, NULL)) return FAULT_9007; break; case VALUESET: @@ -726,7 +726,7 @@ static int set_EthernetInterface_DuplexMode(char *refparam, struct dmctx *ctx, v { switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, -1, DuplexMode, 3, NULL, 0)) + if (dm_validate_string(value, -1, -1, DuplexMode, NULL)) return FAULT_9007; return 0; case VALUESET: @@ -913,7 +913,7 @@ static int set_EthernetLink_Alias(char *refparam, struct dmctx *ctx, void *data, { switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 64, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 64, NULL, NULL)) return FAULT_9007; break; case VALUESET: @@ -988,7 +988,7 @@ static int set_EthernetLink_LowerLayers(char *refparam, struct dmctx *ctx, void switch (action) { case VALUECHECK: - if (dm_validate_string_list(value, -1, -1, 1024, -1, -1, NULL, 0, NULL, 0)) + if (dm_validate_string_list(value, -1, -1, 1024, -1, -1, NULL, NULL)) return FAULT_9007; break; case VALUESET: @@ -1157,7 +1157,7 @@ static int set_EthernetVLANTermination_Alias(char *refparam, struct dmctx *ctx, switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 64, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 64, NULL, NULL)) return FAULT_9007; return 0; case VALUESET: @@ -1222,7 +1222,7 @@ static int set_EthernetVLANTermination_LowerLayers(char *refparam, struct dmctx switch (action) { case VALUECHECK: - if (dm_validate_string_list(value, -1, -1, 1024, -1, -1, NULL, 0, NULL, 0)) + if (dm_validate_string_list(value, -1, -1, 1024, -1, -1, NULL, NULL)) return FAULT_9007; break; case VALUESET: @@ -1634,7 +1634,7 @@ static int set_EthernetRMONStats_Alias(char *refparam, struct dmctx *ctx, void * switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 64, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 64, NULL, NULL)) return FAULT_9007; break; case VALUESET: @@ -1667,7 +1667,7 @@ static int set_EthernetRMONStats_Interface(char *refparam, struct dmctx *ctx, vo { switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, -1, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, -1, NULL, NULL)) return FAULT_9007; break; case VALUESET: diff --git a/dmtree/tr181/firewall.c b/dmtree/tr181/firewall.c index 134b5f77..b84b0c3c 100644 --- a/dmtree/tr181/firewall.c +++ b/dmtree/tr181/firewall.c @@ -653,7 +653,7 @@ static int set_firewall_config(char *refparam, struct dmctx *ctx, void *data, ch { switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, -1, Config, 4, NULL, 0)) + if (dm_validate_string(value, -1, -1, Config, NULL)) return FAULT_9007; break; case VALUESET: @@ -668,7 +668,7 @@ static int set_firewall_advanced_level(char *refparam, struct dmctx *ctx, void * { switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, -1, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, -1, NULL, NULL)) return FAULT_9007; break; case VALUESET: @@ -683,7 +683,7 @@ static int set_level_alias(char *refparam, struct dmctx *ctx, void *data, char * { switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 64, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 64, NULL, NULL)) return FAULT_9007; break; case VALUESET: @@ -697,7 +697,7 @@ static int set_level_name(char *refparam, struct dmctx *ctx, void *data, char *i { switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 64, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 64, NULL, NULL)) return FAULT_9007; break; case VALUESET: @@ -711,7 +711,7 @@ static int set_level_description(char *refparam, struct dmctx *ctx, void *data, { switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 256, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 256, NULL, NULL)) return FAULT_9007; break; case VALUESET: @@ -796,7 +796,7 @@ static int set_chain_alias(char *refparam, struct dmctx *ctx, void *data, char * { switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 64, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 64, NULL, NULL)) return FAULT_9007; break; case VALUESET: @@ -810,7 +810,7 @@ static int set_chain_name(char *refparam, struct dmctx *ctx, void *data, char *i { switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 64, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 64, NULL, NULL)) return FAULT_9007; break; case VALUESET: @@ -856,7 +856,7 @@ static int set_rule_alias(char *refparam, struct dmctx *ctx, void *data, char *i switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 64, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 64, NULL, NULL)) return FAULT_9007; break; case VALUESET: @@ -871,7 +871,7 @@ static int set_rule_description(char *refparam, struct dmctx *ctx, void *data, c { switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 256, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 256, NULL, NULL)) return FAULT_9007; break; case VALUESET: @@ -885,7 +885,7 @@ static int set_rule_target(char *refparam, struct dmctx *ctx, void *data, char * { switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, -1, Target, 5, NULL, 0)) + if (dm_validate_string(value, -1, -1, Target, NULL)) return FAULT_9007; break; case VALUESET: @@ -910,7 +910,7 @@ static int set_rule_source_interface(char *refparam, struct dmctx *ctx, void *da switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 256, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 256, NULL, NULL)) return FAULT_9007; append_dot_to_string(interface, value, sizeof(interface)); @@ -944,7 +944,7 @@ static int set_rule_dest_interface(char *refparam, struct dmctx *ctx, void *data switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 256, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 256, NULL, NULL)) return FAULT_9007; break; case VALUESET: @@ -995,7 +995,7 @@ static int set_rule_dest_ip(char *refparam, struct dmctx *ctx, void *data, char switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 45, NULL, 0, IPAddress, 2)) + if (dm_validate_string(value, -1, 45, NULL, IPAddress)) return FAULT_9007; break; case VALUESET: @@ -1018,7 +1018,7 @@ static int set_rule_dest_mask(char *refparam, struct dmctx *ctx, void *data, cha switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 49, NULL, 0, IPPrefix, 3)) + if (dm_validate_string(value, -1, 49, NULL, IPPrefix)) return FAULT_9007; break; case VALUESET: @@ -1040,7 +1040,7 @@ static int set_rule_source_ip(char *refparam, struct dmctx *ctx, void *data, cha switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 45, NULL, 0, IPAddress, 2)) + if (dm_validate_string(value, -1, 45, NULL, IPAddress)) return FAULT_9007; break; case VALUESET: @@ -1063,7 +1063,7 @@ static int set_rule_source_mask(char *refparam, struct dmctx *ctx, void *data, c switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 49, NULL, 0, IPPrefix, 3)) + if (dm_validate_string(value, -1, 49, NULL, IPPrefix)) return FAULT_9007; break; case VALUESET: diff --git a/dmtree/tr181/gre.c b/dmtree/tr181/gre.c index d76dae72..c7ee8d8c 100644 --- a/dmtree/tr181/gre.c +++ b/dmtree/tr181/gre.c @@ -259,7 +259,7 @@ static int set_GRETunnel_Alias(char *refparam, struct dmctx *ctx, void *data, ch switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 64, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 64, NULL, NULL)) return FAULT_9007; break; case VALUESET: @@ -364,7 +364,7 @@ static int set_GRETunnelInterface_Alias(char *refparam, struct dmctx *ctx, void switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 64, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 64, NULL, NULL)) return FAULT_9007; break; case VALUESET: diff --git a/dmtree/tr181/hosts-iopsyswrt.c b/dmtree/tr181/hosts-iopsyswrt.c index 99fc2325..8d057365 100644 --- a/dmtree/tr181/hosts-iopsyswrt.c +++ b/dmtree/tr181/hosts-iopsyswrt.c @@ -113,7 +113,7 @@ int os__set_HostsHost_Alias(char *refparam, struct dmctx *ctx, void *data, char switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 64, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 64, NULL, NULL)) return FAULT_9007; break; case VALUESET: diff --git a/dmtree/tr181/hosts-openwrt.c b/dmtree/tr181/hosts-openwrt.c index a0e3e007..6d7b1738 100644 --- a/dmtree/tr181/hosts-openwrt.c +++ b/dmtree/tr181/hosts-openwrt.c @@ -49,7 +49,7 @@ int os__set_HostsHost_Alias(char *refparam, struct dmctx *ctx, void *data, char { switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 64, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 64, NULL, NULL)) return FAULT_9007; break; case VALUESET: diff --git a/dmtree/tr181/ieee1905.c b/dmtree/tr181/ieee1905.c index 82ffd423..e47f94aa 100644 --- a/dmtree/tr181/ieee1905.c +++ b/dmtree/tr181/ieee1905.c @@ -504,7 +504,7 @@ static int set_IEEE1905ALInterface_PowerState(char *refparam, struct dmctx *ctx, { switch (action) { case VALUECHECK: - //if (dm_validate_string(value, -1, -1, PowerState, 4, NULL, 0)) + //if (dm_validate_string(value, -1, -1, PowerState, NULL)) // return FAULT_9007; break; case VALUESET: @@ -705,7 +705,7 @@ static int set_IEEE1905ALForwardingTableForwardingRule_InterfaceList(char *refpa { switch (action) { case VALUECHECK: - if (dm_validate_string_list(value, -1, -1, -1, -1, 256, NULL, 0, NULL, 0)) + if (dm_validate_string_list(value, -1, -1, -1, -1, 256, NULL, NULL)) return FAULT_9007; break; case VALUESET: @@ -726,7 +726,7 @@ static int set_IEEE1905ALForwardingTableForwardingRule_MACDestinationAddress(cha { switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 17, NULL, 0, MACAddress, 1)) + if (dm_validate_string(value, -1, 17, NULL, MACAddress)) return FAULT_9007; break; case VALUESET: @@ -771,7 +771,7 @@ static int set_IEEE1905ALForwardingTableForwardingRule_MACSourceAddress(char *re { switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 17, NULL, 0, MACAddress, 1)) + if (dm_validate_string(value, -1, 17, NULL, MACAddress)) return FAULT_9007; break; case VALUESET: @@ -1491,7 +1491,7 @@ static int set_IEEE1905ALSecurity_SetupMethod(char *refparam, struct dmctx *ctx, { switch (action) { case VALUECHECK: - if (dm_validate_string_list(value, -1, -1, 1024, -1, -1, NULL, 3, NULL, 0)) + if (dm_validate_string_list(value, -1, -1, 1024, -1, -1, NULL, NULL)) return FAULT_9007; break; case VALUESET: @@ -1512,7 +1512,7 @@ static int set_IEEE1905ALSecurity_Password(char *refparam, struct dmctx *ctx, vo { switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, -1, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, -1, NULL, NULL)) return FAULT_9007; break; case VALUESET: diff --git a/dmtree/tr181/interfacestack.c b/dmtree/tr181/interfacestack.c index a268ad2f..8ae8a12e 100644 --- a/dmtree/tr181/interfacestack.c +++ b/dmtree/tr181/interfacestack.c @@ -825,7 +825,7 @@ static int set_InterfaceStack_Alias(char *refparam, struct dmctx *ctx, void *dat switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 64, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 64, NULL, NULL)) return FAULT_9007; break; case VALUESET: diff --git a/dmtree/tr181/ip.c b/dmtree/tr181/ip.c index b86c27a6..600888bd 100644 --- a/dmtree/tr181/ip.c +++ b/dmtree/tr181/ip.c @@ -1129,7 +1129,7 @@ static int set_IP_ULAPrefix(char *refparam, struct dmctx *ctx, void *data, char { switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 49, NULL, 0, IPv6Prefix, 1)) + if (dm_validate_string(value, -1, 49, NULL, IPv6Prefix)) return FAULT_9007; break; case VALUESET: @@ -1266,7 +1266,7 @@ static int set_IPInterface_Alias(char *refparam, struct dmctx *ctx, void *data, switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 64, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 64, NULL, NULL)) return FAULT_9007; break; case VALUESET: @@ -1335,7 +1335,7 @@ static int set_IPInterface_LowerLayers(char *refparam, struct dmctx *ctx, void * switch (action) { case VALUECHECK: - if (dm_validate_string_list(value, -1, -1, 1024, -1, -1, NULL, 0, NULL, 0)) + if (dm_validate_string_list(value, -1, -1, 1024, -1, -1, NULL, NULL)) return FAULT_9007; break; case VALUESET: @@ -1460,7 +1460,7 @@ static int set_IPInterface_Router(char *refparam, struct dmctx *ctx, void *data, { switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 256, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 256, NULL, NULL)) return FAULT_9007; break; case VALUESET: @@ -1658,7 +1658,7 @@ static int set_IPInterfaceIPv4Address_Alias(char *refparam, struct dmctx *ctx, v switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 64, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 64, NULL, NULL)) return FAULT_9007; break; case VALUESET: @@ -1692,7 +1692,7 @@ static int set_IPInterfaceIPv4Address_IPAddress(char *refparam, struct dmctx *ct switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 15, NULL, 0, IPv4Address, 1)) + if (dm_validate_string(value, -1, 15, NULL, IPv4Address)) return FAULT_9007; break; case VALUESET: @@ -1727,7 +1727,7 @@ static int set_IPInterfaceIPv4Address_SubnetMask(char *refparam, struct dmctx *c switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 15, NULL, 0, IPv4Address, 1)) + if (dm_validate_string(value, -1, 15, NULL, IPv4Address)) return FAULT_9007; break; case VALUESET: @@ -1850,7 +1850,7 @@ static int set_IPInterfaceIPv6Address_Alias(char *refparam, struct dmctx *ctx, v { switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 64, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 64, NULL, NULL)) return FAULT_9007; break; case VALUESET: @@ -1875,7 +1875,7 @@ static int set_IPInterfaceIPv6Address_IPAddress(char *refparam, struct dmctx *ct switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 45, NULL, 0, IPv6Address, 1)) + if (dm_validate_string(value, -1, 45, NULL, IPv6Address)) return FAULT_9007; break; case VALUESET: @@ -1931,7 +1931,7 @@ static int set_IPInterfaceIPv6Address_Prefix(char *refparam, struct dmctx *ctx, { switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, -1, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, -1, NULL, NULL)) return FAULT_9007; break; case VALUESET: @@ -2054,7 +2054,7 @@ static int set_IPInterfaceIPv6Prefix_Alias(char *refparam, struct dmctx *ctx, vo { switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 64, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 64, NULL, NULL)) return FAULT_9007; break; case VALUESET: @@ -2077,7 +2077,7 @@ static int set_IPInterfaceIPv6Prefix_Prefix(char *refparam, struct dmctx *ctx, v switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 49, NULL, 0, IPv6Prefix, 1)) + if (dm_validate_string(value, -1, 49, NULL, IPv6Prefix)) return FAULT_9007; break; case VALUESET: @@ -2122,7 +2122,7 @@ static int set_IPInterfaceIPv6Prefix_ParentPrefix(char *refparam, struct dmctx * { switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, -1, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, -1, NULL, NULL)) return FAULT_9007; break; case VALUESET: @@ -2149,7 +2149,7 @@ static int set_IPInterfaceIPv6Prefix_ChildPrefixBits(char *refparam, struct dmct { switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 49, NULL, 0, IPv6Prefix, 1)) + if (dm_validate_string(value, -1, 49, NULL, IPv6Prefix)) return FAULT_9007; break; case VALUESET: diff --git a/dmtree/tr181/lanconfigsecurity.c b/dmtree/tr181/lanconfigsecurity.c index c67ec718..abe51d4a 100644 --- a/dmtree/tr181/lanconfigsecurity.c +++ b/dmtree/tr181/lanconfigsecurity.c @@ -10,7 +10,7 @@ static int set_LANConfigSecurity_ConfigPassword(char *refparam, struct dmctx *ct { switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 64, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 64, NULL, NULL)) return FAULT_9007; break; case VALUESET: diff --git a/dmtree/tr181/managementserver.c b/dmtree/tr181/managementserver.c index 9015b036..0ecb9498 100644 --- a/dmtree/tr181/managementserver.c +++ b/dmtree/tr181/managementserver.c @@ -35,7 +35,7 @@ static int set_management_server_url(char *refparam, struct dmctx *ctx, void *da { switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 256, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 256, NULL, NULL)) return FAULT_9007; break; case VALUESET: @@ -58,7 +58,7 @@ static int set_management_server_username(char *refparam, struct dmctx *ctx, voi { switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 256, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 256, NULL, NULL)) return FAULT_9007; return 0; case VALUESET: @@ -74,7 +74,7 @@ static int set_management_server_passwd(char *refparam, struct dmctx *ctx, void { switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 256, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 256, NULL, NULL)) return FAULT_9007; return 0; case VALUESET: @@ -205,7 +205,7 @@ static int set_management_server_connection_request_username(char *refparam, str { switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 256, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 256, NULL, NULL)) return FAULT_9007; return 0; case VALUESET: @@ -221,7 +221,7 @@ static int set_management_server_connection_request_passwd(char *refparam, struc { switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 256, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 256, NULL, NULL)) return FAULT_9007; return 0; case VALUESET: @@ -276,7 +276,7 @@ static int set_lwn_protocol_used(char *refparam, struct dmctx *ctx, void *data, { switch (action) { case VALUECHECK: - if (dm_validate_string_list(value, -1, -1, -1, -1, -1, NULL, 0, NULL, 0)) + if (dm_validate_string_list(value, -1, -1, -1, -1, -1, NULL, NULL)) return FAULT_9007; return 0; case VALUESET: @@ -301,7 +301,7 @@ static int set_lwn_host(char *refparam, struct dmctx *ctx, void *data, char *ins { switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 256, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 256, NULL, NULL)) return FAULT_9007; return 0; case VALUESET: @@ -351,7 +351,7 @@ static int set_management_server_http_compression(char *refparam, struct dmctx * { switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, -1, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, -1, NULL, NULL)) return FAULT_9007; return 0; case VALUESET: @@ -427,7 +427,7 @@ static int set_instance_mode(char *refparam, struct dmctx *ctx, void *data, char { switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, -1, InstanceMode, 2, NULL, 0)) + if (dm_validate_string(value, -1, -1, InstanceMode, NULL)) return FAULT_9007; return 0; case VALUESET: @@ -483,7 +483,7 @@ static int set_stun_server_address(char *refparam, struct dmctx *ctx, void *data { switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 256, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 256, NULL, NULL)) return FAULT_9007; return 0; case VALUESET: @@ -525,7 +525,7 @@ static int set_stun_username(char *refparam, struct dmctx *ctx, void *data, char { switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 256, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 256, NULL, NULL)) return FAULT_9007; return 0; case VALUESET: @@ -546,7 +546,7 @@ static int set_stun_password(char *refparam, struct dmctx *ctx, void *data, char { switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 256, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 256, NULL, NULL)) return FAULT_9007; return 0; case VALUESET: @@ -627,7 +627,7 @@ static int set_management_server_conn_rep_allowed_jabber_id(char *refparam, stru { switch (action) { case VALUECHECK: - if (dm_validate_string_list(value, -1, 32, -1, -1, 256, NULL, 0, NULL, 0)) + if (dm_validate_string_list(value, -1, 32, -1, -1, 256, NULL, NULL)) return FAULT_9007; return 0; case VALUESET: @@ -677,7 +677,7 @@ static int set_management_server_conn_req_xmpp_connection(char *refparam, struct switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, -1, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, -1, NULL, NULL)) return FAULT_9007; return 0; case VALUESET: diff --git a/dmtree/tr181/nat.c b/dmtree/tr181/nat.c index 6433fee5..11ae19af 100644 --- a/dmtree/tr181/nat.c +++ b/dmtree/tr181/nat.c @@ -207,7 +207,7 @@ static int set_nat_interface_setting_alias(char *refparam, struct dmctx *ctx, vo switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 64, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 64, NULL, NULL)) return FAULT_9007; return 0; case VALUESET: @@ -247,7 +247,7 @@ static int set_nat_interface_setting_interface(char *refparam, struct dmctx *ctx switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 256, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 256, NULL, NULL)) return FAULT_9007; return 0; case VALUESET: @@ -319,7 +319,7 @@ static int set_nat_port_mapping_alias(char *refparam, struct dmctx *ctx, void *d switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 64, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 64, NULL, NULL)) return FAULT_9007; return 0; case VALUESET: @@ -367,7 +367,7 @@ static int set_nat_port_mapping_interface(char *refparam, struct dmctx *ctx, voi switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 256, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 256, NULL, NULL)) return FAULT_9007; break; case VALUESET: @@ -399,7 +399,7 @@ static int set_nat_port_mapping_remote_host(char *refparam, struct dmctx *ctx, v { switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, -1, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, -1, NULL, NULL)) return FAULT_9007; return 0; case VALUESET: @@ -520,7 +520,7 @@ static int set_nat_port_mapping_protocol(char *refparam, struct dmctx *ctx, void { switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, -1, NATProtocol, 3, NULL, 0)) + if (dm_validate_string(value, -1, -1, NATProtocol, NULL)) return FAULT_9007; return 0; case VALUESET: @@ -546,7 +546,7 @@ static int set_nat_port_mapping_internal_client(char *refparam, struct dmctx *ct { switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 256, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 256, NULL, NULL)) return FAULT_9007; return 0; case VALUESET: @@ -567,7 +567,7 @@ static int set_nat_port_mapping_description(char *refparam, struct dmctx *ctx, v { switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 256, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 256, NULL, NULL)) return FAULT_9007; return 0; case VALUESET: diff --git a/dmtree/tr181/ppp.c b/dmtree/tr181/ppp.c index 13054d88..acd8691b 100644 --- a/dmtree/tr181/ppp.c +++ b/dmtree/tr181/ppp.c @@ -34,7 +34,7 @@ static int set_ppp_alias(char *refparam, struct dmctx *ctx, void *data, char *in switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 64, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 64, NULL, NULL)) return FAULT_9007; return 0; case VALUESET: @@ -175,7 +175,7 @@ static int set_ppp_username(char *refparam, struct dmctx *ctx, void *data, char { switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 64, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 64, NULL, NULL)) return FAULT_9007; return 0; case VALUESET: @@ -190,7 +190,7 @@ static int set_ppp_password(char *refparam, struct dmctx *ctx, void *data, char { switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 64, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 64, NULL, NULL)) return FAULT_9007; return 0; case VALUESET: @@ -289,7 +289,7 @@ static int set_ppp_lower_layer(char *refparam, struct dmctx *ctx, void *data, ch switch (action) { case VALUECHECK: - if (dm_validate_string_list(value, -1, -1, 1024, -1, -1, NULL, 0, NULL, 0)) + if (dm_validate_string_list(value, -1, -1, 1024, -1, -1, NULL, NULL)) return FAULT_9007; return 0; case VALUESET: @@ -338,7 +338,7 @@ static int set_PPPInterfacePPPoE_ACName(char *refparam, struct dmctx *ctx, void switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 256, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 256, NULL, NULL)) return FAULT_9007; dmuci_get_value_by_section_string(((struct uci_section *)data), "proto", &proto); @@ -370,7 +370,7 @@ static int set_PPPInterfacePPPoE_ServiceName(char *refparam, struct dmctx *ctx, switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 256, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 256, NULL, NULL)) return FAULT_9007; dmuci_get_value_by_section_string(((struct uci_section *)data), "proto", &proto); diff --git a/dmtree/tr181/ptm.c b/dmtree/tr181/ptm.c index c264b38e..4e940c6e 100644 --- a/dmtree/tr181/ptm.c +++ b/dmtree/tr181/ptm.c @@ -226,7 +226,7 @@ static int set_ptm_alias(char *refparam, struct dmctx *ctx, void *data, char *in switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 64, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 64, NULL, NULL)) return FAULT_9007; return 0; case VALUESET: diff --git a/dmtree/tr181/qos-iopsyswrt.c b/dmtree/tr181/qos-iopsyswrt.c index eb587917..2f81a5c0 100644 --- a/dmtree/tr181/qos-iopsyswrt.c +++ b/dmtree/tr181/qos-iopsyswrt.c @@ -871,7 +871,7 @@ int os_set_QoSClassification_DestMask(char *refparam, struct dmctx *ctx, void *d case VALUECHECK: if (value[0] == '\0') break; - if (dm_validate_string(value, -1, 49 , NULL, 0, IPPrefix, 3) != 0) + if (dm_validate_string(value, -1, 49 , NULL, IPPrefix)) return FAULT_9007; break; case VALUESET: @@ -949,7 +949,7 @@ int os_set_QoSClassification_SourceMask(char *refparam, struct dmctx *ctx, void case VALUECHECK: if (value[0] == '\0') break; - if (dm_validate_string(value, -1, 49 , NULL, 0, IPPrefix, 3) != 0) + if (dm_validate_string(value, -1, 49 , NULL, IPPrefix)) return FAULT_9007; break; case VALUESET: @@ -1009,7 +1009,7 @@ int os_set_QoSClassification_Alias(char *refparam, struct dmctx *ctx, void *data switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 64, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 64, NULL, NULL)) return FAULT_9007; break; case VALUESET: @@ -1045,7 +1045,7 @@ int os_set_QoSClassification_Interface(char *refparam, struct dmctx *ctx, void * switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 256, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 256, NULL, NULL)) return FAULT_9007; break; case VALUESET: @@ -1073,9 +1073,7 @@ int os_set_QoSClassification_DestIP(char *refparam, struct dmctx *ctx, void *dat switch (action) { case VALUECHECK: - if (value[0] == '\0') - break; - else if (dm_validate_string(value, -1, 45 , NULL, 0, IPAddress, 2) != 0) + if (dm_validate_string(value, -1, 45 , NULL, IPAddress)) return FAULT_9007; break; case VALUESET: @@ -1113,9 +1111,7 @@ int os_set_QoSClassification_SourceIP(char *refparam, struct dmctx *ctx, void *d switch (action) { case VALUECHECK: - if (value[0] == '\0') - break; - else if (dm_validate_string(value, -1, 45 , NULL, 0, IPAddress, 2) != 0) + if (dm_validate_string(value, -1, 45 , NULL, IPAddress)) return FAULT_9007; break; case VALUESET: @@ -1285,7 +1281,7 @@ int os_set_QoSClassification_SourceMACAddress(char *refparam, struct dmctx *ctx, { switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 17, NULL, 0, MACAddress, 1)) + if (dm_validate_string(value, -1, 17, NULL, MACAddress)) return FAULT_9007; break; case VALUESET: @@ -1341,7 +1337,7 @@ int os_set_QoSClassification_DestMACAddress(char *refparam, struct dmctx *ctx, v { switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 17, NULL, 0, MACAddress, 1)) + if (dm_validate_string(value, -1, 17, NULL, MACAddress)) return FAULT_9007; break; case VALUESET: @@ -1580,7 +1576,7 @@ int os_set_QoSClassification_SourceVendorClassID(char *refparam, struct dmctx *c { switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 255, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 255, NULL, NULL)) return FAULT_9007; break; case VALUESET: @@ -1657,7 +1653,7 @@ int os_set_QoSClassification_DestVendorClassID(char *refparam, struct dmctx *ctx { switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 255, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 255, NULL, NULL)) return FAULT_9007; break; case VALUESET: @@ -2448,7 +2444,7 @@ int os_set_QoSClassification_Policer(char *refparam, struct dmctx *ctx, void *da char policer[256] = {0}; switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 64, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 64, NULL, NULL)) return FAULT_9007; break; case VALUESET: @@ -2947,7 +2943,7 @@ int os_set_QoSPolicer_Alias(char *refparam, struct dmctx *ctx, void *data, char struct uci_section *dmmap_section = NULL; switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 64, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 64, NULL, NULL)) return FAULT_9007; break; case VALUESET: @@ -3243,7 +3239,7 @@ int os_set_QoSQueue_Alias(char *refparam, struct dmctx *ctx, void *data, char *i struct uci_section *dmmap_section = NULL; switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 64, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 64, NULL, NULL)) return FAULT_9007; break; case VALUESET: @@ -3297,7 +3293,7 @@ int os_set_QoSQueue_Interface(char *refparam, struct dmctx *ctx, void *data, cha switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 256, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 256, NULL, NULL)) return FAULT_9007; break; case VALUESET: @@ -3445,7 +3441,7 @@ int os_set_QoSQueue_DropAlgorithm(char *refparam, struct dmctx *ctx, void *data, case VALUECHECK: break; case VALUESET: - if (dm_validate_string(value, -1, -1, DropAlgorithm, 4, NULL, 0)) + if (dm_validate_string(value, -1, -1, DropAlgorithm, NULL)) return FAULT_9007; break; } @@ -3463,7 +3459,7 @@ int os_set_QoSQueue_SchedulerAlgorithm(char *refparam, struct dmctx *ctx, void * { switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, -1, SchedulerAlgorithm, 3, NULL, 0)) + if (dm_validate_string(value, -1, -1, SchedulerAlgorithm, NULL)) return FAULT_9007; break; case VALUESET: @@ -3676,7 +3672,7 @@ int os_set_QoSShaper_Alias(char *refparam, struct dmctx *ctx, void *data, char * switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 64, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 64, NULL, NULL)) return FAULT_9007; break; case VALUESET: @@ -3711,7 +3707,7 @@ int os_set_QoSShaper_Interface(char *refparam, struct dmctx *ctx, void *data, ch switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 256, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 256, NULL, NULL)) return FAULT_9007; break; case VALUESET: diff --git a/dmtree/tr181/qos-openwrt.c b/dmtree/tr181/qos-openwrt.c index 796749a4..823373d2 100644 --- a/dmtree/tr181/qos-openwrt.c +++ b/dmtree/tr181/qos-openwrt.c @@ -574,7 +574,7 @@ int set_QoS_DefaultPolicer(char *refparam, struct dmctx *ctx, void *data, char * { switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 256, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 256, NULL, NULL)) return FAULT_9007; break; case VALUESET: @@ -603,7 +603,7 @@ int set_QoS_DefaultQueue(char *refparam, struct dmctx *ctx, void *data, char *in switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 256, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 256, NULL, NULL)) return FAULT_9007; break; case VALUESET: @@ -754,7 +754,7 @@ int os_set_QoSClassification_Alias(char *refparam, struct dmctx *ctx, void *data switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 64, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 64, NULL, NULL)) return FAULT_9007; break; case VALUESET: @@ -775,7 +775,7 @@ int set_QoSClassification_DHCPType(char *refparam, struct dmctx *ctx, void *data { switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, -1, DHCPType, 2, NULL, 0)) + if (dm_validate_string(value, -1, -1, DHCPType, NULL)) return FAULT_9007; break; case VALUESET: @@ -823,7 +823,7 @@ int os_set_QoSClassification_Interface(char *refparam, struct dmctx *ctx, void * { switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 256, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 256, NULL, NULL)) return FAULT_9007; break; case VALUESET: @@ -865,7 +865,7 @@ int os_set_QoSClassification_DestMask(char *refparam, struct dmctx *ctx, void *d { switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 49, NULL, 0, IPPrefix, 3)) + if (dm_validate_string(value, -1, 49, NULL, IPPrefix)) return FAULT_9007; break; case VALUESET: @@ -906,7 +906,7 @@ int os_set_QoSClassification_SourceMask(char *refparam, struct dmctx *ctx, void { switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 49, NULL, 0, IPPrefix, 3)) + if (dm_validate_string(value, -1, 49, NULL, IPPrefix)) return FAULT_9007; break; case VALUESET: @@ -991,7 +991,7 @@ int os_set_QoSClassification_DestIP(char *refparam, struct dmctx *ctx, void *dat switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 45, NULL, 0, IPAddress, 2)) + if (dm_validate_string(value, -1, 45, NULL, IPAddress)) return FAULT_9007; break; case VALUESET: @@ -1017,7 +1017,7 @@ int os_set_QoSClassification_SourceIP(char *refparam, struct dmctx *ctx, void *d switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 45, NULL, 0, IPAddress, 2)) + if (dm_validate_string(value, -1, 45, NULL, IPAddress)) return FAULT_9007; break; case VALUESET: @@ -1174,7 +1174,7 @@ int os_set_QoSClassification_SourceMACAddress(char *refparam, struct dmctx *ctx, { switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 17, NULL, 0, MACAddress, 1)) + if (dm_validate_string(value, -1, 17, NULL, MACAddress)) return FAULT_9007; break; case VALUESET: @@ -1194,7 +1194,7 @@ int set_QoSClassification_SourceMACMask(char *refparam, struct dmctx *ctx, void { switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 17, NULL, 0, MACAddress, 1)) + if (dm_validate_string(value, -1, 17, NULL, MACAddress)) return FAULT_9007; break; case VALUESET: @@ -1235,7 +1235,7 @@ int os_set_QoSClassification_DestMACAddress(char *refparam, struct dmctx *ctx, v { switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 17, NULL, 0, MACAddress, 1)) + if (dm_validate_string(value, -1, 17, NULL, MACAddress)) return FAULT_9007; break; case VALUESET: @@ -1255,7 +1255,7 @@ int set_QoSClassification_DestMACMask(char *refparam, struct dmctx *ctx, void *d { switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 17, NULL, 0, MACAddress, 1)) + if (dm_validate_string(value, -1, 17, NULL, MACAddress)) return FAULT_9007; break; case VALUESET: @@ -1496,7 +1496,7 @@ int os_set_QoSClassification_SourceVendorClassID(char *refparam, struct dmctx *c { switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 255, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 255, NULL, NULL)) return FAULT_9007; break; case VALUESET: @@ -1556,7 +1556,7 @@ int set_QoSClassification_SourceVendorClassIDMode(char *refparam, struct dmctx * { switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, -1, VendorClassIDMode, 4, NULL, 0)) + if (dm_validate_string(value, -1, -1, VendorClassIDMode, NULL)) return FAULT_9007; break; case VALUESET: @@ -1576,7 +1576,7 @@ int os_set_QoSClassification_DestVendorClassID(char *refparam, struct dmctx *ctx { switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 255, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 255, NULL, NULL)) return FAULT_9007; break; case VALUESET: @@ -1636,7 +1636,7 @@ int set_QoSClassification_DestVendorClassIDMode(char *refparam, struct dmctx *ct { switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, -1, VendorClassIDMode, 4, NULL, 0)) + if (dm_validate_string(value, -1, -1, VendorClassIDMode, NULL)) return FAULT_9007; break; case VALUESET: @@ -2406,7 +2406,7 @@ int os_set_QoSClassification_Policer(char *refparam, struct dmctx *ctx, void *da { switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 256, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 256, NULL, NULL)) return FAULT_9007; break; case VALUESET: @@ -2426,7 +2426,7 @@ int set_QoSClassification_App(char *refparam, struct dmctx *ctx, void *data, cha { switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 256, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 256, NULL, NULL)) return FAULT_9007; break; case VALUESET: @@ -2472,7 +2472,7 @@ int set_QoSApp_Alias(char *refparam, struct dmctx *ctx, void *data, char *instan { switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 64, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 64, NULL, NULL)) return FAULT_9007; break; case VALUESET: @@ -2492,7 +2492,7 @@ int set_QoSApp_ProtocolIdentifier(char *refparam, struct dmctx *ctx, void *data, { switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 256, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 256, NULL, NULL)) return FAULT_9007; break; case VALUESET: @@ -2512,7 +2512,7 @@ int set_QoSApp_Name(char *refparam, struct dmctx *ctx, void *data, char *instanc { switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 64, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 64, NULL, NULL)) return FAULT_9007; break; case VALUESET: @@ -2572,7 +2572,7 @@ int set_QoSApp_DefaultPolicer(char *refparam, struct dmctx *ctx, void *data, cha { switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 256, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 256, NULL, NULL)) return FAULT_9007; break; case VALUESET: @@ -2678,7 +2678,7 @@ int set_QoSFlow_Alias(char *refparam, struct dmctx *ctx, void *data, char *insta { switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 64, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 64, NULL, NULL)) return FAULT_9007; break; case VALUESET: @@ -2698,7 +2698,7 @@ int set_QoSFlow_Type(char *refparam, struct dmctx *ctx, void *data, char *instan { switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 256, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 256, NULL, NULL)) return FAULT_9007; break; case VALUESET: @@ -2718,7 +2718,7 @@ int set_QoSFlow_TypeParameters(char *refparam, struct dmctx *ctx, void *data, ch { switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 256, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 256, NULL, NULL)) return FAULT_9007; break; case VALUESET: @@ -2738,7 +2738,7 @@ int set_QoSFlow_Name(char *refparam, struct dmctx *ctx, void *data, char *instan { switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 64, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 64, NULL, NULL)) return FAULT_9007; break; case VALUESET: @@ -2758,7 +2758,7 @@ int set_QoSFlow_App(char *refparam, struct dmctx *ctx, void *data, char *instanc { switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 256, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 256, NULL, NULL)) return FAULT_9007; break; case VALUESET: @@ -2818,7 +2818,7 @@ int set_QoSFlow_Policer(char *refparam, struct dmctx *ctx, void *data, char *ins { switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 256, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 256, NULL, NULL)) return FAULT_9007; break; case VALUESET: @@ -2921,7 +2921,7 @@ int os_set_QoSPolicer_Alias(char *refparam, struct dmctx *ctx, void *data, char { switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 64, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 64, NULL, NULL)) return FAULT_9007; break; case VALUESET: @@ -3035,7 +3035,7 @@ int os_set_QoSPolicer_MeterType(char *refparam, struct dmctx *ctx, void *data, c { switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, -1, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, -1, NULL, NULL)) return FAULT_9007; break; case VALUESET: @@ -3060,7 +3060,7 @@ int set_QoSPolicer_ConformingAction(char *refparam, struct dmctx *ctx, void *dat { switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, -1, NULL, 0, ConformingAction, 5)) + if (dm_validate_string(value, -1, -1, NULL, ConformingAction)) return FAULT_9007; break; case VALUESET: @@ -3080,7 +3080,7 @@ int set_QoSPolicer_PartialConformingAction(char *refparam, struct dmctx *ctx, vo { switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, -1, NULL, 0, ConformingAction, 5)) + if (dm_validate_string(value, -1, -1, NULL, ConformingAction)) return FAULT_9007; break; case VALUESET: @@ -3100,7 +3100,7 @@ int set_QoSPolicer_NonConformingAction(char *refparam, struct dmctx *ctx, void * { switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, -1, NULL, 0, ConformingAction, 5)) + if (dm_validate_string(value, -1, -1, NULL, ConformingAction)) return FAULT_9007; break; case VALUESET: @@ -3498,7 +3498,7 @@ int set_QoSQueue_DropAlgorithm(char *refparam, struct dmctx *ctx, void *data, ch { switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, -1, DropAlgorithm, 4, NULL, 0)) + if (dm_validate_string(value, -1, -1, DropAlgorithm, NULL)) return FAULT_9007; break; case VALUESET: @@ -3598,7 +3598,7 @@ int set_QoSQueueStats_Queue(char *refparam, struct dmctx *ctx, void *data, char { switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 256, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 256, NULL, NULL)) return FAULT_9007; break; case VALUESET: @@ -3624,7 +3624,7 @@ int os_set_QoSQueueStats_Alias(char *refparam, struct dmctx *ctx, void *data, ch switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 64, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 64, NULL, NULL)) return FAULT_9007; break; case VALUESET: @@ -3654,7 +3654,7 @@ int os_set_QoSQueueStats_Interface(char *refparam, struct dmctx *ctx, void *data { switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 256, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 256, NULL, NULL)) return FAULT_9007; break; case VALUESET: @@ -3766,7 +3766,7 @@ int set_QoSShaper_Alias(char *refparam, struct dmctx *ctx, void *data, char *ins switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 64, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 64, NULL, NULL)) return FAULT_9007; break; case VALUESET: @@ -3812,7 +3812,7 @@ int set_QoSShaper_Interface(char *refparam, struct dmctx *ctx, void *data, char { switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 256, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 256, NULL, NULL)) return FAULT_9007; break; case VALUESET: diff --git a/dmtree/tr181/routing.c b/dmtree/tr181/routing.c index 71735745..40d22e87 100644 --- a/dmtree/tr181/routing.c +++ b/dmtree/tr181/routing.c @@ -560,7 +560,7 @@ static int set_router_ipv4forwarding_destip(char *refparam, struct dmctx *ctx, v { switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 15, NULL, 0, IPv4Address, 1)) + if (dm_validate_string(value, -1, 15, NULL, IPv4Address)) return FAULT_9007; return 0; case VALUESET: @@ -581,7 +581,7 @@ static int set_router_ipv4forwarding_destmask(char *refparam, struct dmctx *ctx, { switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 15, NULL, 0, IPv4Address, 1)) + if (dm_validate_string(value, -1, 15, NULL, IPv4Address)) return FAULT_9007; return 0; case VALUESET: @@ -625,7 +625,7 @@ static int set_router_ipv4forwarding_gatewayip(char *refparam, struct dmctx *ctx { switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 15, NULL, 0, IPv4Address, 1)) + if (dm_validate_string(value, -1, 15, NULL, IPv4Address)) return FAULT_9007; return 0; case VALUESET: @@ -655,7 +655,7 @@ static int set_router_ipv4forwarding_interface_linker_parameter(char *refparam, switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 256, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 256, NULL, NULL)) return FAULT_9007; return 0; case VALUESET: @@ -727,7 +727,7 @@ static int set_RoutingRouterIPv6Forwarding_DestIPPrefix(char *refparam, struct d { switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 49, NULL, 0, IPv6Prefix, 1)) + if (dm_validate_string(value, -1, 49, NULL, IPv6Prefix)) return FAULT_9007; return 0; case VALUESET: @@ -767,7 +767,7 @@ static int set_RoutingRouterIPv6Forwarding_NextHop(char *refparam, struct dmctx { switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 45, NULL, 0, IPv6Address, 1)) + if (dm_validate_string(value, -1, 45, NULL, IPv6Address)) return FAULT_9007; return 0; case VALUESET: @@ -797,7 +797,7 @@ static int set_RoutingRouterIPv6Forwarding_Interface(char *refparam, struct dmct switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 256, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 256, NULL, NULL)) return FAULT_9007; return 0; case VALUESET: @@ -999,7 +999,7 @@ static int set_RoutingRouter_Alias(char *refparam, struct dmctx *ctx, void *data { switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 64, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 64, NULL, NULL)) return FAULT_9007; return 0; case VALUESET: @@ -1031,7 +1031,7 @@ static int set_router_ipv4forwarding_alias(char *refparam, struct dmctx *ctx, vo switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 64, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 64, NULL, NULL)) return FAULT_9007; return 0; case VALUESET: @@ -1067,7 +1067,7 @@ static int set_RoutingRouterIPv6Forwarding_Alias(char *refparam, struct dmctx *c switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 64, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 64, NULL, NULL)) return FAULT_9007; return 0; case VALUESET: diff --git a/dmtree/tr181/times.c b/dmtree/tr181/times.c index 362c3706..4a873171 100644 --- a/dmtree/tr181/times.c +++ b/dmtree/tr181/times.c @@ -80,7 +80,7 @@ static int set_time_LocalTimeZone(char *refparam, struct dmctx *ctx, void *data, { switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 256, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 256, NULL, NULL)) return FAULT_9007; break; case VALUESET: @@ -192,7 +192,7 @@ static int set_time_ntpserver(char *refparam, struct dmctx *ctx, int action, cha switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 64, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 64, NULL, NULL)) return FAULT_9007; return 0; case VALUESET: diff --git a/dmtree/tr181/usb.c b/dmtree/tr181/usb.c index 274ca588..23180779 100644 --- a/dmtree/tr181/usb.c +++ b/dmtree/tr181/usb.c @@ -512,7 +512,7 @@ static int set_USBInterface_Alias(char *refparam, struct dmctx *ctx, void *data, struct usb_interface *usbiface= (struct usb_interface *)data; switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 64, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 64, NULL, NULL)) return FAULT_9007; break; case VALUESET: @@ -541,7 +541,7 @@ static int set_USBInterface_LowerLayers(char *refparam, struct dmctx *ctx, void { switch (action) { case VALUECHECK: - if (dm_validate_string_list(value, -1, -1, 1024, -1, -1, NULL, 0, NULL, 0)) + if (dm_validate_string_list(value, -1, -1, 1024, -1, -1, NULL, NULL)) return FAULT_9007; break; case VALUESET: @@ -619,7 +619,7 @@ static int set_USBPort_Alias(char *refparam, struct dmctx *ctx, void *data, char struct usb_port* port = (struct usb_port *)data; switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 64, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 64, NULL, NULL)) return FAULT_9007; break; case VALUESET: @@ -723,7 +723,7 @@ static int set_USBUSBHostsHost_Alias(char *refparam, struct dmctx *ctx, void *da struct usb_port* port=(struct usb_port *)data; switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 64, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 64, NULL, NULL)) return FAULT_9007; break; case VALUESET: diff --git a/dmtree/tr181/userinterface.c b/dmtree/tr181/userinterface.c index ea2e6377..d84c658a 100644 --- a/dmtree/tr181/userinterface.c +++ b/dmtree/tr181/userinterface.c @@ -170,7 +170,7 @@ static int set_userint_remoteaccesss_protocol(char *refparam, struct dmctx *ctx, switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, -1, SupportedProtocols, 2, NULL, 0)) + if (dm_validate_string(value, -1, -1, SupportedProtocols, NULL)) return FAULT_9007; found = get_supportedprotocols(); diff --git a/dmtree/tr181/users.c b/dmtree/tr181/users.c index 8d620fa0..51996ba7 100644 --- a/dmtree/tr181/users.c +++ b/dmtree/tr181/users.c @@ -159,7 +159,7 @@ static int set_user_alias(char *refparam, struct dmctx *ctx, void *data, char *i switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 64, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 64, NULL, NULL)) return FAULT_9007; break; case VALUESET: @@ -190,7 +190,7 @@ static int set_user_username(char *refparam, struct dmctx *ctx, void *data, char switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 64, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 64, NULL, NULL)) return FAULT_9007; break; case VALUESET: @@ -208,7 +208,7 @@ static int set_user_password(char *refparam, struct dmctx *ctx, void *data, char { switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 64, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 64, NULL, NULL)) return FAULT_9007; break; case VALUESET: @@ -236,7 +236,7 @@ static int set_user_language(char *refparam, struct dmctx *ctx, void *data, char { switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 16, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 16, NULL, NULL)) return FAULT_9007; break; case VALUESET: diff --git a/dmtree/tr181/wifi.c b/dmtree/tr181/wifi.c index 86cb8750..19698d38 100644 --- a/dmtree/tr181/wifi.c +++ b/dmtree/tr181/wifi.c @@ -184,7 +184,7 @@ static int set_wlan_ssid(char *refparam, struct dmctx *ctx, void *data, char *in { switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 32, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 32, NULL, NULL)) return FAULT_9007; return 0; case VALUESET: @@ -247,7 +247,7 @@ static int set_WiFiRadio_LowerLayers(char *refparam, struct dmctx *ctx, void *da { switch (action) { case VALUECHECK: - if (dm_validate_string_list(value, -1, -1, 1024, -1, -1, NULL, 0, NULL, 0)) + if (dm_validate_string_list(value, -1, -1, 1024, -1, -1, NULL, NULL)) return FAULT_9007; break; case VALUESET: @@ -268,7 +268,7 @@ static int set_radio_operating_standard(char *refparam, struct dmctx *ctx, void switch (action) { case VALUECHECK: - if (dm_validate_string_list(value, -1, -1, -1, -1, -1, SupportedStandards, 6, NULL, 0)) + if (dm_validate_string_list(value, -1, -1, -1, -1, -1, SupportedStandards, NULL)) return FAULT_9007; return 0; case VALUESET: @@ -443,7 +443,7 @@ static int set_WiFiRadio_OperatingChannelBandwidth(char *refparam, struct dmctx char buf[6]; switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, -1, SupportedOperatingChannelBandwidth, 6, NULL, 0)) + if (dm_validate_string(value, -1, -1, SupportedOperatingChannelBandwidth, NULL)) return FAULT_9007; break; case VALUESET: @@ -466,7 +466,7 @@ static int set_WiFiRadio_PreambleType(char *refparam, struct dmctx *ctx, void *d { switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, -1, PreambleType, 3, NULL, 0)) + if (dm_validate_string(value, -1, -1, PreambleType, NULL)) return FAULT_9007; break; case VALUESET: @@ -537,7 +537,7 @@ static int set_WiFiRadio_RegulatoryDomain(char *refparam, struct dmctx *ctx, voi { switch (action) { case VALUECHECK: - if (dm_validate_string(value, 3, 3, NULL, 0, RegulatoryDomain, 1)) + if (dm_validate_string(value, 3, 3, NULL, RegulatoryDomain)) return FAULT_9007; break; case VALUESET: @@ -750,7 +750,7 @@ static int set_WiFiAccessPoint_AllowedMACAddress(char *refparam, struct dmctx *c switch (action) { case VALUECHECK: - if (dm_validate_string_list(value, -1, -1, -1, -1, 17, NULL, 0, MACAddress, 1)) + if (dm_validate_string_list(value, -1, -1, -1, -1, 17, NULL, MACAddress)) return FAULT_9007; break; case VALUESET: @@ -943,7 +943,7 @@ static int set_access_point_security_modes(char *refparam, struct dmctx *ctx, vo { switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, -1, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, -1, NULL, NULL)) return FAULT_9007; return 0; case VALUESET: @@ -996,7 +996,7 @@ static int set_access_point_security_passphrase(char *refparam, struct dmctx *ct switch (action) { case VALUECHECK: - if (dm_validate_string(value, 8, 63, NULL, 0, NULL, 0)) + if (dm_validate_string(value, 8, 63, NULL, NULL)) return FAULT_9007; return 0; case VALUESET: @@ -1048,7 +1048,7 @@ static int set_access_point_security_radius_ip_address(char *refparam, struct dm switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 45, NULL, 0, IPAddress, 2)) + if (dm_validate_string(value, -1, 45, NULL, IPAddress)) return FAULT_9007; return 0; case VALUESET: @@ -1091,7 +1091,7 @@ static int set_access_point_security_radius_secret(char *refparam, struct dmctx switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, -1, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, -1, NULL, NULL)) return FAULT_9007; return 0; case VALUESET: @@ -1123,7 +1123,7 @@ static int set_WiFiAccessPointSecurity_MFPConfig(char *refparam, struct dmctx *c switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, -1, MFPConfig, 3, NULL, 0)) + if (dm_validate_string(value, -1, -1, MFPConfig, NULL)) return FAULT_9007; break; case VALUESET: @@ -1233,7 +1233,7 @@ static int set_WiFiAccessPointWPS_ConfigMethodsEnabled(char *refparam, struct dm { switch (action) { case VALUECHECK: - if (dm_validate_string_list(value, -1, -1, -1, -1, -1, NULL, 0, NULL, 0)) + if (dm_validate_string_list(value, -1, -1, -1, -1, -1, NULL, NULL)) return FAULT_9007; break; case VALUESET: @@ -1263,7 +1263,7 @@ static int set_WiFiAccessPointWPS_PIN(char *refparam, struct dmctx *ctx, void *d { switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 8, NULL, 0, PIN, 1)) + if (dm_validate_string(value, -1, 8, NULL, PIN)) return FAULT_9007; break; case VALUESET: @@ -1284,7 +1284,7 @@ static int set_WiFiAccessPointAccounting_ServerIPAddr(char *refparam, struct dmc { switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 45, NULL, 0, IPAddress, 2)) + if (dm_validate_string(value, -1, 45, NULL, IPAddress)) return FAULT_9007; break; case VALUESET: @@ -1326,7 +1326,7 @@ static int set_WiFiAccessPointAccounting_Secret(char *refparam, struct dmctx *ct { switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, -1, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, -1, NULL, NULL)) return FAULT_9007; break; case VALUESET: @@ -1340,7 +1340,7 @@ static int set_radio_frequency(char *refparam, struct dmctx *ctx, void *data, ch { switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, -1, SupportedFrequencyBands, 2, NULL, 0)) + if (dm_validate_string(value, -1, -1, SupportedFrequencyBands, NULL)) return FAULT_9007; break; case VALUESET: @@ -1467,7 +1467,7 @@ static int set_WiFiEndPoint_Alias(char *refparam, struct dmctx *ctx, void *data, switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 64, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 64, NULL, NULL)) return FAULT_9007; return 0; case VALUESET: @@ -1532,7 +1532,7 @@ static int set_WiFiEndPointProfile_Alias(char *refparam, struct dmctx *ctx, void switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 64, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 64, NULL, NULL)) return FAULT_9007; break; case VALUESET: @@ -1556,7 +1556,7 @@ static int set_WiFiEndPointProfile_SSID(char *refparam, struct dmctx *ctx, void { switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 32, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 32, NULL, NULL)) return FAULT_9007; break; case VALUESET: @@ -1583,7 +1583,7 @@ static int set_WiFiEndPointProfileSecurity_ModeEnabled(char *refparam, struct dm { switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, -1, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, -1, NULL, NULL)) return FAULT_9007; return 0; case VALUESET: @@ -1637,7 +1637,7 @@ static int set_WiFiEndPointProfileSecurity_KeyPassphrase(char *refparam, struct switch (action) { case VALUECHECK: - if (dm_validate_string(value, 8, 63, NULL, 0, NULL, 0)) + if (dm_validate_string(value, 8, 63, NULL, NULL)) return FAULT_9007; return 0; case VALUESET: @@ -1667,7 +1667,7 @@ static int set_WiFiEndPointProfileSecurity_MFPConfig(char *refparam, struct dmct { switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, -1, MFPConfig, 3, NULL, 0)) + if (dm_validate_string(value, -1, -1, MFPConfig, NULL)) return FAULT_9007; break; case VALUESET: @@ -1721,7 +1721,7 @@ static int set_WiFiEndPointWPS_ConfigMethodsEnabled(char *refparam, struct dmctx { switch (action) { case VALUECHECK: - if (dm_validate_string_list(value, -1, -1, -1, -1, -1, NULL, 0, NULL, 0)) + if (dm_validate_string_list(value, -1, -1, -1, -1, -1, NULL, NULL)) return FAULT_9007; break; case VALUESET: @@ -1782,7 +1782,7 @@ static int set_radio_alias(char *refparam, struct dmctx *ctx, void *data, char * switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 64, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 64, NULL, NULL)) return FAULT_9007; return 0; case VALUESET: @@ -1811,7 +1811,7 @@ static int set_ssid_alias(char *refparam, struct dmctx *ctx, void *data, char *i switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 64, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 64, NULL, NULL)) return FAULT_9007; return 0; case VALUESET: @@ -1840,7 +1840,7 @@ static int set_access_point_alias(char *refparam, struct dmctx *ctx, void *data, switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 64, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 64, NULL, NULL)) return FAULT_9007; return 0; case VALUESET: @@ -1869,7 +1869,7 @@ static int set_ssid_lower_layer(char *refparam, struct dmctx *ctx, void *data, c switch (action) { case VALUECHECK: - if (dm_validate_string_list(value, -1, -1, 1024, -1, -1, NULL, 0, NULL, 0)) + if (dm_validate_string_list(value, -1, -1, 1024, -1, -1, NULL, NULL)) return FAULT_9007; return 0; case VALUESET: @@ -2178,7 +2178,7 @@ int set_neighboring_wifi_diagnostics_diagnostics_state(char *refparam, struct dm switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, -1, DiagnosticsState, 5, NULL, 0)) + if (dm_validate_string(value, -1, -1, DiagnosticsState, NULL)) return FAULT_9007; return 0; case VALUESET: diff --git a/dmtree/tr181/x_iopsys_eu_buttons.c b/dmtree/tr181/x_iopsys_eu_buttons.c index 9e6dcd18..3c035be7 100644 --- a/dmtree/tr181/x_iopsys_eu_buttons.c +++ b/dmtree/tr181/x_iopsys_eu_buttons.c @@ -144,7 +144,7 @@ static int set_x_iopsys_eu_button_alias(char *refparam, struct dmctx *ctx, void switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 64, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 64, NULL, NULL)) return FAULT_9007; return 0; case VALUESET: diff --git a/dmtree/tr181/x_iopsys_eu_dropbear.c b/dmtree/tr181/x_iopsys_eu_dropbear.c index 7a209f5a..853849be 100644 --- a/dmtree/tr181/x_iopsys_eu_dropbear.c +++ b/dmtree/tr181/x_iopsys_eu_dropbear.c @@ -312,7 +312,7 @@ static int set_x_iopsys_eu_dropbear_alias(char *refparam, struct dmctx *ctx, voi switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 64, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 64, NULL, NULL)) return FAULT_9007; return 0; case VALUESET: diff --git a/dmtree/tr181/x_iopsys_eu_igmp.c b/dmtree/tr181/x_iopsys_eu_igmp.c index 1efbdd65..8e4a0d6f 100644 --- a/dmtree/tr181/x_iopsys_eu_igmp.c +++ b/dmtree/tr181/x_iopsys_eu_igmp.c @@ -717,7 +717,7 @@ int set_mcasts_filter_address(char *refparam, struct dmctx *ctx, void *data, cha switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 15, NULL, 0, IPv4Address, 1)) + if (dm_validate_string(value, -1, 15, NULL, IPv4Address)) return FAULT_9007; break; @@ -987,7 +987,7 @@ int set_mcast_snooping_interface(char *refparam, struct dmctx *ctx, void *data, switch (action) { case VALUECHECK: - if (dm_validate_string_list(value, -1, -1, 1024, -1, -1, NULL, 0, NULL, 0)) + if (dm_validate_string_list(value, -1, -1, 1024, -1, -1, NULL, NULL)) return FAULT_9007; break; case VALUESET: @@ -1327,7 +1327,7 @@ static int set_igmpp_filter_address(char *refparam, struct dmctx *ctx, void *dat switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 15, NULL, 0, IPv4Address, 1)) + if (dm_validate_string(value, -1, 15, NULL, IPv4Address)) return FAULT_9007; break; @@ -1835,7 +1835,7 @@ static int set_igmpp_interface_iface(char *refparam, struct dmctx *ctx, void *da switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 256, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 256, NULL, NULL)) return FAULT_9007; break; case VALUESET: diff --git a/dmtree/tr181/x_iopsys_eu_mld.c b/dmtree/tr181/x_iopsys_eu_mld.c index ca0b761f..f77987e7 100644 --- a/dmtree/tr181/x_iopsys_eu_mld.c +++ b/dmtree/tr181/x_iopsys_eu_mld.c @@ -479,7 +479,7 @@ static int set_mldp_filter_address(char *refparam, struct dmctx *ctx, void *data switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 45, NULL, 0, IPv6Address, 1)) + if (dm_validate_string(value, -1, 45, NULL, IPv6Address)) return FAULT_9007; break; case VALUESET: @@ -666,7 +666,7 @@ static int set_mldp_interface_iface(char *refparam, struct dmctx *ctx, void *dat switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 256, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 256, NULL, NULL)) return FAULT_9007; break; case VALUESET: diff --git a/dmtree/tr181/x_iopsys_eu_owsd.c b/dmtree/tr181/x_iopsys_eu_owsd.c index 239e3bfc..ec4eb33d 100644 --- a/dmtree/tr181/x_iopsys_eu_owsd.c +++ b/dmtree/tr181/x_iopsys_eu_owsd.c @@ -245,7 +245,7 @@ static int set_x_iopsys_eu_owsd_virtualhost_alias(char *refparam, struct dmctx * switch (action) { case VALUECHECK: - if (dm_validate_string(value, -1, 64, NULL, 0, NULL, 0)) + if (dm_validate_string(value, -1, 64, NULL, NULL)) return FAULT_9007; return 0; case VALUESET: diff --git a/json/generate_source_code.py b/json/generate_source_code.py index 2b1ce336..376da7fc 100755 --- a/json/generate_source_code.py +++ b/json/generate_source_code.py @@ -217,13 +217,12 @@ def generate_validate_value(dmparam, value): enum_length = len(list_enumarationsparam) enumarationsparam = dmparam if datatypeparam == "string" else datatypeparam str_enum = "char *%s[] = {" % enumarationsparam - for i in range(enum_length - 1): + for i in range(enum_length): str_enum += "\"%s\", " % list_enumarationsparam[i] - str_enum += "\"%s\"};" % list_enumarationsparam[enum_length - 1] + str_enum += "NULL};" printGlobalstrCommon(str_enum) else: enumarationsparam = "NULL" - enum_length = "0" patternparam = getarrayoptionparam(listparam, "pattern") if patternparam != None: @@ -231,32 +230,27 @@ def generate_validate_value(dmparam, value): pattern_length = len(list_patternparam) patternparam = dmparam if datatypeparam == "string" else datatypeparam str_pattern = "char *%s[] = {" % patternparam - for i in range(pattern_length - 1): + for i in range(pattern_length): str_pattern += "\"^%s$\", " % list_patternparam[i] - str_pattern += "\"^%s$\"};" % list_patternparam[pattern_length - 1] + str_pattern += "NULL};" printGlobalstrCommon(str_pattern) elif datatypeparam == "IPAddress": patternparam = "IPAddress" - pattern_length = "2" elif datatypeparam == "IPv6Address": patternparam = "IPv6Address" - pattern_length = "1" elif datatypeparam == "IPPrefix": patternparam = "IPPrefix" - pattern_length = "3" elif datatypeparam == "IPv6Prefix": patternparam = "IPv6Prefix" - pattern_length = "1" else: patternparam = "NULL" - pattern_length = "0" if datatypeparam == "unsignedInt": validate_value += " if (dm_validate_unsignedInt_list(value, %s, %s, %s, %s))\n" % (itemminparam, itemmaxparam, maxsizeparam, rangeargs) else: if rangeminparam == "NULL": rangeminparam = "-1" if rangemaxparam == "NULL": rangemaxparam = "-1" - validate_value += " if (dm_validate_string_list(value, %s, %s, %s, %s, %s, %s, %s, %s, %s))\n" % (itemminparam, itemmaxparam, maxsizeparam, rangeminparam, rangemaxparam, enumarationsparam, enum_length, patternparam, pattern_length) + validate_value += " if (dm_validate_string_list(value, %s, %s, %s, %s, %s, %s, %s))\n" % (itemminparam, itemmaxparam, maxsizeparam, rangeminparam, rangemaxparam, enumarationsparam, patternparam) else: datatypeparam = getoptionparam(value, "datatype") rangeparam = getarrayoptionparam(value, "range") @@ -283,13 +277,12 @@ def generate_validate_value(dmparam, value): enum_length = len(list_enumarationsparam) enumarationsparam = dmparam if datatypeparam == "string" else datatypeparam str_enum = "char *%s[] = {" % enumarationsparam - for i in range(enum_length - 1): + for i in range(enum_length): str_enum += "\"%s\", " % list_enumarationsparam[i] - str_enum += "\"%s\"};" % list_enumarationsparam[enum_length - 1] + str_enum += "NULL};" printGlobalstrCommon(str_enum) else: enumarationsparam = "NULL" - enum_length = "0" patternparam = getarrayoptionparam(value, "pattern") if patternparam != None: @@ -297,25 +290,20 @@ def generate_validate_value(dmparam, value): pattern_length = len(list_patternparam) patternparam = dmparam if datatypeparam == "string" else datatypeparam str_pattern = "char *%s[] = {" % patternparam - for i in range(pattern_length - 1): + for i in range(pattern_length): str_pattern += "\"^%s$\", " % list_patternparam[i] - str_pattern += "\"^%s$\"};" % list_patternparam[pattern_length - 1] + str_pattern += "NULL};" printGlobalstrCommon(str_pattern) elif datatypeparam == "IPAddress": patternparam = "IPAddress" - pattern_length = "2" elif datatypeparam == "IPv6Address": patternparam = "IPv6Address" - pattern_length = "1" elif datatypeparam == "IPPrefix": patternparam = "IPPrefix" - pattern_length = "3" elif datatypeparam == "IPv6Prefix": patternparam = "IPv6Prefix" - pattern_length = "1" else: patternparam = "NULL" - pattern_length = "0" if datatypeparam == "boolean": validate_value += " if (dm_validate_boolean(value))\n" @@ -336,7 +324,7 @@ def generate_validate_value(dmparam, value): else: if rangeminparam == "NULL": rangeminparam = "-1" if rangemaxparam == "NULL": rangemaxparam = "-1" - validate_value += " if (dm_validate_string(value, %s, %s, %s, %s, %s, %s))\n" % (rangeminparam, rangemaxparam, enumarationsparam, enum_length, patternparam, pattern_length) + validate_value += " if (dm_validate_string(value, %s, %s, %s, %s))\n" % (rangeminparam, rangemaxparam, enumarationsparam, patternparam) validate_value += " return FAULT_9007;" validate_value = validate_value.replace("\"NULL\"", "NULL") return validate_value diff --git a/libbbf_api/dmcommon.c b/libbbf_api/dmcommon.c index 727e25c4..e97e1fa0 100644 --- a/libbbf_api/dmcommon.c +++ b/libbbf_api/dmcommon.c @@ -23,54 +23,54 @@ char *array_notifcation_char[__MAX_notification] = { [notification_passive_active_lw] = "6", }; -char *Encapsulation[] = {"LLC", "VCMUX"}; -char *LinkType[] = {"EoA", "IPoA", "PPPoA", "CIP", "Unconfigured"}; -char *BridgeStandard[] = {"802.1D-2004", "802.1Q-2005", "802.1Q-2011"}; -char *BridgeType[] = {"ProviderNetworkPort", "CustomerNetworkPort", "CustomerEdgePort", "CustomerVLANPort", "VLANUnawarePort"}; -char *VendorClassIDMode[] = {"Exact", "Prefix", "Suffix", "Substring"}; -char *DiagnosticsState[] = {"None", "Requested", "Canceled", "Complete", "Error"}; -char *SupportedProtocols[] = {"HTTP", "HTTPS"}; -char *InstanceMode[] = {"InstanceNumber", "InstanceAlias"}; -char *NATProtocol[] = {"TCP", "UDP", "TCP/UDP"}; -char *Config[] = {"High", "Low", "Off", "Advanced"}; -char *Target[] = {"Drop", "Accept", "Reject", "Return", "TargetChain"}; -char *ServerConnectAlgorithm[] = {"DNS-SRV", "DNS", "ServerTable", "WebSocket"}; -char *KeepAlivePolicy[] = {"ICMP", "None"}; -char *DeliveryHeaderProtocol[] = {"IPv4", "IPv6"}; -char *KeyIdentifierGenerationPolicy[] = {"Disabled", "Provisioned", "CPE_Generated"}; -char *PreambleType[] = {"short", "long", "auto"}; -char *MFPConfig[] = {"Disabled", "Optional", "Required"}; -char *DuplexMode[] = {"Half", "Full", "Auto"}; -char *RequestedState[] = {"Idle", "Active"}; -char *BulkDataProtocols[] = {"Streaming", "File", "HTTP"}; -char *EncodingTypes[] = {"XML", "XDR", "CSV", "JSON"}; -char *CSVReportFormat[] = {"ParameterPerRow", "ParameterPerColumn"}; -char *RowTimestamp[] = {"Unix-Epoch", "ISO-8601", "None"}; -char *JSONReportFormat[] = {"ObjectHierarchy", "NameValuePair"}; -char *StaticType[] = {"Static", "Inapplicable", "PrefixDelegation", "Child"}; -char *ProtocolVersion[] = {"Any", "IPv4", "IPv6"}; -char *ServerSelectionProtocol[] = {"ICMP", "UDP Echo"}; -char *DHCPType[] = {"DHCPv4", "DHCPv6"}; -char *DropAlgorithm[] = {"RED", "DT", "WRED", "BLUE"}; -char *SchedulerAlgorithm[] = {"WFQ", "WRR", "SP"}; -char *DTMFMethod[] = {"InBand", "RFC2833", "SIPInfo"}; -char *ProfileEnable[] = {"Disabled", "Quiescent", "Enabled"}; -char *SupportedOperatingChannelBandwidth[] = {"20MHz", "40MHz", "80MHz", "160MHZ", "80+80MHz", "Auto"}; -char *SupportedStandards[] = {"a", "b", "g", "n", "ac", "ax"}; -char *SupportedFrequencyBands[] = {"2.4GHz", "5GHz"}; -char *Provider_Bridge_Type[] = {"S-VLAN", "PE"}; +char *Encapsulation[] = {"LLC", "VCMUX", NULL}; +char *LinkType[] = {"EoA", "IPoA", "PPPoA", "CIP", "Unconfigured", NULL}; +char *BridgeStandard[] = {"802.1D-2004", "802.1Q-2005", "802.1Q-2011", NULL}; +char *BridgeType[] = {"ProviderNetworkPort", "CustomerNetworkPort", "CustomerEdgePort", "CustomerVLANPort", "VLANUnawarePort", NULL}; +char *VendorClassIDMode[] = {"Exact", "Prefix", "Suffix", "Substring", NULL}; +char *DiagnosticsState[] = {"None", "Requested", "Canceled", "Complete", "Error", NULL}; +char *SupportedProtocols[] = {"HTTP", "HTTPS", NULL}; +char *InstanceMode[] = {"InstanceNumber", "InstanceAlias", NULL}; +char *NATProtocol[] = {"TCP", "UDP", NULL}; +char *Config[] = {"High", "Low", "Off", "Advanced", NULL}; +char *Target[] = {"Drop", "Accept", "Reject", "Return", "TargetChain", NULL}; +char *ServerConnectAlgorithm[] = {"DNS-SRV", "DNS", "ServerTable", "WebSocket", NULL}; +char *KeepAlivePolicy[] = {"ICMP", "None", NULL}; +char *DeliveryHeaderProtocol[] = {"IPv4", "IPv6", NULL}; +char *KeyIdentifierGenerationPolicy[] = {"Disabled", "Provisioned", "CPE_Generated", NULL}; +char *PreambleType[] = {"short", "long", "auto", NULL}; +char *MFPConfig[] = {"Disabled", "Optional", "Required", NULL}; +char *DuplexMode[] = {"Half", "Full", "Auto", NULL}; +char *RequestedState[] = {"Idle", "Active", NULL}; +char *BulkDataProtocols[] = {"Streaming", "File", "HTTP", NULL}; +char *EncodingTypes[] = {"XML", "XDR", "CSV", "JSON", NULL}; +char *CSVReportFormat[] = {"ParameterPerRow", "ParameterPerColumn", NULL}; +char *RowTimestamp[] = {"Unix-Epoch", "ISO-8601", "None", NULL}; +char *JSONReportFormat[] = {"ObjectHierarchy", "NameValuePair", NULL}; +char *StaticType[] = {"Static", "Inapplicable", "PrefixDelegation", "Child", NULL}; +char *ProtocolVersion[] = {"Any", "IPv4", "IPv6", NULL}; +char *ServerSelectionProtocol[] = {"ICMP", "UDP Echo", NULL}; +char *DHCPType[] = {"DHCPv4", "DHCPv6", NULL}; +char *DropAlgorithm[] = {"RED", "DT", "WRED", "BLUE", NULL}; +char *SchedulerAlgorithm[] = {"WFQ", "WRR", "SP", NULL}; +char *DTMFMethod[] = {"InBand", "RFC2833", "SIPInfo", NULL}; +char *ProfileEnable[] = {"Disabled", "Quiescent", "Enabled", NULL}; +char *SupportedOperatingChannelBandwidth[] = {"20MHz", "40MHz", "80MHz", "160MHZ", "80+80MHz", "Auto", NULL}; +char *SupportedStandards[] = {"a", "b", "g", "n", "ac", "ax", NULL}; +char *SupportedFrequencyBands[] = {"2.4GHz", "5GHz", NULL}; +char *Provider_Bridge_Type[] = {"S-VLAN", "PE", NULL}; -char *PIN[] = {"^\\d{4}|\\d{8}$"}; -char *DestinationAddress[] = {"^\\d+/\\d+$"}; -char *RegulatoryDomain[] = {"^[A-Z][A-Z][ OI]$"}; -char *ConformingAction[] = {"^Null$", "^Drop$", "^[0-9]|[1-5][0-9]|6[0-3]$", "^:[0-7]$", "^([0-9]|[1-5][0-9]|6[0-3]):[0-7]$"}; -char *IPv4Address[] = {"^((25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])$"}; -char *IPv6Address[] = {"^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$"}; -char *IPAddress[] = {"^((25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])$", "^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$"}; -char *MACAddress[] = {"^([0-9A-Fa-f][0-9A-Fa-f]:){5}([0-9A-Fa-f][0-9A-Fa-f])$"}; -char *IPPrefix[] = {"^/(3[0-2]|[012]?[0-9])$", "^((25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])/(3[0-2]|[012]?[0-9])$", "^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))/(12[0-8]|1[0-1][0-9]|[0-9]?[0-9])$"}; -char *IPv4Prefix[] = {"^/(3[0-2]|[012]?[0-9])$", "^((25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])/(3[0-2]|[012]?[0-9])$"}; -char *IPv6Prefix[] = {"^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))/(12[0-8]|1[0-1][0-9]|[0-9]?[0-9])$"}; +char *PIN[] = {"^\\d{4}|\\d{8}$", NULL}; +char *DestinationAddress[] = {"^\\d+/\\d+$", NULL}; +char *RegulatoryDomain[] = {"^[A-Z][A-Z][ OI]$", NULL}; +char *ConformingAction[] = {"^Null$", "^Drop$", "^[0-9]|[1-5][0-9]|6[0-3]$", "^:[0-7]$", "^([0-9]|[1-5][0-9]|6[0-3]):[0-7]$", NULL}; +char *IPv4Address[] = {"^$", "^((25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])$", NULL}; +char *IPv6Address[] = {"^$", "^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$", NULL}; +char *IPAddress[] = {"^$", "^((25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])$", "^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$", NULL}; +char *MACAddress[] = {"^$", "^([0-9A-Fa-f][0-9A-Fa-f]:){5}([0-9A-Fa-f][0-9A-Fa-f])$", NULL}; +char *IPPrefix[] = {"^$", "^/(3[0-2]|[012]?[0-9])$", "^((25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])/(3[0-2]|[012]?[0-9])$", "^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))/(12[0-8]|1[0-1][0-9]|[0-9]?[0-9])$", NULL}; +char *IPv4Prefix[] = {"^$", "^/(3[0-2]|[012]?[0-9])$", "^((25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])/(3[0-2]|[012]?[0-9])$", NULL}; +char *IPv6Prefix[] = {"^$", "^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))/(12[0-8]|1[0-1][0-9]|[0-9]?[0-9])$", NULL}; char *cut_fx(char *str, char *delimiter, int occurence) { @@ -1380,38 +1380,36 @@ static int dm_validate_string_length(char *value, int min_length, int max_length return 0; } -static int dm_validate_string_enumeration(char *value, char *enumeration[], int enumeration_size) +static int dm_validate_string_enumeration(char *value, char *enumeration[]) { - int i; - for (i = 0; i < enumeration_size; i++) { - if (strcmp(enumeration[i], value) == 0) + for (; *enumeration; enumeration++) { + if (strcmp(*enumeration, value) == 0) return 0; } return -1; } -static int dm_validate_string_pattern(char *value, char *pattern[], int pattern_size) +static int dm_validate_string_pattern(char *value, char *pattern[]) { - int i; - for (i = 0; i < pattern_size; i++) { - if (match(value, pattern[i])) + for (; *pattern; pattern++) { + if (match(value, *pattern)) return 0; } return -1; } -int dm_validate_string(char *value, int min_length, int max_length, char *enumeration[], int enumeration_size, char *pattern[], int pattern_size) +int dm_validate_string(char *value, int min_length, int max_length, char *enumeration[], char *pattern[]) { /* check size */ if (dm_validate_string_length(value, min_length, max_length)) return -1; /* check enumeration */ - if (enumeration && dm_validate_string_enumeration(value, enumeration, enumeration_size)) + if (enumeration && dm_validate_string_enumeration(value, enumeration)) return -1; /* check pattern */ - if (pattern && dm_validate_string_pattern(value, pattern, pattern_size)) + if (pattern && dm_validate_string_pattern(value, pattern)) return -1; return 0; @@ -1444,7 +1442,7 @@ int dm_validate_unsignedInt(char *value, struct range_args r_args[], int r_args_ val = strtoul(value, &endval, 10); - if ((*endval != 0) || (errno != 0)) return -1; + if ((*value == '-') || (*endval != 0) || (errno != 0)) return -1; if (r_args[i].min && r_args[i].max && minval == maxval) { @@ -1458,7 +1456,7 @@ int dm_validate_unsignedInt(char *value, struct range_args r_args[], int r_args_ } /* check size */ - if ((r_args[i].min && val < minval) || (r_args[i].max && val > maxval) || (val < 0) || (val > (unsigned int)UINT_MAX)) + if ((r_args[i].min && val < minval) || (r_args[i].max && val > maxval) || (val > (unsigned int)UINT_MAX)) return -1; } @@ -1509,10 +1507,10 @@ int dm_validate_unsignedLong(char *value, struct range_args r_args[], int r_args val = strtoul(value, &endval, 10); - if ((*endval != 0) || (errno != 0)) return -1; + if ((*value == '-') || (*endval != 0) || (errno != 0)) return -1; /* check size */ - if ((r_args[i].min && val < minval) || (r_args[i].max && val > maxval) || (val < 0) || (val > (unsigned long)ULONG_MAX)) + if ((r_args[i].min && val < minval) || (r_args[i].max && val > maxval) || (val > (unsigned long)ULONG_MAX)) return -1; } @@ -1579,8 +1577,8 @@ int dm_validate_hexBinary(char *value, struct range_args r_args[], int r_args_si continue; } - if ((r_args[i].min && !r_args[i].max && (strlen(value) < atoi(r_args[i].min))) || - (!r_args[i].min && r_args[i].max && (strlen(value) > atoi(r_args[i].max)))) { + if ((r_args[i].min && (strlen(value) < atoi(r_args[i].min))) || + (r_args[i].max && (strlen(value) > atoi(r_args[i].max)))) { return -1; } } @@ -1597,7 +1595,7 @@ static int dm_validate_size_list(int min_item, int max_item, int nbr_item) return 0; } -int dm_validate_string_list(char *value, int min_item, int max_item, int max_size, int min, int max, char *enumeration[], int enumeration_size, char *pattern[], int pattern_size) +int dm_validate_string_list(char *value, int min_item, int max_item, int max_size, int min, int max, char *enumeration[], char *pattern[]) { char *pch, *pchr; int nbr_item = 0; @@ -1613,7 +1611,7 @@ int dm_validate_string_list(char *value, int min_item, int max_item, int max_siz /* for each value, validate string */ for (pch = strtok_r(buf, ",", &pchr); pch != NULL; pch = strtok_r(NULL, ",", &pchr)) { - if (dm_validate_string(pch, min, max, enumeration, enumeration_size, pattern, pattern_size)) + if (dm_validate_string(pch, min, max, enumeration, pattern)) return -1; nbr_item ++; } diff --git a/libbbf_api/dmcommon.h b/libbbf_api/dmcommon.h index e538f546..efa9daff 100644 --- a/libbbf_api/dmcommon.h +++ b/libbbf_api/dmcommon.h @@ -310,7 +310,7 @@ int get_net_device_sysfs(const char *uci_iface, const char *name, char **value); char *get_device_from_wifi_iface(const char *wifi_iface, const char *wifi_section); int dm_time_format(time_t ts, char **dst); bool match(const char *string, const char *pattern); -int dm_validate_string(char *value, int min_length, int max_length, char *enumeration[], int enumeration_size, char *pattern[], int pattern_size); +int dm_validate_string(char *value, int min_length, int max_length, char *enumeration[], char *pattern[]); int dm_validate_boolean(char *value); int dm_validate_unsignedInt(char *value, struct range_args r_args[], int r_args_size); int dm_validate_int(char *value, struct range_args r_args[], int r_args_size); @@ -318,7 +318,7 @@ int dm_validate_unsignedLong(char *value, struct range_args r_args[], int r_args int dm_validate_long(char *value, struct range_args r_args[], int r_args_size); int dm_validate_dateTime(char *value); int dm_validate_hexBinary(char *value, struct range_args r_args[], int r_args_size); -int dm_validate_string_list(char *value, int min_item, int max_item, int max_size, int min, int max, char *enumeration[], int enumeration_size, char *pattern[], int pattern_size); +int dm_validate_string_list(char *value, int min_item, int max_item, int max_size, int min, int max, char *enumeration[], char *pattern[]); int dm_validate_unsignedInt_list(char *value, int min_item, int max_item, int max_size, struct range_args r_args[], int r_args_size); char *decode64(char *enc); bool folder_exists(const char *path);