From d4ac326d46faab010eeeb24c893ab13bbbf0337e Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 8 Jul 2004 21:01:30 +0000 Subject: r1412: Fix password history list in tdbsam. Fix some memory leaks. Add my (C) to a header file that was at least 50% mine :-). Jeremy. (This used to be commit 8ee6060977ec8e65082f3ad09e1e1ccf5b4672ed) --- source3/lib/account_pol.c | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) (limited to 'source3/lib') diff --git a/source3/lib/account_pol.c b/source3/lib/account_pol.c index c2c63493a6..8d5b963da2 100644 --- a/source3/lib/account_pol.c +++ b/source3/lib/account_pol.c @@ -81,6 +81,30 @@ static const struct { {0, NULL} }; +char *account_policy_names_list(void) +{ + char *nl, *p; + int i; + size_t len = 0; + + for (i=0; account_policy_names[i].string; i++) { + len += strlen(account_policy_names[i].string) + 1; + } + len++; + nl = malloc(len); + if (!nl) { + return NULL; + } + 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; + } + *p = '\0'; + return nl; +} + /**************************************************************************** Get the account policy name as a string from its #define'ed number ****************************************************************************/ @@ -111,9 +135,9 @@ int account_policy_name_to_fieldnum(const char *name) } - /**************************************************************************** ****************************************************************************/ + BOOL account_policy_get(int field, uint32 *value) { fstring name; @@ -159,4 +183,3 @@ BOOL account_policy_set(int field, uint32 value) return True; } - -- cgit