]> jfr.im git - irc/evilnet/x3.git/commitdiff
fix a couple oversights in building ldap add structs
authorrubin <redacted>
Sun, 13 Dec 2009 03:31:45 +0000 (03:31 +0000)
committerrubin <redacted>
Sun, 13 Dec 2009 03:31:45 +0000 (03:31 +0000)
src/x3ldap.c

index 0bd9e8fd00829c16f0d86b0755c48601f9510eda..73ec24c47fbb42722612e3485df5300236a88bb6 100644 (file)
@@ -314,13 +314,14 @@ char **make_object_vals()
     if(object_vals)
        free(object_vals);
 
-    object_vals = malloc(sizeof( *object_vals ) * nickserv_conf.ldap_object_classes->used);
+    object_vals = malloc(sizeof( *object_vals ) * nickserv_conf.ldap_object_classes->used+1);
 
     for(y = 0; y < nickserv_conf.ldap_object_classes->used; y++) {
         object_vals[y] = nickserv_conf.ldap_object_classes->list[y];
     }
     object_vals[y] = NULL;
     return object_vals;
+    /* NOTE: The return value of this is only good until the next call to it. */
 }
 
 char *make_password(const char *crypted)
@@ -352,6 +353,13 @@ LDAPMod **make_mods_add(const char *account, const char *password, const char *e
     /* TODO: take this from nickserv_conf.ldap_add_objects */
     LDAPMod **mods;
     static char **object_vals;
+
+    account_vals[0] = NULL;
+    account_vals[1] = NULL;
+    password_vals[0] = NULL;
+    password_vals[1] = NULL;
+    email_vals[0] = NULL;
+    email_vals[1] = NULL;
     object_vals = make_object_vals();
 
     account_vals[0] = (char *) account;