diff options
author | Volker Lendecke <vlendec@samba.org> | 2006-12-01 14:54:31 +0000 |
---|---|---|
committer | Volker Lendecke <vlendec@samba.org> | 2006-12-01 14:54:31 +0000 |
commit | d0ce9bc9e66ad45feb7f5e2da1400ca7aad9d16e (patch) | |
tree | 0e92e1043e7198f90421bf79094740fe468dcffc /source/lib | |
parent | 3b609c5e090aaa21ce7e12383b8560e97bcb09cc (diff) | |
download | samba-d0ce9bc9e66ad45feb7f5e2da1400ca7aad9d16e.tar.gz samba-d0ce9bc9e66ad45feb7f5e2da1400ca7aad9d16e.tar.xz samba-d0ce9bc9e66ad45feb7f5e2da1400ca7aad9d16e.zip |
r19978: More "net sam policy" improvements. Thanks to Karolin Seeger <ks@sernet.de>
Volker
Diffstat (limited to 'source/lib')
-rw-r--r-- | source/lib/account_pol.c | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/source/lib/account_pol.c b/source/lib/account_pol.c index 4cb0b77e746..f4008457ac1 100644 --- a/source/lib/account_pol.c +++ b/source/lib/account_pol.c @@ -83,28 +83,24 @@ static const struct ap_table account_policy_names[] = { {0, NULL, 0, "", NULL} }; -char *account_policy_names_list(void) -{ - char *nl, *p; - int i; - size_t len = 0; +void account_policy_names_list(const char ***names, int *num_names) +{ + const char **nl; + int i, count; - for (i=0; account_policy_names[i].string; i++) { - len += strlen(account_policy_names[i].string) + 1; + for (count=0; account_policy_names[count].string; count++) { } - len++; - nl = (char *)SMB_MALLOC(len); + nl = SMB_MALLOC_ARRAY(const char *, count); if (!nl) { - return NULL; + *num_names = 0; + return; } - p = nl; for (i=0; account_policy_names[i].string; i++) { - memcpy(p, account_policy_names[i].string, strlen(account_policy_names[i].string) + 1); - p[strlen(account_policy_names[i].string)] = '\n'; - p += strlen(account_policy_names[i].string) + 1; + nl[i] = account_policy_names[i].string; } - *p = '\0'; - return nl; + *num_names = count; + *names = nl; + return; } /**************************************************************************** |