Implement a progressive iauth system.
[ircu2.10.12-pk.git] / ircd / m_user.c
index ad0ce75424248d3f1c411ad46f5a8fd8b32dd4af..babbd34d88641fcc237dec4889994c00feb8a3a1 100644 (file)
  *            note:   it is guaranteed that parv[0]..parv[parc-1] are all
  *                    non-NULL pointers.
  */
-#if 0
-/*
- * No need to include handlers.h here the signatures must match
- * and we don't need to force a rebuild of all the handlers everytime
- * we add a new one to the list. --Bleep
- */
+#include "config.h"
+
 #include "handlers.h"
-#endif /* 0 */
 #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>
 
-#define UFLAGS  (FLAGS_INVISIBLE|FLAGS_SERVNOTICE)
-
 /*
  * m_user
  *
  * parv[0] = sender prefix
  * parv[1] = username           (login name, account)
- * parv[2] = umode mask         (host name)
- * parv[3] = server notice mask (server name)
+ * parv[2] = host name          (ignored)
+ * parv[3] = server name        (ignored)
  * parv[4] = users real name info
  */
 int m_user(struct Client *cptr, struct Client *sptr, int parc, char *parv[])
 {
   char*        username;
-  const char*  umode;
-  const char*  snomask;
   const char*  info;
-  struct User* user;
 
   assert(0 != cptr);
   assert(cptr == sptr);
@@ -145,32 +137,8 @@ int m_user(struct Client *cptr, struct Client *sptr, int parc, char *parv[])
   else
     username = "NoUser";
 
-  umode    = (EmptyString(parv[2])) ? "."       : parv[2];
-  snomask  = (EmptyString(parv[3])) ? "."       : parv[3];
   info     = (EmptyString(parv[4])) ? "No Info" : parv[4];
 
-  user = make_user(cptr);
-
-  if (!strchr(umode, '.'))        /* Not an IP# as hostname ? */
-    cptr->flags |= (UFLAGS & atoi(umode));
-
-  if ((cptr->flags & FLAGS_SERVNOTICE))
-    set_snomask(cptr, (IsDigit(*snomask) && !strchr(snomask, '.')) ?
-                (atoi(snomask) & SNO_USER) : SNO_DEFAULT, SNO_SET);
-
-  user->server = &me;
-  ircd_strncpy(cptr->info, info, REALLEN);
-
-  if (cptr->name[0] && cptr->cookie == COOKIE_VERIFIED) {
-    /*
-     * NICK and PONG already received, now we have USER...
-     */
-    return register_user(cptr, sptr, sptr->name, username, 0);
-  }
-  else {
-    ircd_strncpy(user->username, username, USERLEN);
-    ircd_strncpy(user->host, cptr->sockhost, HOSTLEN);
-  }
-  return 0;
+  return auth_set_user(cli_auth(cptr), username, info);
 }