Ignore:
Timestamp:
Mar 11, 2009, 9:14:55 AM (16 years ago)
Author:
Paul Smedley
Message:

Add 'missing' 3.0.34 diffs

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/samba-3.0/source/libads/ldap.c

    r134 r165  
    157157        }
    158158
     159        if (ads->config.client_site_name == NULL) {
     160                DEBUG(10,("ads_closest_dc: client belongs to no site\n"));
     161                return True;
     162        }
     163
    159164        DEBUG(10,("ads_closest_dc: %s is not the closest DC\n",
    160165                ads->config.ldap_server_name));
     
    244249static NTSTATUS ads_find_dc(ADS_STRUCT *ads)
    245250{
     251        const char *c_domain;
    246252        const char *c_realm;
    247253        int count, i=0;
    248254        struct ip_service *ip_list;
     255        pstring domain;
    249256        pstring realm;
    250257        BOOL got_realm = False;
     
    278285                                c_realm = lp_workgroup();
    279286                }
    280                
    281                 if ( !c_realm || !*c_realm ) {
    282                         DEBUG(0,("ads_find_dc: no realm or workgroup!  Don't know what to do\n"));
    283                         return NT_STATUS_INVALID_PARAMETER; /* rather need MISSING_PARAMETER ... */
    284                 }
    285         }
    286        
     287        }
     288
     289        if ( !c_realm || !*c_realm ) {
     290                DEBUG(0,("ads_find_dc: no realm or workgroup!  Don't know what to do\n"));
     291                return NT_STATUS_INVALID_PARAMETER; /* rather need MISSING_PARAMETER ... */
     292        }
     293
     294        if ( use_own_domain ) {
     295                c_domain = lp_workgroup();
     296        } else {
     297                c_domain = ads->server.workgroup;
     298        }
     299
     300        pstrcpy( domain, c_domain );
    287301        pstrcpy( realm, c_realm );
    288302
     303        /*
     304         * In case of LDAP we use get_dc_name() as that
     305         * creates the custom krb5.conf file
     306         */
     307        if (!(ads->auth.flags & ADS_AUTH_NO_BIND)) {
     308                fstring srv_name;
     309                struct in_addr ip_out;
     310
     311                DEBUG(6,("ads_find_dc: (ldap) looking for %s '%s'\n",
     312                        (got_realm ? "realm" : "domain"), realm));
     313
     314                if (get_dc_name(domain, realm, srv_name, &ip_out)) {
     315                        /*
     316                         * we call ads_try_connect() to fill in the
     317                         * ads->config details
     318                         */
     319                        if (ads_try_connect(ads, srv_name)) {
     320                                return NT_STATUS_OK;
     321                        }
     322                }
     323
     324                return NT_STATUS_NO_LOGON_SERVERS;
     325        }
     326
    289327        sitename = sitename_fetch(realm);
    290328
    291329 again:
    292330
    293         DEBUG(6,("ads_find_dc: looking for %s '%s'\n",
     331        DEBUG(6,("ads_find_dc: (cldap) looking for %s '%s'\n",
    294332                (got_realm ? "realm" : "domain"), realm));
    295333
     
    436474        /* cache the successful connection for workgroup and realm */
    437475        if (ads_closest_dc(ads)) {
    438                 saf_store( ads->server.workgroup, inet_ntoa(ads->ldap_ip));
    439                 saf_store( ads->server.realm, inet_ntoa(ads->ldap_ip));
     476                saf_store( ads->server.workgroup, ads->config.ldap_server_name);
     477                saf_store( ads->server.realm, ads->config.ldap_server_name);
    440478        }
    441479
Note: See TracChangeset for help on using the changeset viewer.