]> code.citadel.org Git - citadel.git/blobdiff - citadel/serv_ldap.c
* Reworked vCard etc. functions for addition of new vCard data to LDAP
[citadel.git] / citadel / serv_ldap.c
index d97e64cea0e6810fc5d78884e01cde507556213c..c9892fe944096717557d76f90c6a606a2aadddfe 100644 (file)
@@ -40,6 +40,8 @@
 #include "policy.h"
 #include "database.h"
 #include "msgbase.h"
+#include "serv_ldap.h"
+#include "vcard.h"
 
 #ifdef HAVE_LDAP
 
@@ -93,6 +95,38 @@ void CtdlConnectToLdap(void) {
 }
 
 
+
+
+/*
+ * Write (add, or change if already exists) a directory entry to the
+ * LDAP server, based on the information supplied in a vCard.
+ */
+void ctdl_vcard_to_ldap(struct CtdlMessage *msg) {
+       struct vCard *v = NULL;
+
+       char this_dn[SIZ];
+
+       if (msg == NULL) return;
+       if (msg->cm_fields['M'] == NULL) return;
+       if (msg->cm_fields['A'] == NULL) return;
+       if (msg->cm_fields['N'] == NULL) return;
+
+       sprintf(this_dn, "cn=%s,ou=%s,%s",
+               msg->cm_fields['A'],
+               msg->cm_fields['N'],
+               config.c_ldap_base_dn
+       );
+
+       lprintf(9, "this_dn: <%s>\n", this_dn);
+
+       v = vcard_load(msg->cm_fields['M']);
+
+       vcard_free(v);
+}
+
+
+
+
 /*
  * Initialize the LDAP connector module ... or don't, if we don't have LDAP.
  */