- Added oper::maxlogins which allows you to limit the number of concurrent session

with the same oper block. Suggested by kain.
- Made /dns oper-only (the ircd command, not your client /dns command :p).
- Various help.conf fixes. Reported by nukie ().
This commit is contained in:
Bram Matthys 2003-11-19 23:41:34 +00:00
parent eacfd5eb5c
commit 37a93b5502
9 changed files with 126 additions and 36 deletions

View file

@ -2579,3 +2579,7 @@ seen. gmtime warning still there
- Added comment to 'Install as a service' option in installer to help n00bs a bit.
- Made win32 work again (broke it by /module patch 30 minutes ago).
- Fixed a snomask issue reported by Magnet (#0001354).
- Added oper::maxlogins which allows you to limit the number of concurrent session
with the same oper block. Suggested by kain.
- Made /dns oper-only (the ircd command, not your client /dns command :p).
- Various help.conf fixes. Reported by nukie (#0001373).

View file

@ -21,7 +21,7 @@
<font size="4"><a href="http://www.unrealircd.com">http://www.unrealircd.com</a></font><br>
<font size="4">Version: 3.2</font><br>
<b>Current Version:</b> 3.2 Beta18<br>
<b>Last doc update:</b> 2003-10-30</div>
<b>Last doc update:</b> 2003-11-18</div>
<b>Head Coders:</b> Stskeeps / codemastr / Syzop / Luke / McSkaf<br>
<b>Contributors:</b> Zogg / NiQuiL / assyrian / chasm / DrBin / llthangel / Griever / nighthawk<br>
<b>Documentation:</b> CKnight^ / Syzop<br>
@ -674,19 +674,20 @@ listen *:6601 {
};
swhois &lt;whois info&gt;;
snomask &lt;snomask&gt;;
maxlogins &lt;num&gt;;
};
</pre></p>
<p>The oper block allows you to assign IRC Operators for your server. The oper::
specifies the login name for the /oper. The oper::from::userhost is a user@host
<p>The oper block allows you to assign IRC Operators for your server. The <b>oper::</b>
specifies the login name for the /oper. The <b>oper::from::userhost</b> is a user@host
mask that the user must match, you can specify more than one hostmask by creating
more than one oper::from::userhost. The oper::password is the password the user
more than one oper::from::userhost. The <b>oper::password</b> is the password the user
must specify, oper::password:: allows you to specify an authentication method
for this password, valid auth-types are crypt, md5, and sha1, ripemd-160. If
you want to use a plain-text password leave this sub-block out.</p>
<p>Please note that BOTH the login name and password are case sensitive</p>
<p>The oper::class directive specifies the name of a preexisting (appears before
<p>The <b>oper::class</b> directive specifies the name of a preexisting (appears before
this in the config file) class name that the oper block will use.</p>
<p>The oper::flags directive has two formats. If you wish to use the old style
<p>The <b>oper::flags</b> directive has two formats. If you wish to use the old style
oper flags i.e., OAa, you use the flags &lt;flags&gt; method, if you want to
use the new style,i.e., services-admin, then you use the flags { &lt;flag&gt;;
} method. Below is a list of all the flags (in both formats) and what they do.</p>
@ -942,10 +943,14 @@ listen *:6601 {
<td>services-admin</td>
</tr>
</table>
<p>The oper::swhois directive allows you to add an extra line to an opers whois
information.</p>
<p>The oper::snomask directive allows you to preset an oper's server notice mask
on oper up. For a list of available SNOMASKs, see <a href="#feature_snomasks">Section 3.3</a><br>
<p>The <b>oper::swhois</b> directive allows you to add an extra line to an opers whois
information. <font color=blue>[optional]</font></p>
<p>The <b>oper::snomask</b> directive allows you to preset an oper's server notice mask
on oper up. For a list of available SNOMASKs, see <a href="#feature_snomasks">Section 3.3</a>
<font color=blue>[optional]</font></p>
<p>The <b>oper::maxlogins</b> allows you to restrict the number of concurrent oper logins from this host,
for example if you set it to 1 then only 1 person can be oper'ed via this block at any time.
<font color=blue>[optional]</font></p>
<p>Example:<br>
<pre>
@ -958,6 +963,11 @@ oper bobsmith {
password "f00";
flags {
netadmin;
can_gkline;
can_gzline;
can_zline;
can_restart;
can_die;
global;
};
swhois "Example of a whois mask";

View file

@ -31,14 +31,14 @@ help Usercmds {
" a specific command.";
" -";
" ==-----------------oOo-----------------==";
" ADMIN LICENSE NICK SETNAME WATCH";
" AWAY LINKS NOTICE SILENCE WHO";
" CREDITS LIST PART STATS WHOIS";
" ADMIN KICK MOTD QUIT VERSION";
" AWAY KNOCK NAMES RULES VHOST";
" CREDITS LICENSE NICK SETNAME WATCH";
" CYCLE LINKS NOTICE SILENCE WHO";
" DALINFO LIST PART STATS WHOIS";
" INVITE LUSERS PING TIME WHOWAS";
" ISON MAP PONG TOPIC CYCLE";
" JOIN MODE PRIVMSG USERHOST DNS";
" KICK MOTD QUIT VERSION";
" KNOCK NAMES RULES VHOST";
" ISON MAP PONG TOPIC";
" JOIN MODE PRIVMSG USERHOST";
" ==-----------------oOo-----------------==";
};
@ -48,7 +48,7 @@ help Opercmds {
" a specific command.";
" -";
" ==----------------oOo---------------==";
" OPER WALLOPS GLOBOPS CHATOPS LOCOPS";
" OPER WALLOPS GLOBOPS CHATOPS LOCOPS DNS";
" ADCHAT NACHAT KILL KLINE ZLINE";
" GLINE SHUN GZLINE HTM TSCTL";
" AKILL RAKILL REHASH RESTART DIE";
@ -87,13 +87,13 @@ help Umodes {
" N = Is a Network Administrator";
" C = Is a Co Administrator";
" -";
" d = Makes it so you can not recieve channel PRIVMSGs (Deaf)";
" d = Makes it so you can not receive channel PRIVMSGs (Deaf)";
" g = Can read & send to GlobOps, and LocOps";
" h = Available for Help (Help Operator)";
" i = Invisible (Not shown in /WHO searches)";
" p = Hide all channels in /whois and /who";
" q = Only U:lines can kick you (Services Admins/Net Admins only)";
" r = Identifies the nick as being Registered";
" r = Identifies the nick as being Registered (settable by services only)";
" s = Can listen to Server notices";
" t = Says that you are using a /VHOST";
" v = Receive infected DCC send rejection notices";
@ -126,7 +126,7 @@ help Snomasks {
" n = nick change notices";
" q = Lets you see notices when a user is rejected because of a Q:line";
" v = Lets you receive notice of /VHOST usages";
" F = Lets you recieve Far and Local connect notices (except from U-lines)";
" F = Lets you receive Far and Local connect notices (except from U-lines)";
" G = Lets you see TKL (G:line,Shun) noties";
" ==-------------------------oOo------------------------==";
};
@ -152,23 +152,23 @@ help Chmodes {
" m = Moderated channel (only +vhoaq users may speak) [h]";
" n = Users outside the channel can not send PRIVMSGs to the channel [h]";
" p = Private channel [o]";
" r = The channel is registered (services settable only)";
" r = The channel is registered (settable by services only)";
" s = Secret channel [o]";
" t = Only +hoaq may change the topic [h]";
" z = Only Clients on a Secure Connection (SSL) can join [o]";
" A = Server/Net Admin only channel (Settable by Admins)";
" A = Server/Net Admin only channel (settable by Admins)";
" C = No CTCPs allowed in the channel [o]";
" G = Filters out all Bad words in messages with <censored> [o]";
" M = Must be using a registered nick (+r) to talk [o]";
" K = /KNOCK is not allowed [o]";
" L <chan2> = Channel link (If +l is full, the next user will auto-join <chan2>) [q]";
" N = No Nickname changes are permitted in the channel [o]";
" O = IRC Operator only channel (Settable by IRCops)";
" O = IRC Operator only channel (settable by IRCops)";
" Q = No kicks allowed [o]";
" R = Only registered (+r) users may join the channel [o]";
" S = Strips mIRC color codes [o]";
" V = /INVITE is not allowed [o]";
" u = Auditorium mode /names and /who #channel only show channel ops [q]";
" u = Auditorium mode (/names and /who #channel only show channel ops) [q]";
" -";
" [h] requires at least halfop, [o] requires at least chanop, [q] requires owner";
" ==------------------------------oOo----------------------------==";
@ -274,11 +274,11 @@ help Dns {
" Returns information about the IRC server's DNS cache.";
" Note, since most clients have a builtin DNS command,";
" you will most likely need to use /raw DNS to use this.";
" Opers may specify an l as the first parameter to the command";
" to receive a list of entries in the DNS cache.";
" There are also 2 other variants:";
" 'DNS l' will show you the DNS cache entries";
" 'DNS i' will give you details about the nameserver config";
" -";
"Syntax: DNS";
"Syntax: DNS l (Oper only)";
"Syntax: DNS [option]";
};
help Names {
@ -564,6 +564,13 @@ help Credits {
" CREDITS <server>";
};
help Dalinfo {
" This command will show historical credits (from ircu, etc..)";
" -";
" Syntax: DALINFO";
" Syntax: DALINFO <server>";
};
help License {
" This command displays information about the license UnrealIRCd is released under.";
" Syntax: LICENSE";
@ -611,12 +618,19 @@ help Globops {
};
help Locops {
" Similar to GLOBOPS, except only received by those IRCops local to your server.";
" Sends a message to all IRCops at this server (local).";
" -";
" Syntax: LOCOPS <message>";
" Example: LOCOPS Gonna k:line that user ...";
};
help Chatops {
" Sends a message to all ircops (global).";
" -";
" Syntax: CHATOPS <message>";
" Example: CHATOPS Gonna k:line that user ...";
};
help Adchat {
" Sends a message to all online Admins";
" -";
@ -865,12 +879,12 @@ help Sajoin {
};
help Sapart {
" Forces a user to join a channel.";
" Forces a user to part a channel.";
" Services Admin Command";
" -";
" Syntax: SAJOIN <nick> <channel>,[<channel2>..]";
" Example: SAJOIN hAtbLaDe #OperHelp";
" SAJOIN hAtbLaDe #Support,#IRCHelp";
" Syntax: SAPART <nick> <channel>,[<channel2>..]";
" Example: SAPART hAtbLaDe #OperHelp";
" SAPART hAtbLaDe #Support,#IRCHelp";
};
help Samode {

View file

@ -621,3 +621,4 @@ extern void sendto_chmodemucrap(aClient *, aChannel *, char *);
extern void verify_opercount(aClient *, char *);
extern int place_host_ban(aClient *sptr, int action, char *reason, long time);
extern int valid_host(char *host);
extern int count_oper_sessions(char *);

View file

@ -675,6 +675,7 @@ struct User {
#ifdef LIST_DEBUG
aClient *bcptr;
#endif
char *operlogin; /* Only used if person is/was opered, used for oper::maxlogins */
struct {
time_t nick_t;
unsigned char nick_c;
@ -995,6 +996,7 @@ struct _configitem_oper {
ConfigItem_class *class;
ConfigItem *from;
long oflags;
int maxlogins;
};
struct _configitem_oper_from {

View file

@ -240,6 +240,8 @@ void free_user(anUser *user, aClient *cptr)
MyFree((char *)user->swhois);
if (user->virthost)
MyFree((char *)user->virthost);
if (user->operlogin)
MyFree(user->operlogin);
/*
* sanity check
*/

View file

@ -191,6 +191,24 @@ DLLFUNC int m_oper(aClient *cptr, aClient *sptr, int parc, char *parv[]) {
{
int old = (sptr->umodes & ALL_UMODES);
if (aconf->maxlogins && (count_oper_sessions(aconf->name) >= aconf->maxlogins))
{
sendto_one(sptr, err_str(ERR_NOOPERHOST), me.name, parv[0]);
sendto_one(sptr, ":%s NOTICE %s :Your maximum number of concurrent oper logins has been reached (%d)",
me.name, sptr->name, aconf->maxlogins);
sendto_realops
("Failed OPER attempt by %s (%s@%s) [maxlogins reached]",
parv[0], sptr->user->username, sptr->sockhost);
ircd_log(LOG_OPER, "OPER TOOMANYLOGINS (%s) by (%s!%s@%s)", name, parv[0],
sptr->user->username, sptr->sockhost);
sptr->since += 4;
return 0;
}
if (sptr->user->operlogin)
MyFree(sptr->user->operlogin);
sptr->user->operlogin = strdup(aconf->name);
/* Put in the right class */
if (sptr->class)
sptr->class->clients--;

View file

@ -1630,7 +1630,14 @@ int m_dns(aClient *cptr, aClient *sptr, int parc, char *parv[])
aCache *cp;
int i;
if (IsOper(sptr) && parv[1] && *parv[1] == 'l')
/* Why would normal users need to know all this? */
if (!IsOper(sptr))
{
sendto_one(sptr, err_str(ERR_NOPRIVILEGES), me.name, parv[0]);
return 0;
}
if (parv[1] && *parv[1] == 'l')
{
sendto_realops("%s did a DNS cache list", sptr->name);
for (cp = cachetop; cp; cp = cp->list_next)
@ -1667,7 +1674,7 @@ int m_dns(aClient *cptr, aClient *sptr, int parc, char *parv[])
}
return 2;
}
if (IsOper(sptr) && parv[1] && *parv[1] == 'i')
if (parv[1] && *parv[1] == 'i')
{
int i;
/* Display nameserver list */

View file

@ -2116,6 +2116,24 @@ ConfigItem_oper *Find_oper(char *name)
return NULL;
}
int count_oper_sessions(char *name)
{
int i, count = 0;
aClient *cptr;
#ifdef NO_FDLIST
for (i = 0; i <= LastSlot; i++)
#else
int j;
for (i = oper_fdlist.entry[j = 1]; j <= oper_fdlist.last_entry; i = oper_fdlist.entry[++j])
#endif
if ((cptr = local[i]) && IsPerson(cptr) && IsAnOper(cptr) &&
cptr->user && cptr->user->operlogin && !strcmp(cptr->user->operlogin,name))
count++;
return count;
}
ConfigItem_listen *Find_listen(char *ipmask, int port)
{
ConfigItem_listen *p;
@ -2782,6 +2800,10 @@ int _conf_oper(ConfigFile *conf, ConfigEntry *ce)
{
ircstrdup(oper->snomask, cep->ce_vardata);
}
if ((cep = config_find_entry(ce->ce_entries, "maxlogins")))
{
oper->maxlogins = (int)config_checkval(cep->ce_vardata, CFG_TIME);
}
cep = config_find_entry(ce->ce_entries, "from");
for (cepp = cep->ce_entries; cepp; cepp = cepp->ce_next)
{
@ -2841,6 +2863,16 @@ int _test_oper(ConfigFile *conf, ConfigEntry *ce)
}
else if (!strcmp(cep->ce_varname, "snomask")) {
}
else if (!strcmp(cep->ce_varname, "maxlogins"))
{
long l = config_checkval(cep->ce_vardata, CFG_TIME);
if ((l < 0) || (l > 5000))
{
config_error("%s:%i: oper::maxlogins: value out of range (%ld) should be 0-5000",
cep->ce_fileptr->cf_filename, cep->ce_varlinenum, l);
errors++; continue;
}
}
else if (!strcmp(cep->ce_varname, "flags"))
{
}