]> code.citadel.org Git - citadel.git/commitdiff
* Corrected various small syntax conversion problems that were keeping
authorArt Cancro <ajc@citadel.org>
Sun, 8 Feb 2004 05:29:34 +0000 (05:29 +0000)
committerArt Cancro <ajc@citadel.org>
Sun, 8 Feb 2004 05:29:34 +0000 (05:29 +0000)
  some vCards out of the LDAP directory.

citadel/ChangeLog
citadel/serv_ldap.c

index 540d7b20ea2f64fd8b7cc8b9799846060dd50932..20130fbb69c4aa936d05fd62099e4f43db74ade1 100644 (file)
@@ -1,4 +1,8 @@
  $Log$
+ Revision 614.23  2004/02/08 05:29:34  ajc
+ * Corrected various small syntax conversion problems that were keeping
+   some vCards out of the LDAP directory.
+
  Revision 614.22  2004/02/07 05:28:10  ajc
  * Automatically purge files from ./network/spoolout which were intended
    for nodes which no longer exist
@@ -5297,4 +5301,3 @@ Sat Jul 11 00:20:48 EDT 1998 Nathan Bryant <bryant@cs.usm.maine.edu>
 
 Fri Jul 10 1998 Art Cancro <ajc@uncensored.citadel.org>
        * Initial CVS import
-
index d72d295e9728e70f14acc63dcf9b7cdc7368ada3..dca6b9c2f8ebd93bed1aa3e1a623d8b3a8d96609 100644 (file)
@@ -235,8 +235,8 @@ void ctdl_vcard_to_ldap(struct CtdlMessage *msg, int op) {
        if (msg->cm_fields['N'] == NULL) return;
 
        /* Initialize variables */
-       strcpy(givenname, "_");
-       strcpy(sn, "_");
+       strcpy(givenname, "");
+       strcpy(sn, "");
 
        sprintf(this_dn, "cn=%s,ou=%s,%s",
                msg->cm_fields['A'],
@@ -285,7 +285,7 @@ void ctdl_vcard_to_ldap(struct CtdlMessage *msg, int op) {
 
        /* Convert the vCard fields to LDAP properties */
        v = vcard_load(msg->cm_fields['M']);
-       if (v->numprops) for (i=0; i<(v->numprops); ++i) {
+       if (v->numprops) for (i=0; i<(v->numprops); ++i) if (striplt(v->prop[i].value), strlen(v->prop[i].value) > 0) {
 
                if (!strcasecmp(v->prop[i].name, "n")) {
                        extract_token(sn,               v->prop[i].value, 0, ';');
@@ -466,6 +466,8 @@ void ctdl_vcard_to_ldap(struct CtdlMessage *msg, int op) {
        attrs[num_attrs-1]->mod_values[1]       = NULL;
 
        /* "givenname" (first name) based on info in vCard */
+       if (strlen(givenname) == 0) strcpy(givenname, "_");
+       if (strlen(sn) == 0) strcpy(sn, "_");
        attrs = reallok(attrs, (sizeof(LDAPMod *) * ++num_attrs) );
        attrs[num_attrs-1] = mallok(sizeof(LDAPMod));
        memset(attrs[num_attrs-1], 0, sizeof(LDAPMod));