Move some permission checks from set_user_mode() to its callers.
[ircu2.10.12-pk.git] / ircd / m_user.c
index 55ac6a8a1a136feb5051d5c816be9a9a51eafffd..17fa10042d7fa83e0d5391273e218cc1388c7930 100644 (file)
 #include "client.h"
 #include "ircd.h"
 #include "ircd_chattr.h"
+#include "ircd_log.h"
 #include "ircd_reply.h"
 #include "ircd_string.h"
 #include "numeric.h"
 #include "numnicks.h"
+#include "s_auth.h"
 #include "s_debug.h"
 #include "s_misc.h"
 #include "s_user.h"
 #include "send.h"
 
-#include <assert.h>
+/* #include <assert.h> -- Now using assert in ircd_log.h */
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -112,7 +114,6 @@ int m_user(struct Client *cptr, struct Client *sptr, int parc, char *parv[])
 {
   char*        username;
   const char*  info;
-  struct User* user;
 
   assert(0 != cptr);
   assert(cptr == sptr);
@@ -138,21 +139,6 @@ int m_user(struct Client *cptr, struct Client *sptr, int parc, char *parv[])
 
   info     = (EmptyString(parv[4])) ? "No Info" : parv[4];
 
-  user = make_user(cptr);
-
-  user->server = &me;
-  ircd_strncpy(cli_info(cptr), info, REALLEN);
-
-  if ((cli_name(cptr))[0] && cli_cookie(cptr) == COOKIE_VERIFIED) {
-    /*
-     * NICK and PONG already received, now we have USER...
-     */
-    return register_user(cptr, sptr, cli_name(sptr), username, 0);
-  }
-  else {
-    ircd_strncpy(user->username, username, USERLEN);
-    ircd_strncpy(user->host, cli_sockhost(cptr), HOSTLEN);
-  }
-  return 0;
+  return auth_set_user(cli_auth(cptr), username, parv[2], parv[3], info);
 }