summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorBenjamin Franzke <benjaminfranzke@googlemail.com>2013-10-31 09:52:25 +0100
committerBenjamin Franzke <benjaminfranzke@googlemail.com>2013-11-01 12:24:01 +0100
commit5323208ab498ab9597e4711ff9db8757d991e9f3 (patch)
treecd3a41c3d1ddb6b5f51344f35bc8629c7bb9a0f5 /source4
parentd2b08b56c152c82446bec58f00d38ae59a71ca50 (diff)
downloadsamba-5323208ab498ab9597e4711ff9db8757d991e9f3.tar.gz
samba-5323208ab498ab9597e4711ff9db8757d991e9f3.tar.bz2
samba-5323208ab498ab9597e4711ff9db8757d991e9f3.zip
s4:torture/netlogon: Add more genereric tcp netlogon function
To be able to query custom attrs and filters later.
Diffstat (limited to 'source4')
-rw-r--r--source4/torture/ldap/netlogon.c51
1 files changed, 35 insertions, 16 deletions
diff --git a/source4/torture/ldap/netlogon.c b/source4/torture/ldap/netlogon.c
index 950feac86d..bdf30e95d4 100644
--- a/source4/torture/ldap/netlogon.c
+++ b/source4/torture/ldap/netlogon.c
@@ -348,24 +348,17 @@ static bool test_ldap_netlogon_flags(struct torture_context *tctx,
return true;
}
-static NTSTATUS tcp_ldap_netlogon(void *data,
- TALLOC_CTX *mem_ctx,
- struct cldap_netlogon *io)
+static NTSTATUS ldap_rootdse(struct ldap_connection *conn,
+ TALLOC_CTX *mem_ctx,
+ const char *filter,
+ const char **attrs,
+ int num_attr,
+ struct ldap_SearchResEntry **res)
{
- struct ldap_connection *conn = talloc_get_type(data,
- struct ldap_connection);
- char *filter;
struct ldap_message *msg, *result;
struct ldap_request *req;
- struct ldap_SearchResEntry *res;
- DATA_BLOB *blob;
NTSTATUS status;
- filter = cldap_netlogon_create_filter(mem_ctx, io);
- if (filter == NULL) {
- return NT_STATUS_NO_MEMORY;
- }
-
msg = new_ldap_message(mem_ctx);
if (!msg) {
return NT_STATUS_NO_MEMORY;
@@ -379,8 +372,8 @@ static NTSTATUS tcp_ldap_netlogon(void *data,
msg->r.SearchRequest.sizelimit = 0;
msg->r.SearchRequest.attributesonly = false;
msg->r.SearchRequest.tree = ldb_parse_tree(msg, filter);
- msg->r.SearchRequest.num_attributes = 1;
- msg->r.SearchRequest.attributes = (const char *[]) { "netlogon" };
+ msg->r.SearchRequest.num_attributes = num_attr;
+ msg->r.SearchRequest.attributes = attrs;
req = ldap_request_send(conn, msg);
if (req == NULL) {
@@ -398,7 +391,33 @@ static NTSTATUS tcp_ldap_netlogon(void *data,
}
}
- res = &result->r.SearchResultEntry;
+ *res = &result->r.SearchResultEntry;
+
+ return NT_STATUS_OK;
+}
+
+static NTSTATUS tcp_ldap_netlogon(void *data,
+ TALLOC_CTX *mem_ctx,
+ struct cldap_netlogon *io)
+{
+ struct ldap_connection *conn = talloc_get_type(data,
+ struct ldap_connection);
+ char *filter;
+ struct ldap_SearchResEntry *res;
+ NTSTATUS status;
+ DATA_BLOB *blob;
+
+ filter = cldap_netlogon_create_filter(mem_ctx, io);
+ if (filter == NULL) {
+ return NT_STATUS_NO_MEMORY;
+ }
+
+ status = ldap_rootdse(conn, mem_ctx, filter,
+ (const char *[]) { "netlogon" }, 1, &res);
+ if (!NT_STATUS_IS_OK(status)) {
+ return status;
+ }
+
if (res->num_attributes != 1 ||
strcasecmp(res->attributes[0].name, "netlogon") != 0 ||
res->attributes[0].num_values != 1 ||