summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2006-12-06 15:29:01 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:28:56 -0500
commit383cbaa6b084965597f2b575dea3c23f11cd6bb8 (patch)
treea65fc981ab94dc960adaaeacb6af0051a7544373
parent496b65d59311bd0f2e266bd696f97780fa628e52 (diff)
downloadsamba-383cbaa6b084965597f2b575dea3c23f11cd6bb8.tar.gz
samba-383cbaa6b084965597f2b575dea3c23f11cd6bb8.tar.bz2
samba-383cbaa6b084965597f2b575dea3c23f11cd6bb8.zip
r20055: implement dummy DsAddEntry call (without attributes yet)
metze (This used to be commit 8441500a32ad61e84d7de64bf0b29f8c84f54211)
-rw-r--r--source4/libnet/libnet_become_dc.c67
1 files changed, 67 insertions, 0 deletions
diff --git a/source4/libnet/libnet_become_dc.c b/source4/libnet/libnet_become_dc.c
index 66a61f6396..33b04d0c3e 100644
--- a/source4/libnet/libnet_become_dc.c
+++ b/source4/libnet/libnet_become_dc.c
@@ -921,6 +921,8 @@ static void becomeDC_drsuapi_bind_send(struct libnet_BecomeDC_state *s,
composite_continue_rpc(c, req, recv_fn, s);
}
+static void becomeDC_drsuapi1_add_entry_send(struct libnet_BecomeDC_state *s);
+
static void becomeDC_drsuapi1_bind_recv(struct rpc_request *req)
{
struct libnet_BecomeDC_state *s = talloc_get_type(req->async.private,
@@ -935,6 +937,71 @@ static void becomeDC_drsuapi1_bind_recv(struct rpc_request *req)
return;
}
+ becomeDC_drsuapi1_add_entry_send(s);
+}
+
+static void becomeDC_drsuapi1_add_entry_recv(struct rpc_request *req);
+
+static void becomeDC_drsuapi1_add_entry_send(struct libnet_BecomeDC_state *s)
+{
+ struct composite_context *c = s->creq;
+ struct rpc_request *req;
+ struct drsuapi_DsAddEntry *r;
+ struct drsuapi_DsReplicaObjectIdentifier *identifier;
+ uint32_t num_attributes;
+ struct drsuapi_DsReplicaAttribute *attributes;
+ struct dom_sid zero_sid;
+
+ ZERO_STRUCT(zero_sid);
+
+ r = talloc_zero(s, struct drsuapi_DsAddEntry);
+ if (composite_nomem(r, c)) return;
+
+ /* setup identifier */
+ identifier = talloc(r, struct drsuapi_DsReplicaObjectIdentifier);
+ if (composite_nomem(identifier, c)) return;
+ identifier->guid = GUID_zero();
+ identifier->sid = zero_sid;
+ identifier->dn = talloc_asprintf(identifier, "CN=NTDS Settings,%s",
+ s->dest_dsa.server_dn_str);
+ if (composite_nomem(identifier->dn, c)) return;
+
+ /* allocate attribute array */
+ num_attributes = 0;
+ attributes = talloc_array(r, struct drsuapi_DsReplicaAttribute, num_attributes);
+ if (composite_nomem(attributes, c)) return;
+
+ /* TODO: set real attributes! */
+
+ /* setup request structure */
+ r->in.bind_handle = &s->drsuapi1.bind_handle;
+ r->in.level = 2;
+ r->in.req.req2.first_object.next_object = NULL;
+ r->in.req.req2.first_object.object.identifier = identifier;
+ r->in.req.req2.first_object.object.unknown1 = 0x00000000;
+ r->in.req.req2.first_object.object.attribute_ctr.num_attributes = num_attributes;
+ r->in.req.req2.first_object.object.attribute_ctr.attributes = attributes;
+
+ req = dcerpc_drsuapi_DsAddEntry_send(s->drsuapi1.pipe, r, r);
+ composite_continue_rpc(c, req, becomeDC_drsuapi1_add_entry_recv, s);
+}
+
+static void becomeDC_drsuapi1_add_entry_recv(struct rpc_request *req)
+{
+ struct libnet_BecomeDC_state *s = talloc_get_type(req->async.private,
+ struct libnet_BecomeDC_state);
+ struct composite_context *c = s->creq;
+ struct drsuapi_DsAddEntry *r = talloc_get_type(req->ndr.struct_ptr,
+ struct drsuapi_DsAddEntry);
+
+ c->status = dcerpc_ndr_request_recv(req);
+ if (!composite_is_ok(c)) return;
+
+ if (!W_ERROR_IS_OK(r->out.result)) {
+ composite_error(c, werror_to_ntstatus(r->out.result));
+ return;
+ }
+
becomeDC_connect_ldap2(s);
}