$Log$
+ Revision 614.6 2004/01/18 21:04:40 ajc
+ * Reworked vCard etc. functions for addition of new vCard data to LDAP
+
Revision 614.5 2004/01/17 22:57:54 ajc
* Added "Base DN" "Bind DN" and "Bind DN password" config options
* serv_ldap.c: added. (New module implementing the LDAP Connector)
Fri Jul 10 1998 Art Cancro <ajc@uncensored.citadel.org>
* Initial CVS import
+
#include "policy.h"
#include "database.h"
#include "msgbase.h"
+#include "serv_ldap.h"
+#include "vcard.h"
#ifdef HAVE_LDAP
}
+
+
+/*
+ * 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.
*/
--- /dev/null
+/*
+ * $Id$
+ *
+ */
+
+#ifdef HAVE_LDAP
+
+void ctdl_vcard_to_ldap(struct CtdlMessage *msg);
+
+
+#endif /* HAVE_LDAP */
long msgcur = 0L;
int ch;
- lprintf(7, "network: processing <%s>\n", filename);
fp = fopen(filename, "rb");
if (fp == NULL) {
return;
}
+ lprintf(5, "network: processing <%s>\n", filename);
+
/* Look for messages in the data stream and break them out */
while (ch = getc(fp), ch >= 0) {
if (dp == NULL) return;
while (d = readdir(dp), d != NULL) {
- snprintf(filename, sizeof filename, "./network/spoolin/%s", d->d_name);
+ snprintf(filename, sizeof filename,
+ "./network/spoolin/%s", d->d_name);
network_process_file(filename);
}
#include "internet_addressing.h"
#include "tools.h"
#include "vcard.h"
+#include "serv_ldap.h"
struct vcard_internal_info {
long msgnum;
vcard_extract_internet_addresses(msg, vcard_directory_add_user);
}
+#ifdef HAVE_LDAP
+ ctdl_vcard_to_ldap(msg);
+#endif
+
CtdlFreeMessage(msg);
}
*/
CtdlDirectoryInit();
- /* We want the last (and probably only) vcard in this room */
+ /* We want *all* vCards in this room */
CtdlForEachMessage(MSGS_ALL, 0, "text/x-vcard",
NULL, vcard_add_to_directory, NULL);
S_DIRECTORY,
S_NETCONFIGS,
S_PUBLIC_CLIENTS,
+ S_LDAP,
MAX_SEMAPHORES
};