From a62d0419dee3d3fe8618baa71aa882c5bed54072 Mon Sep 17 00:00:00 2001 From: Kamen Mazdrashki Date: Sun, 11 Apr 2010 17:27:30 +0300 Subject: s4/libnet: handle errors returned for DsAddEntry_v3 properly It turns out ms-docs are little bit misleading - in case of no error, r->out.ctr->ctr3.err_data is not NULL, but error information (r->out.ctr->ctr3.err_data->v1.info) is NULL! --- source4/libnet/libnet_become_dc.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'source4') diff --git a/source4/libnet/libnet_become_dc.c b/source4/libnet/libnet_become_dc.c index dcd65812d4..486416e1bd 100644 --- a/source4/libnet/libnet_become_dc.c +++ b/source4/libnet/libnet_become_dc.c @@ -2285,11 +2285,12 @@ static void becomeDC_drsuapi1_add_entry_recv(struct tevent_req *subreq) } if (*r->out.level_out == 3) { + WERROR status; union drsuapi_DsAddEntry_ErrData *err_data = r->out.ctr->ctr3.err_data; /* check for errors */ - if (err_data) { - WERROR status; + status = err_data ? err_data->v1.status : WERR_OK; + if (!W_ERROR_IS_OK(status)) { struct drsuapi_DsAddEntryErrorInfo_Attr_V1 *attr_err; struct drsuapi_DsAddEntry_AttrErrListItem_V1 *attr_err_li; struct drsuapi_DsAddEntryErrorInfo_Name_V1 *name_err; @@ -2301,8 +2302,6 @@ static void becomeDC_drsuapi1_add_entry_recv(struct tevent_req *subreq) return; } - status = err_data->v1.status; - DEBUG(0,("DsAddEntry (R3) failed: " "Errors: dir_err = %d, status = %s;\n", err_data->v1.dir_err, -- cgit