s3-dsgetdcname: the returned dcinfo unc should always be prefixed
authorGünther Deschner <gd@samba.org>
Sat, 13 Feb 2021 21:03:06 +0000 (22:03 +0100)
committerGünther Deschner <gd@samba.org>
Wed, 14 Jul 2021 16:49:30 +0000 (16:49 +0000)
Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
source3/libsmb/dsgetdcname.c

index ae90e07de77750e81aef65671e7a5f8de08bc99c..3760f7076d7116db99dd855e55a68f675b2833a3 100644 (file)
@@ -646,7 +646,12 @@ static NTSTATUS make_domain_controller_info(TALLOC_CTX *mem_ctx,
        NT_STATUS_HAVE_NO_MEMORY(info);
 
        if (dc_unc) {
-               info->dc_unc = talloc_strdup(mem_ctx, dc_unc);
+               if (!(dc_unc[0] == '\\' && dc_unc[1] == '\\')) {
+                       info->dc_unc = talloc_asprintf(mem_ctx, "\\\\%s",
+                                                      dc_unc);
+               } else {
+                       info->dc_unc = talloc_strdup(mem_ctx, dc_unc);
+               }
                NT_STATUS_HAVE_NO_MEMORY(info->dc_unc);
        }