From ef68964976689057ae4d29d4bea6e3d2fa335b0a Mon Sep 17 00:00:00 2001 From: Nagendrababu Date: Wed, 23 Jun 2021 22:07:55 -0400 Subject: [PATCH] WIFI-2728-captive-portal-config-parameters-overwriting-issue This patch will add the conditions to respond captive portal API's to only valid configuration Signed-off-by: Nagendrababu --- .../openwrt/src/lib/target/src/captive.c | 30 +++++++++++-------- 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/feeds/wlan-ap/opensync/src/platform/openwrt/src/lib/target/src/captive.c b/feeds/wlan-ap/opensync/src/platform/openwrt/src/lib/target/src/captive.c index dc308a1c5..33d36df41 100644 --- a/feeds/wlan-ap/opensync/src/platform/openwrt/src/lib/target/src/captive.c +++ b/feeds/wlan-ap/opensync/src/platform/openwrt/src/lib/target/src/captive.c @@ -651,17 +651,21 @@ void vif_captive_portal_set(const struct schema_Wifi_VIF_Config *vconf, char *if blobmsg_add_string(&cap, "gatewayname", value); else if (strcmp(opt, "splash_page_logo") == 0) { - blobmsg_add_string(&cap, "splash_page_logo", value); - if (strcmp(splash_logo,value) !=0) { - snprintf(file_path, sizeof(file_path), "%s%s",path,"TipLogo.png"); - captive_portal_files_download(file_path,value); + if (value[0] != '\0') { + blobmsg_add_string(&cap, "splash_page_logo", value); + if (strcmp(splash_logo,value) !=0) { + snprintf(file_path, sizeof(file_path), "%s%s",path,"TipLogo.png"); + captive_portal_files_download(file_path,value); + } } } else if (strcmp(opt, "splash_page_background_logo") == 0) { - blobmsg_add_string(&cap, "page_background_logo", value); - if (strcmp(back_image,value) !=0) { - snprintf(file_path, sizeof(file_path),"%s%s",path,"TipBackLogo.png"); - captive_portal_files_download(file_path,value); + if (value[0] != '\0') { + blobmsg_add_string(&cap, "page_background_logo", value); + if (strcmp(back_image,value) !=0) { + snprintf(file_path, sizeof(file_path),"%s%s",path,"TipBackLogo.png"); + captive_portal_files_download(file_path,value); + } } } @@ -679,10 +683,12 @@ void vif_captive_portal_set(const struct schema_Wifi_VIF_Config *vconf, char *if blobmsg_add_string(&cap, "login_success_text", value); else if (strcmp(opt, "username_password_file") == 0) { - blobmsg_add_string(&cap, "username_password_file", value); - if (strcmp(user_file,value) !=0) { - snprintf(file_path, sizeof(file_path),"%s%s",path,"userpass.dat"); - captive_portal_files_download(file_path,value); + if (value[0] != '\0') { + blobmsg_add_string(&cap, "username_password_file", value); + if (strcmp(user_file,value) !=0) { + snprintf(file_path, sizeof(file_path),"%s%s",path,"userpass.dat"); + captive_portal_files_download(file_path,value); + } } } }