The new configuration variable "AllowedChannelTypes" lists all allowed
channel types (channel prefixes) for newly created channels on the local
server. By default, all supported channel types are allowed.
If set to the empty string, local clients can't create new channels at
all, which equals the old "PredefChannelsOnly = yes" setting.
This patch deprecates the "PredefChannelsOnly" variable, too, but it is
still supported and translated to the apropriate "AllowedChannelTypes"
setting. When "PredefChannelsOnly" is processed, a warning message is
logged.
Closes bug #152.
# behavior of ngIRCd. If you want to get started quickly, you most
# probably don't have to make changes here -- they are all optional.
# behavior of ngIRCd. If you want to get started quickly, you most
# probably don't have to make changes here -- they are all optional.
+ # List of allowed channel types (channel prefixes) for newly created
+ # channels on the local server. By default, all supported channel
+ # types are allowed. Set this variable to the empty string to disallow
+ # creation of new channels by local clients at all.
+ ;AllowedChannelTypes = #&+
+
# Are remote IRC operators allowed to control this server, e.g.
# use commands like CONNECT, SQUIT, DIE, ...?
;AllowRemoteOper = no
# Are remote IRC operators allowed to control this server, e.g.
# use commands like CONNECT, SQUIT, DIE, ...?
;AllowRemoteOper = no
# character prepended to their respective user names!
;PAMIsOptional = no
# character prepended to their respective user names!
;PAMIsOptional = no
- # Allow Pre-Defined Channels only (see Section [Channels])
- ;PredefChannelsOnly = no
-
# Let ngIRCd send an "authentication PING" when a new client connects,
# and register this client only after receiving the corresponding
# "PONG" reply.
# Let ngIRCd send an "authentication PING" when a new client connects,
# and register this client only after receiving the corresponding
# "PONG" reply.
ngIRCd. If you want to get started quickly, you most probably don't have to
make changes here -- they are all optional.
.TP
ngIRCd. If you want to get started quickly, you most probably don't have to
make changes here -- they are all optional.
.TP
+\fBAllowedChannelTypes\fR (string)
+List of allowed channel types (channel prefixes) for newly created channels
+on the local server. By default, all supported channel types are allowed.
+Set this variable to the empty string to disallow creation of new channels
+by local clients at all. Default: #&+
+.TP
\fBAllowRemoteOper\fR (boolean)
Are IRC operators connected to remote servers allowed to control this server,
e.g. are they allowed to use administrative commands like CONNECT, DIE,
\fBAllowRemoteOper\fR (boolean)
Are IRC operators connected to remote servers allowed to control this server,
e.g. are they allowed to use administrative commands like CONNECT, DIE,
don't have a "~" character prepended to their respective user names!
Default: no.
.TP
don't have a "~" character prepended to their respective user names!
Default: no.
.TP
-\fBPredefChannelsOnly\fR (boolean)
-If enabled, no new channels can be created. Useful if you do not want to have
-other channels than those defined in [Channel] sections in the configuration
-file on this server.
-Default: no.
-.TP
\fBRequireAuthPing\fR (boolean)
Let ngIRCd send an "authentication PING" when a new client connects, and
register this client only after receiving the corresponding "PONG" reply.
\fBRequireAuthPing\fR (boolean)
Let ngIRCd send an "authentication PING" when a new client connects, and
register this client only after receiving the corresponding "PONG" reply.
puts("");
puts("[OPTIONS]");
puts("");
puts("[OPTIONS]");
+ printf(" AllowedChannelTypes = %s\n", Conf_AllowedChannelTypes);
printf(" AllowRemoteOper = %s\n", yesno_to_str(Conf_AllowRemoteOper));
printf(" ChrootDir = %s\n", Conf_Chroot);
printf(" CloakHost = %s\n", Conf_CloakHost);
printf(" AllowRemoteOper = %s\n", yesno_to_str(Conf_AllowRemoteOper));
printf(" ChrootDir = %s\n", Conf_Chroot);
printf(" CloakHost = %s\n", Conf_CloakHost);
printf(" PAM = %s\n", yesno_to_str(Conf_PAM));
printf(" PAMIsOptional = %s\n", yesno_to_str(Conf_PAMIsOptional));
#endif
printf(" PAM = %s\n", yesno_to_str(Conf_PAM));
printf(" PAMIsOptional = %s\n", yesno_to_str(Conf_PAMIsOptional));
#endif
- printf(" PredefChannelsOnly = %s\n", yesno_to_str(Conf_PredefChannelsOnly));
#ifndef STRICT_RFC
printf(" RequireAuthPing = %s\n", yesno_to_str(Conf_AuthPing));
#endif
#ifndef STRICT_RFC
printf(" RequireAuthPing = %s\n", yesno_to_str(Conf_AuthPing));
#endif
Conf_PongTimeout = 20;
/* Options */
Conf_PongTimeout = 20;
/* Options */
+ strlcpy(Conf_AllowedChannelTypes, CHANTYPES,
+ sizeof(Conf_AllowedChannelTypes));
Conf_AllowRemoteOper = false;
#ifndef STRICT_RFC
Conf_AuthPing = false;
Conf_AllowRemoteOper = false;
#ifndef STRICT_RFC
Conf_AuthPing = false;
Conf_PAM = false;
#endif
Conf_PAMIsOptional = false;
Conf_PAM = false;
#endif
Conf_PAMIsOptional = false;
- Conf_PredefChannelsOnly = false;
#ifdef SYSLOG
Conf_ScrubCTCP = false;
#ifdef LOG_LOCAL5
#ifdef SYSLOG
Conf_ScrubCTCP = false;
#ifdef LOG_LOCAL5
Handle_OPTIONS(const char *File, int Line, char *Var, char *Arg)
{
size_t len;
Handle_OPTIONS(const char *File, int Line, char *Var, char *Arg)
{
size_t len;
assert(File != NULL);
assert(Line > 0);
assert(Var != NULL);
assert(Arg != NULL);
assert(File != NULL);
assert(Line > 0);
assert(Var != NULL);
assert(Arg != NULL);
+ if (strcasecmp(Var, "AllowedChannelTypes") == 0) {
+ p = Arg;
+ Conf_AllowedChannelTypes[0] = '\0';
+ while (*p) {
+ if (strchr(Conf_AllowedChannelTypes, *p)) {
+ /* Prefix is already included; ignore it */
+ p++;
+ continue;
+ }
+
+ if (strchr(CHANTYPES, *p)) {
+ len = strlen(Conf_AllowedChannelTypes) + 1;
+ assert(len < sizeof(Conf_AllowedChannelTypes));
+ Conf_AllowedChannelTypes[len - 1] = *p;
+ Conf_AllowedChannelTypes[len] = '\0';
+ } else {
+ Config_Error(LOG_WARNING,
+ "%s, line %d: Unknown channel prefix \"%c\" in \"AllowedChannelTypes\"!",
+ File, Line, *p);
+ }
+ p++;
+ }
+ return;
+ }
if (strcasecmp(Var, "AllowRemoteOper") == 0) {
Conf_AllowRemoteOper = Check_ArgIsTrue(Arg);
return;
if (strcasecmp(Var, "AllowRemoteOper") == 0) {
Conf_AllowRemoteOper = Check_ArgIsTrue(Arg);
return;
return;
}
if (strcasecmp(Var, "PredefChannelsOnly") == 0) {
return;
}
if (strcasecmp(Var, "PredefChannelsOnly") == 0) {
- Conf_PredefChannelsOnly = Check_ArgIsTrue(Arg);
+ /*
+ * TODO: This section and support for "PredefChannelsOnly"
+ * could be removed starting with ngIRCd release 22 (one
+ * release after marking it "deprecated") ...
+ */
+ Config_Error(LOG_WARNING,
+ "%s, line %d (section \"Options\"): \"%s\" is deprecated, please use \"AllowedChannelTypes\"!",
+ File, Line, Var);
+ if (Check_ArgIsTrue(Arg))
+ Conf_AllowedChannelTypes[0] = '\0';
+ else
+ strlcpy(Conf_AllowedChannelTypes, CHANTYPES,
+ sizeof(Conf_AllowedChannelTypes));
return;
}
#ifndef STRICT_RFC
return;
}
#ifndef STRICT_RFC
/** Array of pre-defined channels */
GLOBAL array Conf_Channels;
/** Array of pre-defined channels */
GLOBAL array Conf_Channels;
-/** Flag indicating if only pre-defined channels are allowed (true) or not */
-GLOBAL bool Conf_PredefChannelsOnly;
+/** String containing all locally allowed channel prefixes for new channels */
+GLOBAL char Conf_AllowedChannelTypes[8];
/** Flag indicating if IRC operators are allowed to always use MODE (true) */
GLOBAL bool Conf_OperCanMode;
/** Flag indicating if IRC operators are allowed to always use MODE (true) */
GLOBAL bool Conf_OperCanMode;
}
chan = Channel_Search(channame);
}
chan = Channel_Search(channame);
- if (!chan && Conf_PredefChannelsOnly) {
+ if (!chan && !strchr(Conf_AllowedChannelTypes, channame[0])) {
/* channel must be created, but forbidden by config */
IRC_WriteStrClient(Client, ERR_NOSUCHCHANNEL_MSG,
Client_ID(Client), channame);
/* channel must be created, but forbidden by config */
IRC_WriteStrClient(Client, ERR_NOSUCHCHANNEL_MSG,
Client_ID(Client), channame);