summaryrefslogtreecommitdiff
path: root/source3/include/smb_macros.h
diff options
context:
space:
mode:
authorVolker Lendecke <vlendec@samba.org>2005-04-10 15:26:37 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 10:56:34 -0500
commit9f4c0afa0a3e359dfe9ac5dd8df0849b450a3fe1 (patch)
tree9ecaa05413c0bbd5c6f5372cee6bcfb0cf7894c4 /source3/include/smb_macros.h
parent1875e46d05c21f4ca0e1163ecfd41b470dbce09a (diff)
downloadsamba-9f4c0afa0a3e359dfe9ac5dd8df0849b450a3fe1.tar.gz
samba-9f4c0afa0a3e359dfe9ac5dd8df0849b450a3fe1.tar.bz2
samba-9f4c0afa0a3e359dfe9ac5dd8df0849b450a3fe1.zip
r6277: This implements a new caching API for enumerating the pdb elements. It is
modeled after query_displayinfo and should hide the differences between users, groups and aliases while allowing a cache analog load_sampw_entries: struct pdb_search *pdb_search_users(uint16 acct_flags); struct pdb_search *pdb_search_groups(void); struct pdb_search *pdb_search_aliases(const DOM_SID *sid); uint32 pdb_search_entries(struct pdb_search *search, uint32 start_idx, uint32 max_entries, struct samr_displayentry **result); void pdb_search_destroy(struct pdb_search *search); Why this API? Eventually we will need to apply the work gd has started on enumerating users with paged ldap searches to groups and aliases. Before doing that I want to clean up the search routines we have. The sample application (more to follow) is 'net maxrid'. Volker (This used to be commit 8b4f67a1e9d459145cde10b1064781d58d62b805)
Diffstat (limited to 'source3/include/smb_macros.h')
-rw-r--r--source3/include/smb_macros.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/source3/include/smb_macros.h b/source3/include/smb_macros.h
index 1076bd53e8..ab4ee5ee73 100644
--- a/source3/include/smb_macros.h
+++ b/source3/include/smb_macros.h
@@ -351,4 +351,14 @@ copy an IP address from one buffer to another
#endif
+#define ADD_TO_ARRAY(mem_ctx, type, elem, array, num) \
+do { \
+ *(array) = ((mem_ctx) != NULL) ? \
+ TALLOC_REALLOC_ARRAY(mem_ctx, (*(array)), type, (*(num))+1) : \
+ SMB_REALLOC_ARRAY((*(array)), type, (*(num))+1); \
+ SMB_ASSERT((*(array)) != NULL); \
+ (*(array))[*(num)] = (elem); \
+ (*(num)) += 1; \
+} while (0)
+
#endif /* _SMB_MACROS_H */