From f731d75081fe3fa2330dee26e931b260669d3f27 Mon Sep 17 00:00:00 2001 From: Samuel Cabrero Date: Wed, 30 Aug 2023 19:59:04 +0200 Subject: [PATCH] s3:libnetapi: Return error from RequestOfflineJoin The error code must be returned to caller even if the error string is not set. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13577 Signed-off-by: Samuel Cabrero Reviewed-by: Andrew Bartlett (cherry picked from commit e4afb211fe32f2aa92cc903df948874046f60305) --- source3/lib/netapi/joindomain.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/source3/lib/netapi/joindomain.c b/source3/lib/netapi/joindomain.c index a2c66877b0c..7145ce5d6d1 100644 --- a/source3/lib/netapi/joindomain.c +++ b/source3/lib/netapi/joindomain.c @@ -862,8 +862,10 @@ static WERROR NetRequestOfflineDomainJoin_backend(struct libnetapi_ctx *ctx, WKSSVC_JOIN_FLAGS_MACHINE_PWD_PASSED; werr = libnet_Join(j, j); - if (!W_ERROR_IS_OK(werr) && j->out.error_string) { - libnetapi_set_error_string(ctx, "%s", j->out.error_string); + if (!W_ERROR_IS_OK(werr)) { + if (j->out.error_string != NULL) { + libnetapi_set_error_string(ctx, "%s", j->out.error_string); + } talloc_free(j); return werr; } -- 2.47.2