From 352de700cadbb2c4e5b5e9ddc375e9de847e2193 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 14 Feb 2005 09:15:24 +0000 Subject: r5392: added "secure" WINS server processing. Send a WACK on name registrations from anyone who isn't a current owner, then query the owner addresses to see if they still want it. (This used to be commit 8dc2a028d3ca0115d3173df435d926d7b6a4d5d5) --- source4/lib/util_strlist.c | 51 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) (limited to 'source4/lib') diff --git a/source4/lib/util_strlist.c b/source4/lib/util_strlist.c index 71f634f71a..0b78e9f69e 100644 --- a/source4/lib/util_strlist.c +++ b/source4/lib/util_strlist.c @@ -122,3 +122,54 @@ BOOL str_list_equal(const char **list1, const char **list2) } return True; } + + +/* + add an entry to a string list +*/ +const char **str_list_add(const char **list, const char *s) +{ + size_t len = str_list_length(list); + const char **ret; + + ret = talloc_realloc(NULL, list, const char *, len+2); + if (ret == NULL) return NULL; + + ret[len] = talloc_strdup(ret, s); + if (ret[len] == NULL) return NULL; + + ret[len+1] = NULL; + + return ret; +} + +/* + remove an entry from a string list +*/ +void str_list_remove(const char **list, const char *s) +{ + int i; + + for (i=0;list[i];i++) { + if (strcmp(list[i], s) == 0) break; + } + if (!list[i]) return; + + for (;list[i];i++) { + list[i] = list[i+1]; + } +} + + +/* + return True if a string is in a list +*/ +BOOL str_list_check(const char **list, const char *s) +{ + int i; + + for (i=0;list[i];i++) { + if (strcmp(list[i], s) == 0) return True; + } + return False; +} -- cgit