projects
/
citadel.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
ff22461
)
All calls to ldap_init(host,port) are now replaced with a wrapper function ctdl_ldap_...
author
Art Cancro
<ajc@uncensored.citadel.org>
Thu, 6 Nov 2014 17:52:12 +0000
(12:52 -0500)
committer
Art Cancro
<ajc@uncensored.citadel.org>
Thu, 6 Nov 2014 17:52:12 +0000
(12:52 -0500)
citadel/ldap.c
patch
|
blob
|
history
diff --git
a/citadel/ldap.c
b/citadel/ldap.c
index ea4ad0a3d47f9def9e43c405d69cf875fc040fa9..80f88bffacdae0933bdedffcd224b6bede6b1fa5 100644
(file)
--- a/
citadel/ldap.c
+++ b/
citadel/ldap.c
@@
-27,6
+27,21
@@
int ctdl_require_ldap_version = 3;
#define LDAP_DEPRECATED 1 /* Suppress libldap's warning that we are using deprecated API calls */
#include <ldap.h>
#define LDAP_DEPRECATED 1 /* Suppress libldap's warning that we are using deprecated API calls */
#include <ldap.h>
+
+
+/*
+ * This function is a replacement for all calls to ldap_init() in this file.
+ * It fills in the required fields with those from the server's global config.
+ */
+LDAP *ctdl_ldap_init(void) {
+ return ldap_init(config.c_ldap_host, config.c_ldap_port);
+}
+
+
+
+/*
+ * Look up a username in the LDAP directory to see if it's valid for logging in.
+ */
int CtdlTryUserLDAP(char *username,
char *found_dn, int found_dn_size,
char *fullname, int fullname_size,
int CtdlTryUserLDAP(char *username,
char *found_dn, int found_dn_size,
char *fullname, int fullname_size,
@@
-43,7
+58,7
@@
int CtdlTryUserLDAP(char *username,
if (fullname) safestrncpy(fullname, username, fullname_size);
if (fullname) safestrncpy(fullname, username, fullname_size);
- ldserver =
ldap_init(config.c_ldap_host, config.c_ldap_port
);
+ ldserver =
ctdl_ldap_init(
);
if (ldserver == NULL) {
syslog(LOG_ALERT, "LDAP: Could not connect to %s:%d : %s",
config.c_ldap_host, config.c_ldap_port,
if (ldserver == NULL) {
syslog(LOG_ALERT, "LDAP: Could not connect to %s:%d : %s",
config.c_ldap_host, config.c_ldap_port,
@@
-188,7
+203,7
@@
int CtdlTryPasswordLDAP(char *user_dn, const char *password)
}
syslog(LOG_DEBUG, "LDAP: trying to bind as %s", user_dn);
}
syslog(LOG_DEBUG, "LDAP: trying to bind as %s", user_dn);
- ldserver =
ldap_init(config.c_ldap_host, config.c_ldap_port
);
+ ldserver =
ctdl_ldap_init(
);
if (ldserver) {
ldap_set_option(ldserver, LDAP_OPT_PROTOCOL_VERSION, &ctdl_require_ldap_version);
i = ldap_simple_bind_s(ldserver, user_dn, password);
if (ldserver) {
ldap_set_option(ldserver, LDAP_OPT_PROTOCOL_VERSION, &ctdl_require_ldap_version);
i = ldap_simple_bind_s(ldserver, user_dn, password);
@@
-280,7
+295,7
@@
int Ctdl_LDAP_to_vCard(char *ldap_dn, struct vCard *v)
if (!ldap_dn) return(0);
if (!v) return(0);
if (!ldap_dn) return(0);
if (!v) return(0);
- ldserver =
ldap_init(config.c_ldap_host, config.c_ldap_port
);
+ ldserver =
ctdl_ldap_init(
);
if (ldserver == NULL) {
syslog(LOG_ALERT, "LDAP: Could not connect to %s:%d : %s",
config.c_ldap_host, config.c_ldap_port,
if (ldserver == NULL) {
syslog(LOG_ALERT, "LDAP: Could not connect to %s:%d : %s",
config.c_ldap_host, config.c_ldap_port,