]> jfr.im git - irc/evilnet/x3.git/blobdiff - src/nickserv.c
Upgrading to GPL v3
[irc/evilnet/x3.git] / src / nickserv.c
index 092d237a9dfe9bbf800a1e6c0ebdc3293febd1f0..1b9ad5a0cb2d83e4cdfe3b8b4416e8027be23c2b 100644 (file)
@@ -5,7 +5,7 @@
  *
  * x3 is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
+ * the Free Software Foundation; either version 3 of the License, or
  * (at your option) any later version.
  *
  * This program is distributed in the hope that it will be useful,
@@ -2089,6 +2089,7 @@ static NICKSERV_FUNC(cmd_auth)
 #endif
         hi = dict_find(nickserv_handle_dict, argv[1], NULL);
         pw_arg = 2;
+#ifdef notdef
     } else if (argc == 2) {
         if (nickserv_conf.disable_nicks) {
             if (!(hi = get_handle_info(user->nick))) {
@@ -2107,6 +2108,7 @@ static NICKSERV_FUNC(cmd_auth)
             hi = ni->owner;
         }
         pw_arg = 1;
+#endif
     } else {
         reply("MSG_MISSING_PARAMS", argv[0]);
         svccmd_send_help_brief(user, nickserv, cmd);
@@ -2164,7 +2166,7 @@ static NICKSERV_FUNC(cmd_auth)
     }
 #ifdef WITH_LDAP
     if( ( nickserv_conf.ldap_enable && ldap_result == LDAP_INVALID_CREDENTIALS )  ||
-        ( !nickserv_conf.ldap_enable && !checkpass(passwd, hi->passwd) ) ) {
+        ( (!nickserv_conf.ldap_enable) && (!checkpass(passwd, hi->passwd)) ) ) {
 #else
     if (!checkpass(passwd, hi->passwd)) {
 #endif
@@ -3219,7 +3221,7 @@ oper_try_set_access(struct userNode *user, struct userNode *bot, struct handle_i
           rc = ldap_add2group(target->handle, nickserv_conf.ldap_oper_group_dn);
         else
           rc = ldap_delfromgroup(target->handle, nickserv_conf.ldap_oper_group_dn);
-        if(rc != LDAP_SUCCESS) {
+        if(rc != LDAP_SUCCESS && rc != LDAP_TYPE_OR_VALUE_EXISTS && rc != LDAP_NO_SUCH_ATTRIBUTE) {
            send_message(user, bot, "NSMSG_LDAP_FAIL", ldap_err2string(rc));
            return 0;
         }
@@ -4032,6 +4034,7 @@ nickserv_discrim_create(struct svccmd *cmd, struct userNode *user, unsigned int
             } else {
                 reply("MSG_INVALID_CRITERIA", cmp);
             }
+#ifdef WITH_LDAP
         } else if (nickserv_conf.ldap_enable && !irccasecmp(argv[i], "inldap")) {
           i++;
           if(true_string(argv[i])) {
@@ -4043,6 +4046,7 @@ nickserv_discrim_create(struct svccmd *cmd, struct userNode *user, unsigned int
           else {
             reply("MSG_INVALID_BINARY", argv[i]);
           }
+#endif
         } else { 
             reply("MSG_INVALID_CRITERIA", argv[i]);
             goto fail;
@@ -4145,9 +4149,12 @@ static void
 search_add2ldap_func (struct userNode *source, struct handle_info *match)
 {
 #ifdef WITH_LDAP
-    int rc = ldap_do_add(match->handle, match->passwd, match->email_addr);
-    if(rc != LDAP_SUCCESS) {
-       send_message(source, nickserv, "NSMSG_LDAP_FAIL_ADD", match->handle, ldap_err2string(rc));
+    int rc;
+    if(match->email_addr && match->passwd && match->handle) {
+           rc  = ldap_do_add(match->handle, match->passwd, match->email_addr);
+           if(rc != LDAP_SUCCESS) {
+              send_message(source, nickserv, "NSMSG_LDAP_FAIL_ADD", match->handle, ldap_err2string(rc));
+           }
     }
 #endif
 }