r20874: We need to distinguish client sitenames per realm. We were overwriting
[obnox/samba/samba-obnox.git] / source3 / utils / net_lookup.c
index 8e223e67f3ba398a2f78037f48640235e3599ce5..19ba5ae7f46bf91289d23561c863c263f7d88f7d 100644 (file)
@@ -84,7 +84,7 @@ static int net_lookup_ldap(int argc, const char **argv)
        struct hostent *hostent;
        struct dns_rr_srv *dcs = NULL;
        int numdcs = 0;
-       char *sitename = sitename_fetch();
+       char *sitename;
        TALLOC_CTX *ctx;
        NTSTATUS status;
 
@@ -93,6 +93,8 @@ static int net_lookup_ldap(int argc, const char **argv)
        else
                domain = opt_target_workgroup;
 
+       sitename = sitename_fetch(domain);
+
        if ( (ctx = talloc_init("net_lookup_ldap")) == NULL ) {
                d_fprintf(stderr, "net_lookup_ldap: talloc_inti() failed!\n");
                SAFE_FREE(sitename);
@@ -171,7 +173,7 @@ static int net_lookup_dc(int argc, const char **argv)
        asprintf(&pdc_str, "%s", inet_ntoa(addr));
        d_printf("%s\n", pdc_str);
 
-       sitename = sitename_fetch();
+       sitename = sitename_fetch(domain);
        if (!NT_STATUS_IS_OK(get_sorted_dc_list(domain, sitename, &ip_list, &count, False))) {
                SAFE_FREE(pdc_str);
                SAFE_FREE(sitename);