diff options
author | Andrew Tridgell <tridge@samba.org> | 2005-02-14 09:15:24 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:09:50 -0500 |
commit | 352de700cadbb2c4e5b5e9ddc375e9de847e2193 (patch) | |
tree | 7e661123337c66bb78ee9490742bfd7d98f334e1 /source4/lib | |
parent | 85fd954145ab9262d5e1930bb7a93d70663abe33 (diff) | |
download | samba-352de700cadbb2c4e5b5e9ddc375e9de847e2193.tar.gz samba-352de700cadbb2c4e5b5e9ddc375e9de847e2193.tar.bz2 samba-352de700cadbb2c4e5b5e9ddc375e9de847e2193.zip |
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)
Diffstat (limited to 'source4/lib')
-rw-r--r-- | source4/lib/util_strlist.c | 51 |
1 files changed, 51 insertions, 0 deletions
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; +} |