diff options
author | Stefan Metzmacher <metze@samba.org> | 2006-12-05 15:41:41 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 14:28:54 -0500 |
commit | bb725bbe0132a24e4a56441b7ee3ce765844e219 (patch) | |
tree | 33f46fb70f4c5b1a3556ba84a0a110a243809aa2 /source4 | |
parent | b3f6211f866dbc0986c247bf8cb35233e6229fbc (diff) | |
download | samba-bb725bbe0132a24e4a56441b7ee3ce765844e219.tar.gz |
r20045: implement the drsuapi_DsRemoveDSServer() call
metze
(This used to be commit deb85414c4d54a2eaf7b1318afb2eb6afdea9330)
Diffstat (limited to 'source4')
-rw-r--r-- | source4/libnet/libnet_become_dc.c | 4 | ||||
-rw-r--r-- | source4/libnet/libnet_unbecome_dc.c | 48 |
2 files changed, 49 insertions, 3 deletions
diff --git a/source4/libnet/libnet_become_dc.c b/source4/libnet/libnet_become_dc.c index 502b61d87a3..fc46691ab36 100644 --- a/source4/libnet/libnet_become_dc.c +++ b/source4/libnet/libnet_become_dc.c @@ -712,7 +712,7 @@ static NTSTATUS becomeDC_ldap1_server_object_add(struct libnet_BecomeDC_state *s msg = ldb_msg_new(s); NT_STATUS_HAVE_NO_MEMORY(msg); - msg->dn = ldb_dn_new_fmt(msg, s->ldap1.ldb, "CN=not,CN=add,CN=%s,CN=Servers,CN=%s,CN=Sites,%s", + msg->dn = ldb_dn_new_fmt(msg, s->ldap1.ldb, "CN=%s,CN=Servers,CN=%s,CN=Sites,%s", s->dest_dsa.netbios_name, s->dest_dsa.site_name, s->forest.config_dn_str); @@ -792,7 +792,7 @@ static void becomeDC_connect_ldap1(struct libnet_BecomeDC_state *s) if (!composite_is_ok(c)) return; c->status = becomeDC_ldap1_server_object_add(s); -/* ignore for now... if (!composite_is_ok(c)) return;*/ + if (!composite_is_ok(c)) return; becomeDC_connect_ldap2(s); } diff --git a/source4/libnet/libnet_unbecome_dc.c b/source4/libnet/libnet_unbecome_dc.c index d80ac99aab6..b84b4d9ff5b 100644 --- a/source4/libnet/libnet_unbecome_dc.c +++ b/source4/libnet/libnet_unbecome_dc.c @@ -50,6 +50,7 @@ struct libnet_UnbecomeDC_state { struct drsuapi_DsBind bind_r; struct GUID bind_guid; struct policy_handle bind_handle; + struct drsuapi_DsRemoveDSServer rm_ds_srv_r; } drsuapi; struct { @@ -191,6 +192,12 @@ static NTSTATUS unbecomeDC_ldap_rootdse(struct libnet_UnbecomeDC_state *s) if (!s->forest.config_dn_str) return NT_STATUS_INVALID_NETWORK_RESPONSE; talloc_steal(s, s->forest.config_dn_str); + s->dest_dsa.server_dn_str = talloc_asprintf(s, "CN=%s,CN=Servers,CN=%s,CN=Sites,%s", + s->dest_dsa.netbios_name, + s->dest_dsa.site_name, + s->forest.config_dn_str); + NT_STATUS_HAVE_NO_MEMORY(s->dest_dsa.server_dn_str); + talloc_free(r); return NT_STATUS_OK; } @@ -420,11 +427,50 @@ static void unbecomeDC_drsuapi_bind_recv(struct rpc_request *req) unbecomeDC_drsuapi_remove_ds_server_send(s); } +static void unbecomeDC_drsuapi_remove_ds_server_recv(struct rpc_request *req); + static void unbecomeDC_drsuapi_remove_ds_server_send(struct libnet_UnbecomeDC_state *s) { struct composite_context *c = s->creq; + struct rpc_request *req; + struct drsuapi_DsRemoveDSServer *r = &s->drsuapi.rm_ds_srv_r; + + r->in.bind_handle = &s->drsuapi.bind_handle; + r->in.level = 1; + r->in.req.req1.server_dn= s->dest_dsa.server_dn_str; + r->in.req.req1.domain_dn= s->domain.dn_str; + r->in.req.req1.unknown = 0x00000001; + + req = dcerpc_drsuapi_DsRemoveDSServer_send(s->drsuapi.pipe, s, r); + composite_continue_rpc(c, req, unbecomeDC_drsuapi_remove_ds_server_recv, s); +} + +static void unbecomeDC_drsuapi_remove_ds_server_recv(struct rpc_request *req) +{ + struct libnet_UnbecomeDC_state *s = talloc_get_type(req->async.private, + struct libnet_UnbecomeDC_state); + struct composite_context *c = s->creq; + struct drsuapi_DsRemoveDSServer *r = &s->drsuapi.rm_ds_srv_r; + + 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; + } + + if (r->out.level != 1) { + composite_error(c, NT_STATUS_INVALID_NETWORK_RESPONSE); + return; + } + + if (!W_ERROR_IS_OK(r->out.res.res1.status)) { + composite_error(c, werror_to_ntstatus(r->out.res.res1.status)); + return; + } - composite_error(c, NT_STATUS_NOT_IMPLEMENTED); + composite_done(c); } struct composite_context *libnet_UnbecomeDC_send(struct libnet_context *ctx, TALLOC_CTX *mem_ctx, struct libnet_UnbecomeDC *r) |