net: Fix net lookup dsgetdcname, no need to pull site ourselves.
authorGünther Deschner <gd@samba.org>
Thu, 15 May 2008 15:00:31 +0000 (17:00 +0200)
committerGünther Deschner <gd@samba.org>
Thu, 15 May 2008 15:00:31 +0000 (17:00 +0200)
Guenther
(This used to be commit 954d0998c2c00140addb6ba3845e80ed91e4effc)

source3/utils/net_lookup.c

index 7e4d85d057d39bca0d4c9c7c120a2c8030a2c249..8b9ddb62bacc111d74b74a0af4303b45261400e6 100644 (file)
@@ -364,7 +364,7 @@ static int net_lookup_dsgetdcname(struct net_context *c, int argc, const char **
 {
        NTSTATUS status;
        const char *domain_name = NULL;
-       char *site_name = NULL;
+       const char *site_name = NULL;
        uint32_t flags = 0;
        struct netr_DsRGetDCNameInfo *info = NULL;
        TALLOC_CTX *mem_ctx;
@@ -391,22 +391,13 @@ static int net_lookup_dsgetdcname(struct net_context *c, int argc, const char **
        }
 
        if (argc == 3) {
-               site_name = SMB_STRDUP(argv[2]);
-               if (!site_name) {
-                       TALLOC_FREE(mem_ctx);
-                       return -1;
-               }
-       }
-
-       if (!site_name) {
-               site_name = sitename_fetch(domain_name);
+               site_name = argv[2];
        }
 
        status = dsgetdcname(mem_ctx, NULL, domain_name, NULL, site_name,
                             flags, &info);
        if (!NT_STATUS_IS_OK(status)) {
                d_printf("failed with: %s\n", nt_errstr(status));
-               SAFE_FREE(site_name);
                TALLOC_FREE(mem_ctx);
                return -1;
        }
@@ -415,7 +406,6 @@ static int net_lookup_dsgetdcname(struct net_context *c, int argc, const char **
        printf("%s\n", s);
        TALLOC_FREE(s);
 
-       SAFE_FREE(site_name);
        TALLOC_FREE(mem_ctx);
        return 0;
 }