* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
- *
- * $Id: m_signon.c 1192 2006-04-21 16:21:02Z jilles $
*/
#include "stdinc.h"
#include "send.h"
#include "channel.h"
#include "client.h"
-#include "common.h"
-#include "config.h"
+#include "defaults.h"
#include "ircd.h"
#include "numeric.h"
#include "s_conf.h"
#include "match.h"
#include "s_user.h"
-static int me_svslogin(struct Client *, struct Client *, int, const char **);
-static int ms_signon(struct Client *, struct Client *, int, const char **);
+static const char signon_desc[] = "Provides account login/logout support for services";
+
+static void me_svslogin(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
+static void ms_signon(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
static void send_signon(struct Client *, struct Client *, const char *, const char *, const char *, unsigned int, const char *);
struct Message svslogin_msgtab = {
- "SVSLOGIN", 0, 0, 0, MFLG_SLOW,
+ "SVSLOGIN", 0, 0, 0, 0,
{mg_ignore, mg_ignore, mg_ignore, mg_ignore, {me_svslogin, 6}, mg_ignore}
};
struct Message signon_msgtab = {
- "SIGNON", 0, 0, 0, MFLG_SLOW,
+ "SIGNON", 0, 0, 0, 0,
{mg_ignore, mg_ignore, {ms_signon, 6}, mg_ignore, mg_ignore, mg_ignore}
};
&svslogin_msgtab, &signon_msgtab, NULL
};
-DECLARE_MODULE_AV1(signon, NULL, NULL, signon_clist, NULL, NULL, "$Revision: 1192 $");
+DECLARE_MODULE_AV2(signon, NULL, NULL, signon_clist, NULL, NULL, NULL, NULL, signon_desc);
#define NICK_VALID 1
#define USER_VALID 2
#define HOST_VALID 4
-static int
+static bool
clean_username(const char *username)
{
int len = 0;
len++;
if(!IsUserChar(*username))
- return 0;
+ return false;
}
if(len > USERLEN)
- return 0;
+ return false;
- return 1;
+ return true;
}
-static int
+static bool
clean_host(const char *host)
{
int len = 0;
len++;
if(!IsHostChar(*host))
- return 0;
+ return false;
}
if(len > HOSTLEN)
- return 0;
+ return false;
- return 1;
+ return true;
}
-static int
-me_svslogin(struct Client *client_p, struct Client *source_p,
+static void
+me_svslogin(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p,
int parc, const char *parv[])
{
struct Client *target_p, *exist_p;
{
sendto_realops_snomask(SNO_GENERAL, L_ALL,
"Non-service server %s attempting to execute services-only command SVSLOGIN", source_p->name);
- return 0;
+ return;
}
if((target_p = find_client(parv[1])) == NULL)
- return 0;
+ return;
if(!MyClient(target_p) && !IsUnknown(target_p))
- return 0;
+ return;
if(clean_nick(parv[2], 0))
{
/* Login (mostly) follows nick rules. */
if(*login && !clean_nick(login, 0))
- return 0;
+ return;
if((exist_p = find_person(nick)) && target_p != exist_p)
{
"Nick collision due to SVSLOGIN on %s",
nick);
- rb_snprintf(buf, sizeof(buf), "Killed (%s (Nickname regained by services))",
+ snprintf(buf, sizeof(buf), "Killed (%s (Nickname regained by services))",
me.name);
exit_client(NULL, exist_p, &me, buf);
- }else if((exist_p = find_client(nick)) && IsUnknown(exist_p) && exist_p != target_p) {
+ }
+ else if((exist_p = find_client(nick)) && IsUnknown(exist_p) && exist_p != target_p)
+ {
exit_client(NULL, exist_p, &me, "Overridden");
}
send_signon(NULL, target_p, nick, user, host, rb_current_time(), login);
- rb_snprintf(note, NICKLEN + 10, "Nick: %s", target_p->name);
+ snprintf(note, NICKLEN + 10, "Nick: %s", target_p->name);
rb_note(target_p->localClient->F, note);
}
-
- return 0;
}
-static int
-ms_signon(struct Client *client_p, struct Client *source_p,
+static void
+ms_signon(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p,
int parc, const char *parv[])
{
struct Client *target_p;
me.name);
source_p->flags |= FLAGS_KILLED;
exit_client(NULL, source_p, &me, "Bad nickname from SIGNON");
- return 0;
+ return;
}
if(!clean_username(parv[2]) || !clean_host(parv[3]))
me.name);
source_p->flags |= FLAGS_KILLED;
exit_client(NULL, source_p, &me, "Bad user@host from SIGNON");
- return 0;
+ return;
}
newts = atol(parv[4]);
if (clean_nick(parv[5], 0))
rb_strlcpy(login, parv[5], NICKLEN + 1);
else
- return 0;
+ return;
}
else
login[0] = '\0';
exit_client(NULL, target_p, &me, "Nick collision(new)");
source_p->flags |= FLAGS_KILLED;
exit_client(client_p, source_p, &me, "Nick collision(old)");
- return 0;
+ return;
}
else
{
exit_client(client_p, source_p, &me, "Nick collision(old)");
else
exit_client(client_p, source_p, &me, "Nick collision(new)");
- return 0;
+ return;
}
else
{
}
send_signon(client_p, source_p, parv[1], parv[2], parv[3], newts, login);
- return 0;
}
static void
change_nick_user_host(target_p, nick, user, host, newts, "Signing %s (%s)", *login ? "in" : "out", nick);
}
-