dovecot-1.1: Added ldaprc_path setting.
dovecot at dovecot.org
dovecot at dovecot.org
Mon Mar 10 05:34:58 EET 2008
details: http://hg.dovecot.org/dovecot-1.1/rev/8a4ecf4c2ca1
changeset: 7397:8a4ecf4c2ca1
user: Timo Sirainen <tss at iki.fi>
date: Mon Mar 10 05:34:54 2008 +0200
description:
Added ldaprc_path setting.
diffstat:
3 files changed, 18 insertions(+)
doc/dovecot-ldap-example.conf | 3 +++
src/auth/db-ldap.c | 14 ++++++++++++++
src/auth/db-ldap.h | 1 +
diffs (76 lines):
diff -r a61102ad418f -r 8a4ecf4c2ca1 doc/dovecot-ldap-example.conf
--- a/doc/dovecot-ldap-example.conf Mon Mar 10 05:15:45 2008 +0200
+++ b/doc/dovecot-ldap-example.conf Mon Mar 10 05:34:54 2008 +0200
@@ -48,6 +48,9 @@
#tls_cipher_suite =
# Valid values: never, hard, demand, allow, try
#tls_require_cert =
+
+# Use the given ldaprc path.
+#ldaprc_path =
# LDAP library debug level as specified by LDAP_DEBUG_* in ldap_log.h.
# -1 = everything. You may need to recompile OpenLDAP with debugging enabled
diff -r a61102ad418f -r 8a4ecf4c2ca1 src/auth/db-ldap.c
--- a/src/auth/db-ldap.c Mon Mar 10 05:15:45 2008 +0200
+++ b/src/auth/db-ldap.c Mon Mar 10 05:34:54 2008 +0200
@@ -10,6 +10,7 @@
#include "hash.h"
#include "aqueue.h"
#include "str.h"
+#include "env-util.h"
#include "var-expand.h"
#include "settings.h"
#include "userdb.h"
@@ -98,6 +99,7 @@ static struct setting_def setting_defs[]
DEF_STR(base),
DEF_INT(ldap_version),
DEF_STR(debug_level),
+ DEF_STR(ldaprc_path),
DEF_STR(user_attrs),
DEF_STR(user_filter),
DEF_STR(pass_attrs),
@@ -130,6 +132,7 @@ struct ldap_settings default_ldap_settin
MEMBER(base) NULL,
MEMBER(ldap_version) 2,
MEMBER(debug_level) "0",
+ MEMBER(ldaprc_path) "",
MEMBER(user_attrs) "homeDirectory=home,uidNumber=uid,gidNumber=gid",
MEMBER(user_filter) "(&(objectClass=posixAccount)(uid=%u))",
MEMBER(pass_attrs) "uid=user,userPassword=password",
@@ -1152,6 +1155,7 @@ struct ldap_connection *db_ldap_init(con
struct ldap_connection *db_ldap_init(const char *config_path)
{
struct ldap_connection *conn;
+ const char *str;
pool_t pool;
/* see if it already exists */
@@ -1190,6 +1194,16 @@ struct ldap_connection *db_ldap_init(con
}
#endif
+ if (*conn->set.ldaprc_path != '\0') {
+ str = getenv("LDAPRC");
+ if (str != NULL && strcmp(str, conn->set.ldaprc_path) != 0) {
+ i_fatal("LDAP: Multiple different ldaprc_path "
+ "settings not allowed (%s and %s)",
+ str, conn->set.ldaprc_path);
+ }
+ env_put(t_strconcat("LDAPRC=", conn->set.ldaprc_path, NULL));
+ }
+
conn->set.ldap_deref = deref2str(conn->set.deref);
conn->set.ldap_scope = scope2str(conn->set.scope);
diff -r a61102ad418f -r 8a4ecf4c2ca1 src/auth/db-ldap.h
--- a/src/auth/db-ldap.h Mon Mar 10 05:15:45 2008 +0200
+++ b/src/auth/db-ldap.h Mon Mar 10 05:34:54 2008 +0200
@@ -54,6 +54,7 @@ struct ldap_settings {
const char *base;
unsigned int ldap_version;
+ const char *ldaprc_path;
const char *debug_level;
const char *user_attrs;
More information about the dovecot-cvs
mailing list