s3:libads/ldap.c: pass the real workgroup name to get_dc_name()
authorStefan Metzmacher <metze@samba.org>
Mon, 27 Oct 2008 18:36:25 +0000 (19:36 +0100)
committerStefan Metzmacher <metze@samba.org>
Sat, 13 Dec 2008 10:42:36 +0000 (11:42 +0100)
metze

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Signed-off-by: G√ľnther Deschner <gd@samba.org>
(cherry picked from commit c2d4a84abe1b6cbf68d6e9f1bb1f8974d0b628fc)

source3/libads/ldap.c

index 31feea50c73d8d0d29ccc0a255daf58105064944..61e04d1e7c42acd618f393c4cbbb8021ddb72cac 100644 (file)
@@ -267,10 +267,12 @@ static bool ads_try_connect(ADS_STRUCT *ads, const char *server, bool gc)
 
 static NTSTATUS ads_find_dc(ADS_STRUCT *ads)
 {
+       const char *c_domain;
        const char *c_realm;
        int count, i=0;
        struct ip_service *ip_list;
        const char *realm;
+       const char *domain;
        bool got_realm = False;
        bool use_own_domain = False;
        char *sitename;
@@ -308,7 +310,14 @@ static NTSTATUS ads_find_dc(ADS_STRUCT *ads)
                return NT_STATUS_INVALID_PARAMETER; /* rather need MISSING_PARAMETER ... */
        }
 
+       if ( use_own_domain ) {
+               c_domain = lp_workgroup();
+       } else {
+               c_domain = ads->server.workgroup;
+       }
+
        realm = c_realm;
+       domain = c_domain;
 
        /*
         * In case of LDAP we use get_dc_name() as that
@@ -321,7 +330,7 @@ static NTSTATUS ads_find_dc(ADS_STRUCT *ads)
                DEBUG(6,("ads_find_dc: (ldap) looking for %s '%s'\n",
                        (got_realm ? "realm" : "domain"), realm));
 
-               if (get_dc_name(realm, realm, srv_name, &ip_out)) {
+               if (get_dc_name(domain, realm, srv_name, &ip_out)) {
                        /*
                         * we call ads_try_connect() to fill in the
                         * ads->config details