int CtdlTryUserLDAP(char *username, char *found_dn, int found_dn_size, char *fullname, int fullname_size, uid_t *found_uid);
int CtdlTryPasswordLDAP(char *user_dn, char *password);
+int Ctdl_LDAP_to_vCard(char *ldap_dn, struct vCard *v);
}
+/*
+ * 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 */
* A server-side module for Citadel which supports address book information
* using the standard vCard format.
*
- * Copyright (c) 1999-2007 / released under the GNU General Public License
+ * Copyright (c) 1999-2009 / released under the GNU General Public License v3
*/
/*
#include "msgbase.h"
#include "internet_addressing.h"
#include "serv_vcard.h"
-
+#include "citadel_ldap.h"
#include "ctdl_module.h"
-
-
/*
* set global flag calling for an aide to validate new users
*/
* Extract Internet e-mail addresses from a message containing a vCard, and
* perform a callback for any found.
*/
-void vcard_extract_internet_addresses(struct CtdlMessage *msg,
- void (*callback)(char *, char *) ) {
+void vcard_extract_internet_addresses(struct CtdlMessage *msg, void (*callback)(char *, char *) ) {
struct vCard *v;
char *s;
char *k;
* into the user's vCard.
*/
if ((config.c_auth_mode == AUTHMODE_LDAP) || (config.c_auth_mode == AUTHMODE_LDAP_AD)) {
-
- /* FIXME do something with this.
- * The DN of the account will be found in: CCC->ldap_dn
- */
-
+ v = vcard_get_user(&CCC->user);
+ if (v) {
+ if (Ctdl_LDAP_to_vCard(CCC->ldap_dn, v)) {
+ vcard_write_user(&CCC->user, v);
+ }
+ }
}
#endif