/*
- *
+ * $Id$
+ *
+ * These functions implement the portions of AUTHMODE_LDAP and AUTHMODE_LDAP_AD which
+ * actually speak to the LDAP server.
+ *
+ * Copyright (c) 2009 by Art Cancro and the citadel.org development team.
+ * This program is released under the terms of the GNU General Public License v3
*/
-int ldap_version = 3;
+int ctdl_require_ldap_version = 3;
#include "sysdep.h"
return(errno);
}
- ldap_set_option(ldserver, LDAP_OPT_PROTOCOL_VERSION, &ldap_version);
+ ldap_set_option(ldserver, LDAP_OPT_PROTOCOL_VERSION, &ctdl_require_ldap_version);
striplt(config.c_ldap_bind_dn);
striplt(config.c_ldap_bind_pw);
ldserver = ldap_init(config.c_ldap_host, config.c_ldap_port);
if (ldserver) {
- ldap_set_option(ldserver, LDAP_OPT_PROTOCOL_VERSION, &ldap_version);
+ ldap_set_option(ldserver, LDAP_OPT_PROTOCOL_VERSION, &ctdl_require_ldap_version);
i = ldap_simple_bind_s(ldserver, user_dn, password);
if (i == LDAP_SUCCESS) {
CtdlLogPrintf(CTDL_DEBUG, "LDAP: bind succeeded\n");
}
+/*
+ * Learn LDAP attributes and stuff them into the vCard.
+ * Returns nonzero if we changed anything.
+ */
+int Ctdl_LDAP_to_vCard(char *ldap_dn, struct vCard *v)
+{
+ if (!ldap_dn) return(0);
+ if (!v) return(0);
+
+ /*
+ * FIXME LDAPSTUB this is a stub function
+ *
+ * ldap_dn will contain the DN of the user, and v will contain a pointer to
+ * the vCard that needs to be (re-)populated. Put the requisite LDAP code here.
+ *
+ vcard_set_prop(v, "email;internet", xxx, 0);
+ return(1); * return nonzero to tell the caller that we made changes that need to be saved *
+ *
+ */
+ return(0); /* return zero to tell the caller that we didn't make any changes */
+}
#endif /* HAVE_LDAP */