summaryrefslogtreecommitdiff
path: root/source3/lib
diff options
context:
space:
mode:
authorVolker Lendecke <vlendec@samba.org>2006-12-01 14:54:31 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:16:17 -0500
commite2bebe486550374978af200232334ddc7757ba8d (patch)
treee8717476ba4fb93fcf502e42f501ed93b28e281d /source3/lib
parent0d38f8af3946ed14be95430286465436829507ba (diff)
downloadsamba-e2bebe486550374978af200232334ddc7757ba8d.tar.gz
samba-e2bebe486550374978af200232334ddc7757ba8d.tar.bz2
samba-e2bebe486550374978af200232334ddc7757ba8d.zip
r19978: More "net sam policy" improvements. Thanks to Karolin Seeger <ks@sernet.de>
Volker (This used to be commit fde042f29e9e9ac19ed3380e8fbe45fa8441e705)
Diffstat (limited to 'source3/lib')
-rw-r--r--source3/lib/account_pol.c28
1 files changed, 12 insertions, 16 deletions
diff --git a/source3/lib/account_pol.c b/source3/lib/account_pol.c
index 4cb0b77e74..f4008457ac 100644
--- a/source3/lib/account_pol.c
+++ b/source3/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;
}
/****************************************************************************