From 87abe6584eec8dd852328ec9cc6d01ea70cf06f1 Mon Sep 17 00:00:00 2001 From: Amin Ben Ramdhane Date: Tue, 29 Dec 2020 13:13:43 +0100 Subject: [PATCH] Ticket refs #4077: Device.Users.User.{i}.Username can be set to Empty value --- dmtree/tr181/users.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/dmtree/tr181/users.c b/dmtree/tr181/users.c index 1046dbbc..8cee3b22 100644 --- a/dmtree/tr181/users.c +++ b/dmtree/tr181/users.c @@ -193,11 +193,16 @@ static int set_user_username(char *refparam, struct dmctx *ctx, void *data, char case VALUECHECK: if (dm_validate_string(value, -1, 64, NULL, 0, NULL, 0)) return FAULT_9007; + + // Check if the value is empty + if (*value == '\0') + return FAULT_9007; break; case VALUESET: // Update dmmap_users file get_dmmap_section_of_config_section("dmmap_users", "user", section_name((struct uci_section *)data), &dmmap_section); dmuci_set_value_by_section(dmmap_section, "section_name", value); + // Update users config dmuci_rename_section_by_section((struct uci_section *)data, value); break;