summaryrefslogtreecommitdiff
path: root/source4/torture
diff options
context:
space:
mode:
Diffstat (limited to 'source4/torture')
-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 ||