]> jfr.im git - irc/evilnet/x3.git/commitdiff
ldap cookie auth fixes
authorrubin <redacted>
Tue, 13 Feb 2007 18:36:07 +0000 (18:36 +0000)
committerrubin <redacted>
Tue, 13 Feb 2007 18:36:07 +0000 (18:36 +0000)
ChangeLog
src/nickserv.c

index 23a8237218cc89bc73d4932a48954bf46cab181a..16e61e1d93f042517c4d65e82edda8498550971f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,7 +1,12 @@
 /***********************************************************************
 X3 ChangeLog
 
-2007-02-12  Alex Schumann  <rubin@afternet.org>
+2007-02-13  Alex Schumann  <rubin@afternet.org>
+
+       * src/nickserv.c: Fix bugs with ldap cookies. Fix opt_password
+       warning/crash potential
+
+2007-02-13  Alex Schumann  <rubin@afternet.org>
 
        * src/x3ldap.c: Fix double-hashing of passwords when using ldap and
        resetpass cookie system. 
index 7ce15425df7559437178307d8d83e7638e6e1d8e..5d92294a848ec1dcf2b619060dafea4316056bcd 100644 (file)
@@ -2462,6 +2462,17 @@ static NICKSERV_FUNC(cmd_cookie)
 
     switch (hi->cookie->type) {
     case ACTIVATION:
+#ifdef WITH_LDAP
+        if(nickserv_conf.ldap_enable && nickserv_conf.ldap_admin_dn) {
+            int rc;
+            if((rc = ldap_do_modify(hi->handle, hi->cookie->data, NULL)) != LDAP_SUCCESS) {
+                /* Falied to update email in ldap, but still 
+                 * updated it here.. what should we do? */
+               reply("NSMSG_LDAP_FAIL", ldap_err2string(rc));
+               return 0;
+            }
+        }
+#endif
         safestrncpy(hi->passwd, hi->cookie->data, sizeof(hi->passwd));
         set_user_handle_info(user, hi, 1);
         reply("NSMSG_HANDLE_ACTIVATED");
@@ -2469,6 +2480,17 @@ static NICKSERV_FUNC(cmd_cookie)
           SyncLog("ACCOUNTACC %s", hi->handle);
         break;
     case PASSWORD_CHANGE:
+#ifdef WITH_LDAP
+        if(nickserv_conf.ldap_enable && nickserv_conf.ldap_admin_dn) {
+            int rc;
+            if((rc = ldap_do_modify(hi->handle, hi->cookie->data, NULL)) != LDAP_SUCCESS) {
+                /* Falied to update email in ldap, but still 
+                 * updated it here.. what should we do? */
+               reply("NSMSG_LDAP_FAIL", ldap_err2string(rc));
+               return 0;
+            }
+        }
+#endif
         set_user_handle_info(user, hi, 1);
         safestrncpy(hi->passwd, hi->cookie->data, sizeof(hi->passwd));
         reply("NSMSG_PASSWORD_CHANGED");
@@ -2991,6 +3013,9 @@ static OPTION_FUNC(opt_announcements)
 static OPTION_FUNC(opt_password)
 {
     char crypted[MD5_CRYPT_LENGTH+1];
+    if(argc < 1) {
+       return 0;
+    }
     if (!override) {
        reply("NSMSG_USE_CMD_PASS");
        return 0;