summaryrefslogtreecommitdiffstats
path: root/source/utils
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2004-10-06 16:21:35 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 10:52:54 -0500
commit8836621694c95779475fa9a1acf158e5e0577288 (patch)
tree4bbf36e6bafafca8ee626d0a9fc7d49c0ea9dbfc /source/utils
parentb157a1b7c3e15a960fbc943d37abbb1bf5053a63 (diff)
downloadsamba-8836621694c95779475fa9a1acf158e5e0577288.tar.gz
samba-8836621694c95779475fa9a1acf158e5e0577288.tar.xz
samba-8836621694c95779475fa9a1acf158e5e0577288.zip
r2832: Readd WKGUID-binding to match the correct default-locations of new
User-, Group- and Machine-Accounts in Active Directory (this got lost during the last trunk-merge). This way we match e.g. default containers moved by redircmp.exe and redirusr.exe in Windows 2003 and don't blindly default to cn=Users or cn=Computers. Further wkguids can be examied via "net ads search wellknownobjects=*". This should still keep a samba3-client joining a samba4 dc. Fixes Bugzilla #1343. Guenther
Diffstat (limited to 'source/utils')
-rw-r--r--source/utils/net.c2
-rw-r--r--source/utils/net_ads.c12
2 files changed, 11 insertions, 3 deletions
diff --git a/source/utils/net.c b/source/utils/net.c
index da1339aed10..2bf8ac286dd 100644
--- a/source/utils/net.c
+++ b/source/utils/net.c
@@ -69,7 +69,7 @@ int opt_port = 0;
int opt_verbose = 0;
int opt_maxusers = -1;
const char *opt_comment = "";
-const char *opt_container = "cn=Users";
+const char *opt_container = NULL;
int opt_flags = -1;
int opt_timeout = 0;
const char *opt_target_workgroup = NULL;
diff --git a/source/utils/net_ads.c b/source/utils/net_ads.c
index 70e9e6cea80..8afc42c456b 100644
--- a/source/utils/net_ads.c
+++ b/source/utils/net_ads.c
@@ -297,6 +297,10 @@ static int ads_user_add(int argc, const char **argv)
goto done;
}
+ if (opt_container == NULL) {
+ opt_container = ads_default_ou_string(ads, WELL_KNOWN_GUID_USERS);
+ }
+
status = ads_add_user_acct(ads, argv[0], opt_container, opt_comment);
if (!ADS_ERR_OK(status)) {
@@ -498,6 +502,10 @@ static int ads_group_add(int argc, const char **argv)
goto done;
}
+ if (opt_container == NULL) {
+ opt_container = ads_default_ou_string(ads, WELL_KNOWN_GUID_USERS);
+ }
+
status = ads_add_group_acct(ads, argv[0], opt_container, opt_comment);
if (ADS_ERR_OK(status)) {
@@ -690,7 +698,7 @@ int net_ads_join(int argc, const char **argv)
char *password;
char *machine_account = NULL;
char *tmp_password;
- const char *org_unit = "Computers";
+ const char *org_unit = NULL;
char *dn;
void *res;
DOM_SID dom_sid;
@@ -728,7 +736,7 @@ int net_ads_join(int argc, const char **argv)
return -1;
}
- ou_str = ads_ou_string(org_unit);
+ ou_str = ads_ou_string(ads,org_unit);
asprintf(&dn, "%s,%s", ou_str, ads->config.bind_path);
free(ou_str);