about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorMarco Peereboom <marco@conformal.com>2011-08-24 01:10:34 +0000
committerMarco Peereboom <marco@conformal.com>2011-08-24 01:10:34 +0000
commitf4410b30caf60b82622b903af2dd3eaa26ca2cd6 (patch)
treef9d3b542ce3f005a107e6ac6f9696e173fdf5d24
parent476643d9072ea79de66f5324845988e52933ce6f (diff)
downloadxombrero-f4410b30caf60b82622b903af2dd3eaa26ca2cd6.tar.gz
strip port number of end of whitelist entries.
unfortunately this means one should hand edit the runtime file and delete
all entries that do have the :port notation.

requested by jy-p and others.
-rw-r--r--xxxterm.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/xxxterm.c b/xxxterm.c
index 423bba3..bfa5c2f 100644
--- a/xxxterm.c
+++ b/xxxterm.c
@@ -1872,6 +1872,7 @@ wl_add(char *str, struct domain_list *wl, int handy)
 {
 	struct domain		*d;
 	int			add_dot = 0;
+	char			*p;
 
 	if (str == NULL || wl == NULL || strlen(str) < 2)
 		return;
@@ -1886,6 +1887,11 @@ wl_add(char *str, struct domain_list *wl, int handy)
 	else
 		add_dot = 1;
 
+	/* slice off port number */
+	p = g_strrstr(str, ":");
+	if (p)
+		*p = '\0';
+
 	d = g_malloc(sizeof *d);
 	if (add_dot)
 		d->d = g_strdup_printf(".%s", str);
@@ -3682,6 +3688,7 @@ wl_save(struct tab *t, struct karg *args, int js)
 	struct domain		*d;
 	GSList			*cf;
 	SoupCookie		*ci, *c;
+	char			*p;
 
 	if (t == NULL || args == NULL)
 		return (1);
@@ -3702,6 +3709,11 @@ wl_save(struct tab *t, struct karg *args, int js)
 		goto done;
 	}
 
+	/* we don't want to save :port number */
+	p = g_strrstr(dom, ":");
+	if (p)
+		*p = '\0';
+
 	lt = g_strdup_printf("%s=%s", js ? "js_wl" : "cookie_wl", dom);
 
 	while (!feof(f)) {