summaryrefslogtreecommitdiff
path: root/source4/libnet
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2006-12-07 19:18:55 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:28:58 -0500
commit99390be80c36b1d1f9a6924876409e88e6c4e62b (patch)
tree1a6e4bfd7c418a95909c96857358aa74df8e7161 /source4/libnet
parent3aedc80896f1f71e218080b93fd92751f5e88550 (diff)
downloadsamba-99390be80c36b1d1f9a6924876409e88e6c4e62b.tar.gz
samba-99390be80c36b1d1f9a6924876409e88e6c4e62b.tar.bz2
samba-99390be80c36b1d1f9a6924876409e88e6c4e62b.zip
r20068: handle DsAddEntry() errors
metze (This used to be commit 45466871b4f10948653274c3c1a43eeac2edc244)
Diffstat (limited to 'source4/libnet')
-rw-r--r--source4/libnet/libnet_become_dc.c52
1 files changed, 52 insertions, 0 deletions
diff --git a/source4/libnet/libnet_become_dc.c b/source4/libnet/libnet_become_dc.c
index 917c124dab..00958c30d6 100644
--- a/source4/libnet/libnet_become_dc.c
+++ b/source4/libnet/libnet_become_dc.c
@@ -102,6 +102,7 @@ struct libnet_BecomeDC_state {
const char *computer_dn_str;
const char *server_dn_str;
const char *ntds_dn_str;
+ struct GUID ntds_guid;
struct GUID invocation_id;
uint32_t user_account_control;
} dest_dsa;
@@ -1404,6 +1405,57 @@ static void becomeDC_drsuapi1_add_entry_recv(struct rpc_request *req)
return;
}
+ if (r->out.level == 3) {
+ if (r->out.ctr.ctr3.count != 1) {
+ WERROR status;
+
+ if (r->out.ctr.ctr3.level != 1) {
+ composite_error(c, NT_STATUS_INVALID_NETWORK_RESPONSE);
+ return;
+ }
+
+ if (!r->out.ctr.ctr3.error) {
+ composite_error(c, NT_STATUS_INVALID_NETWORK_RESPONSE);
+ return;
+ }
+
+ status = r->out.ctr.ctr3.error->info1.status;
+
+ if (!r->out.ctr.ctr3.error->info1.info) {
+ composite_error(c, werror_to_ntstatus(status));
+ return;
+ }
+
+ /* see if we can get a more detailed error */
+ switch (r->out.ctr.ctr3.error->info1.level) {
+ case 1:
+ status = r->out.ctr.ctr3.error->info1.info->error1.status;
+ break;
+ case 4:
+ case 5:
+ case 6:
+ case 7:
+ status = r->out.ctr.ctr3.error->info1.info->errorX.status;
+ break;
+ }
+
+ composite_error(c, werror_to_ntstatus(status));
+ return;
+ }
+
+ s->dest_dsa.ntds_guid = r->out.ctr.ctr3.objects[0].guid;
+ } else if (r->out.level == 2) {
+ if (r->out.ctr.ctr2.count != 1) {
+ composite_error(c, werror_to_ntstatus(r->out.ctr.ctr2.error.status));
+ return;
+ }
+
+ s->dest_dsa.ntds_guid = r->out.ctr.ctr2.objects[0].guid;
+ } else {
+ composite_error(c, NT_STATUS_INVALID_NETWORK_RESPONSE);
+ return;
+ }
+
becomeDC_connect_ldap2(s);
}