diff options
author | Amitay Isaacs <amitay@gmail.com> | 2011-08-15 17:12:46 +1000 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2011-08-19 16:34:56 +1000 |
commit | 4201d6fd68b382208395b806b77b70e5e1be8d4a (patch) | |
tree | e11948993afb08457bdbdd25891114876c95efce /source3/passdb | |
parent | a6d06c069734cae037105350982545b6a964bbd8 (diff) | |
download | samba-4201d6fd68b382208395b806b77b70e5e1be8d4a.tar.gz samba-4201d6fd68b382208395b806b77b70e5e1be8d4a.tar.bz2 samba-4201d6fd68b382208395b806b77b70e5e1be8d4a.zip |
s3-passdb: Replace SMB_MALLOC_ARRAY()/SAFE_FREE() with talloc equivalents.
Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'source3/passdb')
-rw-r--r-- | source3/passdb/account_pol.c | 13 | ||||
-rw-r--r-- | source3/passdb/proto.h | 2 |
2 files changed, 7 insertions, 8 deletions
diff --git a/source3/passdb/account_pol.c b/source3/passdb/account_pol.c index 3556869bd8..a491c27a9d 100644 --- a/source3/passdb/account_pol.c +++ b/source3/passdb/account_pol.c @@ -89,22 +89,21 @@ static const struct ap_table account_policy_names[] = { {0, NULL, 0, "", NULL} }; -void account_policy_names_list(const char ***names, int *num_names) +void account_policy_names_list(TALLOC_CTX *mem_ctx, const char ***names, int *num_names) { const char **nl; - int i, count; + int i, count = ARRAY_SIZE(account_policy_names); - for (count=0; account_policy_names[count].string; count++) { - } - nl = SMB_MALLOC_ARRAY(const char *, count); + nl = talloc_array(mem_ctx, const char *, count); if (!nl) { *num_names = 0; return; } - for (i=0; account_policy_names[i].string; i++) { + for (i=0; i<count; i++) { nl[i] = account_policy_names[i].string; } - *num_names = count; + /* Do not return the last null entry */ + *num_names = count-1; *names = nl; return; } diff --git a/source3/passdb/proto.h b/source3/passdb/proto.h index 24a7cba891..63208ea9c1 100644 --- a/source3/passdb/proto.h +++ b/source3/passdb/proto.h @@ -39,7 +39,7 @@ /* The following definitions come from passdb/account_pol.c */ -void account_policy_names_list(const char ***names, int *num_names); +void account_policy_names_list(TALLOC_CTX *mem_ctx, const char ***names, int *num_names); const char *decode_account_policy_name(enum pdb_policy_type type); const char *get_account_policy_attr(enum pdb_policy_type type); const char *account_policy_get_desc(enum pdb_policy_type type); |