]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3:libsmb: let discover_dc_netbios() return DOMAIN_CONTROLLER_NOT_FOUND
authorStefan Metzmacher <metze@samba.org>
Fri, 11 Oct 2024 13:32:22 +0000 (13:32 +0000)
committerStefan Metzmacher <metze@samba.org>
Thu, 5 Dec 2024 16:46:37 +0000 (16:46 +0000)
We may get NT_STATUS_NOT_FOUND when the name can't be resolved
and NT_STATUS_INVALID_ADDRESS if the system doesn't have ipv4
addresses...

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
source3/libsmb/dsgetdcname.c

index 9053ee5c8b05f3fcf7ca1d65f22f208dc8027b17..6bbe4e0b4ad1369646f9dd5dbf7f897c0f278ae0 100644 (file)
@@ -435,7 +435,19 @@ static NTSTATUS discover_dc_netbios(TALLOC_CTX *mem_ctx,
                                        &count,
                                        resolve_order);
        if (!NT_STATUS_IS_OK(status)) {
-               DEBUG(10,("discover_dc_netbios: failed to find DC\n"));
+               NTSTATUS raw_status = status;
+
+               if (NT_STATUS_EQUAL(status, NT_STATUS_NOT_FOUND)) {
+                       status = NT_STATUS_DOMAIN_CONTROLLER_NOT_FOUND;
+               }
+               if (NT_STATUS_EQUAL(status, NT_STATUS_INVALID_ADDRESS)) {
+                       status = NT_STATUS_DOMAIN_CONTROLLER_NOT_FOUND;
+               }
+
+               DBG_DEBUG("failed to find DC for %s: %s => %s\n",
+                         domain_name,
+                         nt_errstr(raw_status),
+                         nt_errstr(status));
                return status;
        }