s3:libnetapi: Return error from RequestOfflineJoin
authorSamuel Cabrero <scabrero@samba.org>
Wed, 30 Aug 2023 17:59:04 +0000 (19:59 +0200)
committerJule Anger <janger@samba.org>
Wed, 29 Nov 2023 14:51:11 +0000 (14:51 +0000)
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 <scabrero@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
(cherry picked from commit e4afb211fe32f2aa92cc903df948874046f60305)

source3/lib/netapi/joindomain.c

index a2c66877b0c617c3845eec33532de0d770b9beff..7145ce5d6d1a0c1797e54290f05a29e900f8c07b 100644 (file)
@@ -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;
        }