isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
+ CODE_SIGN_IDENTITY = "Developer ID Application: Alexander Barton";
GCC_VERSION = 4.2;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
# Connect to the remote server using TLS/SSL (Default: false)
;SSLConnect = yes
- # Define a (case insensitive) mask matching nick names that should be
- # treated as IRC services when introduced via this remote server.
+ # Define a (case insensitive) list of masks matching nick names that
+ # should be treated as IRC services when introduced via this remote
+ # server, separated by commas (",").
# REGULAR SERVERS DON'T NEED this parameter, so leave it empty
# (which is the default).
# When you are connecting IRC services which mask as a IRC server
# and which use "virtual users" to communicate with, for example
# "NickServ" and "ChanServ", you should set this parameter to
- # something like "*Serv".
- ;ServiceMask = *Serv
+ # something like "*Serv" or "NickServ,ChanServ,XyzServ".
+ ;ServiceMask = *Serv,Global
[Server]
# More [Server] sections, if you like ...
Connect to the remote server using TLS/SSL. Default: false.
.TP
\fBServiceMask\fR (string)
-Define a (case insensitive) mask matching nick names that should be treated as
-IRC services when introduced via this remote server. REGULAR SERVERS DON'T NEED
-this parameter, so leave it empty (which is the default).
+Define a (case insensitive) list of masks matching nick names that should be
+treated as IRC services when introduced via this remote server, separated
+by commas (","). REGULAR SERVERS DON'T NEED this parameter, so leave it empty
+(which is the default).
.PP
.RS
When you are connecting IRC services which mask as a IRC server and which use
"virtual users" to communicate with, for example "NickServ" and "ChanServ",
-you should set this parameter to something like "*Serv".
+you should set this parameter to something like "*Serv", "*Serv,OtherNick",
+or "NickServ,ChanServ,XyzServ".
.SH [CHANNEL]
Pre-defined channels can be configured in
.I [Channel]
/*
* ngIRCd -- The Next Generation IRC Daemon
- * Copyright (c)2001-2010 Alexander Barton (alex@barton.de)
+ * Copyright (c)2001-2012 Alexander Barton (alex@barton.de)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
return false;
}
+ if (Client_Type(Client) != CLIENT_SERVER
+ && Client_Type(Client) != CLIENT_SERVICE) {
+ /* Make sure that this isn't a restricted/forbidden nick name */
+ if (Conf_NickIsBlocked(Nick)) {
+ IRC_WriteStrClient(Client, ERR_FORBIDDENNICKNAME_MSG,
+ Client_ID(Client), Nick);
+ return false;
+ }
+ }
+
/* Nickname already registered? */
if (Client_Search(Nick)) {
IRC_WriteStrClient(Client, ERR_NICKNAMEINUSE_MSG,
Client_SetType(Client, Type);
if (From) {
- if (Conf_IsService(Conf_GetServer(Client_Conn(From)),
+ if (Conf_NickIsService(Conf_GetServer(Client_Conn(From)),
Client_ID(Client)))
Client_SetType(Client, CLIENT_SERVICE);
LogDebug("%s \"%s\" (+%s) registered (via %s, on %s, %d hop%s).",
}
/**
- * Check if the given nick name is an service.
+ * Check if the given nick name is reserved for services on a particular server.
*
+ * @param ConfServer The server index to check.
+ * @param Nick The nick name to check.
* @returns true if the given nick name belongs to an "IRC service".
*/
GLOBAL bool
-Conf_IsService(int ConfServer, const char *Nick)
+Conf_NickIsService(int ConfServer, const char *Nick)
{
- return MatchCaseInsensitive(Conf_Server[ConfServer].svs_mask, Nick);
+ assert (ConfServer >= 0);
+ assert (ConfServer < MAX_SERVERS);
+
+ return MatchCaseInsensitiveList(Conf_Server[ConfServer].svs_mask,
+ Nick, ",");
+}
+
+/**
+ * Check if the given nick name is blocked for "normal client" use.
+ *
+ * @param ConfServer The server index or NONE to check all configured servers.
+ * @param Nick The nick name to check.
+ * @returns true if the given nick name belongs to an "IRC service".
+ */
+GLOBAL bool
+Conf_NickIsBlocked(const char *Nick)
+{
+ int i;
+
+ for(i = 0; i < MAX_SERVERS; i++) {
+ if (!Conf_Server[i].name[0])
+ continue;
+ if (Conf_NickIsService(i, Nick))
+ return true;
+ }
+ return false;
}
/**
/*
* ngIRCd -- The Next Generation IRC Daemon
- * Copyright (c)2001-2011 Alexander Barton (alex@barton.de) and Contributors.
+ * Copyright (c)2001-2012 Alexander Barton (alex@barton.de) and Contributors.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
GLOBAL bool Conf_DisableServer PARAMS(( const char *Name ));
GLOBAL bool Conf_AddServer PARAMS(( const char *Name, UINT16 Port, const char *Host, const char *MyPwd, const char *PeerPwd ));
-GLOBAL bool Conf_IsService PARAMS((int ConfServer, const char *Nick));
+GLOBAL bool Conf_NickIsService PARAMS((int ConfServer, const char *Nick));
+GLOBAL bool Conf_NickIsBlocked PARAMS((const char *Nick));
/* Password required by WEBIRC command */
GLOBAL char Conf_WebircPwd[CLIENT_PASS_LEN];
if (My_Connections[i].lastping <
time(NULL) - Conf_PongTimeout) {
/* Timeout */
- LogDebug
- ("Connection %d: Ping timeout: %d seconds.",
- i, Conf_PongTimeout);
- snprintf(msg, sizeof(msg), "Ping timeout: %d seconds", Conf_PongTimeout);
+ snprintf(msg, sizeof(msg),
+ "Ping timeout: %d seconds",
+ Conf_PongTimeout);
+ LogDebug("Connection %d: %s.", i, msg);
Conn_Close(i, NULL, msg, true);
}
} else if (My_Connections[i].lastdata <
/*
* ngIRCd -- The Next Generation IRC Daemon
- * Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
+ * Copyright (c)2001-2012 Alexander Barton (alex@barton.de) and Contributors.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
/**
* Match string with pattern.
*
- * @param Pattern Pattern to match with
- * @param String Input string
- * @return true if pattern matches
+ * @param Pattern Pattern to match with
+ * @param String Input string
+ * @return true if pattern matches
*/
GLOBAL bool
Match( const char *Pattern, const char *String )
/**
* Match string with pattern case-insensitive.
*
- * @param pattern Pattern to match with
- * @param searchme Input string, at most COMMAND_LEN-1 characters long
- * @return true if pattern matches
+ * @param Pattern Pattern to match with
+ * @param String Input string, at most COMMAND_LEN-1 characters long
+ * @return true if pattern matches
*/
GLOBAL bool
-MatchCaseInsensitive(const char *pattern, const char *searchme)
+MatchCaseInsensitive(const char *Pattern, const char *String)
{
char haystack[COMMAND_LEN];
- strlcpy(haystack, searchme, sizeof(haystack));
- return Match(pattern, ngt_LowerStr(haystack));
+ strlcpy(haystack, String, sizeof(haystack));
+ return Match(Pattern, ngt_LowerStr(haystack));
+} /* MatchCaseInsensitive */
+
+
+/**
+ * Match string with pattern case-insensitive.
+ *
+ * @param pattern Pattern to match with
+ * @param String Input string, at most COMMAND_LEN-1 characters long
+ * @param Separator Character separating the individual patterns in the list
+ * @return true if pattern matches
+ */
+GLOBAL bool
+MatchCaseInsensitiveList(const char *Pattern, const char *String,
+ const char *Separator)
+{
+ char tmp_pattern[COMMAND_LEN], haystack[COMMAND_LEN], *ptr;
+
+ strlcpy(tmp_pattern, Pattern, sizeof(tmp_pattern));
+ strlcpy(haystack, String, sizeof(haystack));
+ ngt_LowerStr(haystack);
+
+ ptr = strtok(tmp_pattern, Separator);
+ while (ptr) {
+ ngt_TrimStr(ptr);
+ if (Match(ptr, haystack))
+ return true;
+ ptr = strtok(NULL, Separator);
+ }
+ return false;
} /* MatchCaseInsensitive */
/*
* ngIRCd -- The Next Generation IRC Daemon
- * Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
+ * Copyright (c)2001-2012 Alexander Barton (alex@barton.de) and Contributors.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* Wildcard pattern matching (header)
*/
-GLOBAL bool Match PARAMS(( const char *Pattern, const char *String ));
-GLOBAL bool MatchCaseInsensitive PARAMS(( const char *Pattern, const char *searchme ));
+GLOBAL bool Match PARAMS((const char *Pattern, const char *String));
+
+GLOBAL bool MatchCaseInsensitive PARAMS((const char *Pattern,
+ const char *String));
+
+GLOBAL bool MatchCaseInsensitiveList PARAMS((const char *Pattern,
+ const char *String,
+ const char *Separator));
#endif
#define ERR_NONICKNAMEGIVEN_MSG "431 %s :No nickname given"
#define ERR_ERRONEUSNICKNAME_MSG "432 %s %s :Erroneous nickname"
#define ERR_NICKNAMETOOLONG_MSG "432 %s %s :Nickname too long, max. %u characters"
+#define ERR_FORBIDDENNICKNAME_MSG "432 %s %s :Nickname is forbidden/blocked"
#define ERR_NICKNAMEINUSE_MSG "433 %s %s :Nickname already in use"
#define ERR_USERNOTINCHANNEL_MSG "441 %s %s %s :They aren't on that channel"
#define ERR_NOTONCHANNEL_MSG "442 %s %s :You are not on that channel"