mirror of
https://github.com/samba-team/samba.git
synced 2025-02-15 05:57:49 +03:00
Check in Andrew's fix for bug #305 (always use lp_realm() )
Also make sure thet ads_startup uses lp_realm instead of just relying on the workgroup name. Fixes bug in net ads join when the workgroup defaults to "WORKGROUP" and we ignore the realm name.
This commit is contained in:
parent
e98fbfaf38
commit
b1763ace4e
source
@ -28,10 +28,6 @@
|
||||
#undef DBGC_CLASS
|
||||
#define DBGC_CLASS DBGC_WINBIND
|
||||
|
||||
/* the realm of our primary LDAP server */
|
||||
static char *primary_realm;
|
||||
|
||||
|
||||
/*
|
||||
return our ads connections structure for a domain. We keep the connection
|
||||
open to make things faster
|
||||
@ -58,10 +54,8 @@ static ADS_STRUCT *ads_cached_connection(struct winbindd_domain *domain)
|
||||
SAFE_FREE(ads->auth.password);
|
||||
ads->auth.password = secrets_fetch_machine_password(lp_workgroup(), NULL, NULL);
|
||||
|
||||
if (primary_realm) {
|
||||
SAFE_FREE(ads->auth.realm);
|
||||
ads->auth.realm = strdup(primary_realm);
|
||||
}
|
||||
SAFE_FREE(ads->auth.realm);
|
||||
ads->auth.realm = strdup(lp_realm());
|
||||
|
||||
status = ads_connect(ads);
|
||||
if (!ADS_ERR_OK(status) || !ads->config.realm) {
|
||||
@ -84,11 +78,6 @@ static ADS_STRUCT *ads_cached_connection(struct winbindd_domain *domain)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* remember our primary realm for trusted domain support */
|
||||
if (!primary_realm) {
|
||||
primary_realm = strdup(ads->config.realm);
|
||||
}
|
||||
|
||||
domain->private = (void *)ads;
|
||||
return ads;
|
||||
}
|
||||
|
@ -127,9 +127,14 @@ static ADS_STRUCT *ads_startup(void)
|
||||
ADS_STATUS status;
|
||||
BOOL need_password = False;
|
||||
BOOL second_time = False;
|
||||
char *cp;
|
||||
char *cp;
|
||||
|
||||
ads = ads_init(NULL, opt_target_workgroup, opt_host);
|
||||
/* lp_realm() should be handled by a command line param,
|
||||
However, the join requires that realm be set in smb.conf
|
||||
and compares our realm with the remote server's so this is
|
||||
ok until someone needs more flexibility */
|
||||
|
||||
ads = ads_init(lp_realm(), opt_target_workgroup, opt_host);
|
||||
|
||||
if (!opt_user_name) {
|
||||
opt_user_name = "administrator";
|
||||
|
Loading…
x
Reference in New Issue
Block a user