- switch (conf_check_client(sptr))
- {
- case ACR_OK:
- break;
- case ACR_NO_AUTHORIZATION:
- sendto_opmask_butone(0, SNO_UNAUTH, "Unauthorized connection from %s.",
- get_client_name(sptr, HIDE_IP));
- ++ServerStats->is_ref;
- return exit_client(cptr, sptr, &me,
- "No Authorization - use another server");
- case ACR_TOO_MANY_IN_CLASS:
- if (CurrentTime - last_too_many1 >= (time_t) 60)
- {
- last_too_many1 = CurrentTime;
- sendto_opmask_butone(0, SNO_TOOMANY, "Too many connections in "
- "class for %s.",
- get_client_name(sptr, HIDE_IP));
- }
- ++ServerStats->is_ref;
- ip_registry_connect_fail(sptr->ip.s_addr);
- return exit_client(cptr, sptr, &me,
- "Sorry, your connection class is full - try "
- "again later or try another server");
- case ACR_TOO_MANY_FROM_IP:
- if (CurrentTime - last_too_many2 >= (time_t) 60)
- {
- last_too_many2 = CurrentTime;
- sendto_opmask_butone(0, SNO_TOOMANY, "Too many connections from "
- "same IP for %s.",
- get_client_name(sptr, HIDE_IP));
- }
- ++ServerStats->is_ref;
- return exit_client(cptr, sptr, &me,
- "Too many connections from your host");
- case ACR_ALREADY_AUTHORIZED:
- /* Can this ever happen? */
- case ACR_BAD_SOCKET:
- ++ServerStats->is_ref;
- ip_registry_connect_fail(sptr->ip.s_addr);
- return exit_client(cptr, sptr, &me, "Unknown error -- Try again");
- }
- ircd_strncpy(user->host, sptr->sockhost, HOSTLEN);
- aconf = sptr->confs->value.aconf;
-
- clean_user_id(user->username,
- (sptr->flags & FLAGS_GOTID) ? sptr->username : username,
- (sptr->flags & FLAGS_DOID) && !(sptr->flags & FLAGS_GOTID));
-
- if ((user->username[0] == '\0')
- || ((user->username[0] == '~') && (user->username[1] == '\000')))
- return exit_client(cptr, sptr, &me, "USER: Bogus userid.");
-
- if (!EmptyString(aconf->passwd)
- && !(IsDigit(*aconf->passwd) && !aconf->passwd[1])
-#ifdef USEONE
- && strcmp("ONE", aconf->passwd)
-#endif
- && strcmp(sptr->passwd, aconf->passwd))
- {
- ServerStats->is_ref++;
- ip_registry_connect_fail(sptr->ip.s_addr);
- send_reply(sptr, ERR_PASSWDMISMATCH);
- return exit_client(cptr, sptr, &me, "Bad Password");
- }
- memset(sptr->passwd, 0, sizeof(sptr->passwd));