summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosé Bollo <jose.bollo@iot.bzh>2016-12-14 11:17:47 +0100
committerJosé Bollo <jose.bollo@iot.bzh>2016-12-14 11:17:47 +0100
commit69df60bd6622a56200d2d03e1b7d899569adf650 (patch)
tree50b14d7b5e9a4237ec4046ada05bd1e560f7bfb1
parent6f6d04fef9f08d756a37d17333f5b9b9a6b72dd2 (diff)
wgt-info: Enforce lower case ids and version
This will be used next to avoid faking identity of applications using the case difference. Change-Id: I13cbdd5124b58b2a72c15054df6f3cd0e11a2cc5 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
-rw-r--r--src/wgt-info.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/wgt-info.c b/src/wgt-info.c
index c8308fa..089a563 100644
--- a/src/wgt-info.c
+++ b/src/wgt-info.c
@@ -20,6 +20,7 @@
#include <string.h>
#include <errno.h>
#include <assert.h>
+#include <ctype.h>
#include <libxml/tree.h>
@@ -117,6 +118,16 @@ static char *mkidaver(char *id, char *ver)
return NULL;
}
+static void make_lowercase(char *s)
+{
+ if (s) {
+ while(*s) {
+ *s = (char)tolower(*s);
+ s++;
+ }
+ }
+}
+
static int fill_desc(struct wgt_desc *desc, int want_icons, int want_features, int want_preferences)
{
xmlNodePtr node, pnode;
@@ -132,8 +143,10 @@ static int fill_desc(struct wgt_desc *desc, int want_icons, int want_features, i
return -1;
}
desc->id = xmlGetProp(node, wgt_config_string_id);
+ make_lowercase(desc->id);
desc->version = xmlGetProp(node, wgt_config_string_version);
desc->ver = mkver(desc->version);
+ make_lowercase(desc->ver);
desc->idaver = mkidaver(desc->id, desc->ver);
desc->width = getpropnum(node, wgt_config_string_width, 0);
desc->height = getpropnum(node, wgt_config_string_height, 0);