summaryrefslogtreecommitdiff
path: root/source3/include
diff options
context:
space:
mode:
authorVolker Lendecke <vlendec@samba.org>2005-04-15 13:41:49 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 10:56:38 -0500
commitd3d6126d94d55a69c45b2f7a63a7fa9b561baf48 (patch)
treece4e45d5571fb0e1a090b59ffa74a56b8a883334 /source3/include
parent496c6f088492e3f74bba11da21ffc8855b2eb7f9 (diff)
downloadsamba-d3d6126d94d55a69c45b2f7a63a7fa9b561baf48.tar.gz
samba-d3d6126d94d55a69c45b2f7a63a7fa9b561baf48.tar.bz2
samba-d3d6126d94d55a69c45b2f7a63a7fa9b561baf48.zip
r6351: This is quite a large and intrusive patch, but there are not many pieces that
can be taken out of it, so I decided to commit this in one lump. It changes the passdb enumerating functions to use ldap paged results where possible. In particular the samr calls querydispinfo, enumdomusers and friends have undergone significant internal changes. I have tested this extensively with rpcclient and a bit with usrmgr.exe. More tests and the merge to trunk will follow later. The code is based on a first implementation by Günther Deschner, but has evolved quite a bit since then. Volker (This used to be commit f0bb44ac58e190e19eb4e92928979b0446e611c9)
Diffstat (limited to 'source3/include')
-rw-r--r--source3/include/passdb.h86
-rw-r--r--source3/include/smb_macros.h3
-rw-r--r--source3/include/smbldap.h1
3 files changed, 56 insertions, 34 deletions
diff --git a/source3/include/passdb.h b/source3/include/passdb.h
index 624f0c5fea..0c816271b0 100644
--- a/source3/include/passdb.h
+++ b/source3/include/passdb.h
@@ -232,6 +232,30 @@ struct acct_info
uint32 rid; /* domain-relative RID */
};
+struct samr_displayentry {
+ uint32 rid;
+ uint16 acct_flags;
+ const char *account_name;
+ const char *fullname;
+ const char *description;
+};
+
+enum pdb_search_type {
+ PDB_USER_SEARCH,
+ PDB_GROUP_SEARCH,
+ PDB_ALIAS_SEARCH
+};
+
+struct pdb_search {
+ TALLOC_CTX *mem_ctx;
+ enum pdb_search_type type;
+ struct samr_displayentry *cache;
+ uint32 num_entries;
+ ssize_t cache_size;
+ BOOL search_ended;
+ void *private;
+};
+
/*****************************************************************
Functions to be implemented by the new (v2) passdb API
****************************************************************/
@@ -310,12 +334,6 @@ typedef struct pdb_context
NTSTATUS (*pdb_delete_alias)(struct pdb_context *context,
const DOM_SID *sid);
- NTSTATUS (*pdb_enum_aliases)(struct pdb_context *context,
- const DOM_SID *domain_sid,
- uint32 start_idx, uint32 num_entries,
- uint32 *num_aliases,
- struct acct_info **aliases);
-
NTSTATUS (*pdb_get_aliasinfo)(struct pdb_context *context,
const DOM_SID *sid,
struct acct_info *info);
@@ -352,6 +370,20 @@ typedef struct pdb_context
const char ***names,
uint32 **attrs);
+ BOOL (*pdb_search_users)(struct pdb_context *context,
+ struct pdb_search *search,
+ uint16 acct_flags);
+ BOOL (*pdb_search_groups)(struct pdb_context *context,
+ struct pdb_search *search);
+ BOOL (*pdb_search_aliases)(struct pdb_context *context,
+ struct pdb_search *search,
+ const DOM_SID *sid);
+ BOOL (*pdb_search_next_entry)(struct pdb_context *context,
+ struct pdb_search *search,
+ struct samr_displayentry *entry);
+ void (*pdb_search_end)(struct pdb_context *context,
+ struct pdb_search *search);
+
void (*free_fn)(struct pdb_context **);
TALLOC_CTX *mem_ctx;
@@ -426,11 +458,6 @@ typedef struct pdb_methods
NTSTATUS (*delete_alias)(struct pdb_methods *methods,
const DOM_SID *sid);
- NTSTATUS (*enum_aliases)(struct pdb_methods *methods,
- const DOM_SID *domain_sid,
- uint32 start_idx, uint32 max_entries,
- uint32 *num_aliases, struct acct_info **info);
-
NTSTATUS (*get_aliasinfo)(struct pdb_methods *methods,
const DOM_SID *sid,
struct acct_info *info);
@@ -461,6 +488,20 @@ typedef struct pdb_methods
const char ***names,
uint32 **attrs);
+ BOOL (*search_users)(struct pdb_methods *methods,
+ struct pdb_search *search,
+ uint16 acct_flags);
+ BOOL (*search_groups)(struct pdb_methods *methods,
+ struct pdb_search *search);
+ BOOL (*search_aliases)(struct pdb_methods *methods,
+ struct pdb_search *search,
+ const DOM_SID *sid);
+ BOOL (*search_next_entry)(struct pdb_methods *methods,
+ struct pdb_search *search,
+ struct samr_displayentry *entry);
+ void (*search_end)(struct pdb_methods *methods,
+ struct pdb_search *search);
+
void *private_data; /* Private data of some kind */
void (*free_private_data)(void **);
@@ -480,27 +521,4 @@ struct pdb_init_function_entry {
enum sql_search_field { SQL_SEARCH_NONE = 0, SQL_SEARCH_USER_SID = 1, SQL_SEARCH_USER_NAME = 2};
-struct samr_displayentry {
- uint32 rid;
- uint16 acct_flags;
- const char *account_name;
- const char *fullname;
- const char *description;
-};
-
-enum pdb_search_type {
- PDB_USER_SEARCH,
- PDB_GROUP_SEARCH,
- PDB_ALIAS_SEARCH
-};
-
-struct pdb_search {
- TALLOC_CTX *mem_ctx;
- enum pdb_search_type type;
- struct samr_displayentry *cache;
- uint32 cache_size;
- BOOL search_ended;
- void *private;
-};
-
#endif /* _PASSDB_H */
diff --git a/source3/include/smb_macros.h b/source3/include/smb_macros.h
index b7a3a68bec..04616eb8ab 100644
--- a/source3/include/smb_macros.h
+++ b/source3/include/smb_macros.h
@@ -362,4 +362,7 @@ do { \
(*(num)) += 1; \
} while (0)
+#define ADD_TO_LARGE_ARRAY(mem_ctx, type, elem, array, num, size) \
+ add_to_large_array((mem_ctx), sizeof(type), &(elem), (void **)(array), (num), (size));
+
#endif /* _SMB_MACROS_H */
diff --git a/source3/include/smbldap.h b/source3/include/smbldap.h
index e6a6a1b7c6..b54b3f4325 100644
--- a/source3/include/smbldap.h
+++ b/source3/include/smbldap.h
@@ -185,5 +185,6 @@ struct ldapsam_privates {
struct smbldap_state;
#define LDAP_CONNECT_DEFAULT_TIMEOUT 15
+#define LDAP_PAGE_SIZE 1024
#endif /* _SMBLDAP_H */