summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorKamen Mazdrashki <kamen.mazdrashki@postpath.com>2010-03-12 13:42:05 +0200
committerKamen Mazdrashki <kamen.mazdrashki@postpath.com>2010-03-24 17:34:35 +0200
commit427a1f3c6269105256f5d0b0cb642465e728314a (patch)
tree9c07e73d203fa25f221b77b017af6b5d26daf7e4 /source4
parentfbc1528649b378c9fd004d092b89cb7db545fc61 (diff)
downloadsamba-427a1f3c6269105256f5d0b0cb642465e728314a.tar.gz
samba-427a1f3c6269105256f5d0b0cb642465e728314a.tar.bz2
samba-427a1f3c6269105256f5d0b0cb642465e728314a.zip
s4/drs: DsAddEntry - extending error handling for V2 replies
After having more complete definition for DsAddEntryReply V2 structure, we can now handle error state in more robust way, not just counting on number of objects returned.
Diffstat (limited to 'source4')
-rw-r--r--source4/libnet/libnet_become_dc.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/source4/libnet/libnet_become_dc.c b/source4/libnet/libnet_become_dc.c
index 2dc1ee955e..ccfb012d6f 100644
--- a/source4/libnet/libnet_become_dc.c
+++ b/source4/libnet/libnet_become_dc.c
@@ -2324,11 +2324,24 @@ static void becomeDC_drsuapi1_add_entry_recv(struct tevent_req *subreq)
s->dest_dsa.ntds_guid = r->out.ctr->ctr3.objects[0].guid;
} else if (*r->out.level_out == 2) {
- if (r->out.ctr->ctr2.count != 1) {
- composite_error(c, werror_to_ntstatus(r->out.ctr->ctr2.error.extended_err));
+ if (DRSUAPI_DIRERR_OK != r->out.ctr->ctr2.dir_err) {
+ DEBUG(0,("DsAddEntry failed with: dir_err = %d, extended_err = %s",
+ r->out.ctr->ctr2.dir_err,
+ win_errstr(r->out.ctr->ctr2.extended_err)));
+ composite_error(c, werror_to_ntstatus(r->out.ctr->ctr2.extended_err));
return;
}
+ if (1 != r->out.ctr->ctr2.count) {
+ DEBUG(0,("DsAddEntry: something very wrong had happened - "
+ "method succeeded but objects returned are %d (expected 1). "
+ "Errors: dir_err = %d, extended_err = %s",
+ r->out.ctr->ctr2.count,
+ r->out.ctr->ctr2.dir_err,
+ win_errstr(r->out.ctr->ctr2.extended_err)));
+ composite_error(c, NT_STATUS_INVALID_NETWORK_RESPONSE);
+ }
+
s->dest_dsa.ntds_guid = r->out.ctr->ctr2.objects[0].guid;
} else {
composite_error(c, NT_STATUS_INVALID_NETWORK_RESPONSE);