summaryrefslogtreecommitdiff
path: root/source3/passdb
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2002-09-27 01:02:37 +0000
committerAndrew Bartlett <abartlet@samba.org>2002-09-27 01:02:37 +0000
commit9e7a6d6b8b4f5bf38d6faa2fca211657fc8b2959 (patch)
treecbe22cb9b2494f674c925534c5a619eef6d6501e /source3/passdb
parentc60f6f066ea47f7d85fc8028f9d657cfe5841893 (diff)
downloadsamba-9e7a6d6b8b4f5bf38d6faa2fca211657fc8b2959.tar.gz
samba-9e7a6d6b8b4f5bf38d6faa2fca211657fc8b2959.tar.bz2
samba-9e7a6d6b8b4f5bf38d6faa2fca211657fc8b2959.zip
Readd the 2.2 --with-ldapsam paramaters so as to allow a smooth upgrade path to
a 3.0 based PDC. Change defaults to use SSL, so that this also matches. Andrew Bartlett (This used to be commit 36c2a3820faa1d90cd331881720be0e61ab93460)
Diffstat (limited to 'source3/passdb')
-rw-r--r--source3/passdb/pdb_ldap.c23
1 files changed, 19 insertions, 4 deletions
diff --git a/source3/passdb/pdb_ldap.c b/source3/passdb/pdb_ldap.c
index c7badb50e7..a10e6f2989 100644
--- a/source3/passdb/pdb_ldap.c
+++ b/source3/passdb/pdb_ldap.c
@@ -954,9 +954,9 @@ static BOOL init_ldap_from_sam (struct ldapsam_privates *ldap_state,
make_a_mod(mods, ldap_op, "primaryGroupID", temp);
/* displayName, cn, and gecos should all be the same
- * most easily accomplished by giving them the same OID
- * gecos isn't set here b/c it should be handled by the
- * add-user script
+ * most easily accomplished by giving them the same OID
+ * gecos isn't set here b/c it should be handled by the
+ * add-user script
*/
make_a_mod(mods, ldap_op, "displayName", pdb_get_fullname(sampass));
@@ -1730,8 +1730,23 @@ NTSTATUS pdb_init_ldapsam(PDB_CONTEXT *pdb_context, PDB_METHODS **pdb_method, co
if (location) {
ldap_state->uri = talloc_strdup(pdb_context->mem_ctx, location);
+#ifdef WITH_LDAP_SAMCONFIG
} else {
- ldap_state->uri = "ldap://localhost";
+ int ldap_port = lp_ldap_port();
+
+ /* remap default port is no SSL */
+ if ( (lp_ldap_ssl() == LDAP_SSL_OFF) && (ldap_port == 636) ) {
+ ldap_port = 389;
+ }
+
+ ldap_state->uri = talloc_asprintf(pdb_context->mem_ctx, "%s://%s:%d", lp_ldap_ssl() ? "ldap" : "ldaps", lp_ldap_server(), ldap_port);
+ if (!ldap_state->uri) {
+ return NT_STATUS_NO_MEMORY;
+ }
+#else
+ } else {
+ ldap_state->uri = "ldaps://localhost";
+#endif
}
(*pdb_method)->private_data = ldap_state;