commit - ec5ab4fcd1bc361cacb56e999b2b8f0a00caf5a9
commit + eccbd97e1f2599bfb76818fe6bc32967ed07e0c7
blob - 37b97d689e5ed900fac5bc86eb303a7190063e2a
blob + b1a371fc4e156e683141ab207607bd458fcfe799
--- src/ngircd/client.c
+++ src/ngircd/client.c
assert( Introducer != NULL );
Client->introducer = Introducer;
} /* Client_SetIntroducer */
-
-
-GLOBAL void
-Client_SetOperByMe( CLIENT *Client, bool OperByMe )
-{
- assert( Client != NULL );
- Client->oper_by_me = OperByMe;
-} /* Client_SetOperByMe */
GLOBAL bool
} /* Client_Flags */
-GLOBAL bool
-Client_OperByMe( CLIENT *Client )
-{
- assert( Client != NULL );
- return Client->oper_by_me;
-} /* Client_OperByMe */
-
-
GLOBAL int
Client_Hops( CLIENT *Client )
{
c->type = CLIENT_UNKNOWN;
c->conn_id = NONE;
- c->oper_by_me = false;
c->hops = -1;
c->token = -1;
c->mytoken = -1;
blob - e5c48b750349158f382850a497a5bc8e40e33411
blob + c6fcec0717c880909872f5ee12854e951b12c30e
--- src/ngircd/client.h
+++ src/ngircd/client.h
char info[CLIENT_INFO_LEN]; /* long user name (user) / info text (server) */
char modes[CLIENT_MODE_LEN]; /* client modes */
int hops, token, mytoken; /* "hops" and "Token" (see SERVER command) */
- bool oper_by_me; /* client is local IRC operator on this server? */
char *away; /* AWAY text (valid if mode 'a' is set) */
char flags[CLIENT_FLAGS_LEN]; /* flags of the client */
char *account_name; /* login account (for services) */
GLOBAL char *Client_Modes PARAMS(( CLIENT *Client ));
GLOBAL char *Client_Flags PARAMS(( CLIENT *Client ));
GLOBAL CLIENT *Client_Introducer PARAMS(( CLIENT *Client ));
-GLOBAL bool Client_OperByMe PARAMS(( CLIENT *Client ));
GLOBAL int Client_Hops PARAMS(( CLIENT *Client ));
GLOBAL int Client_Token PARAMS(( CLIENT *Client ));
GLOBAL int Client_MyToken PARAMS(( CLIENT *Client ));
GLOBAL void Client_SetType PARAMS(( CLIENT *Client, int Type ));
GLOBAL void Client_SetHops PARAMS(( CLIENT *Client, int Hops ));
GLOBAL void Client_SetToken PARAMS(( CLIENT *Client, int Token ));
-GLOBAL void Client_SetOperByMe PARAMS(( CLIENT *Client, bool OperByMe ));
GLOBAL void Client_SetModes PARAMS(( CLIENT *Client, const char *Modes ));
GLOBAL void Client_SetFlags PARAMS(( CLIENT *Client, const char *Flags ));
GLOBAL void Client_SetIntroducer PARAMS(( CLIENT *Client, CLIENT *Introducer ));
blob - d5e7bdd1b474a1882c0cca04048a624c17032ac3
blob + b286b5ac3df4cf705b18dc63b695209268083d5d
--- src/ngircd/irc-channel.c
+++ src/ngircd/irc-channel.c
return false;
}
- if (Channel_HasMode(chan, 'O') && !Client_OperByMe(Client)) {
+ if (Channel_HasMode(chan, 'O') && !Client_HasMode(Client, 'o')) {
/* Only IRC operators are allowed! */
IRC_WriteErrClient(Client, ERR_OPONLYCHANNEL_MSG,
Client_ID(Client), channame);
/* Gotcha! */
if (!Channel_HasMode(chan, 's')
|| Channel_IsMemberOf(chan, from)
- || (!Conf_MorePrivacy && Client_OperByMe(Client))) {
+ || (!Conf_MorePrivacy
+ && Client_HasMode(Client, 'o')
+ && Client_Conn(Client) > NONE))
+ {
if ((Conf_MaxListSize > 0)
&& IRC_CheckListTooBig(from, count,
Conf_MaxListSize,
blob - e2fa59a2df67aa5f306629e0b3db9030a26d7c1d
blob + af59683a744740baae7cae3ebec1dd3b22ef91c9
--- src/ngircd/irc-mode.c
+++ src/ngircd/irc-mode.c
else
x[0] = 'B';
break;
- case 'c': /* Receive connect notices
- * (only settable by IRC operators!) */
+ case 'c': /* Receive connect notices */
+ case 'q': /* KICK-protected user */
+ /* (only settable by IRC operators!) */
if (!set || Client_Type(Client) == CLIENT_SERVER
- || Client_OperByMe(Origin))
- x[0] = 'c';
+ || Client_HasMode(Origin, 'o'))
+ x[0] = *mode_ptr;
else
ok = IRC_WriteErrClient(Origin,
ERR_NOPRIVILEGES_MSG,
break;
case 'o': /* IRC operator (only unsettable!) */
if (!set || Client_Type(Client) == CLIENT_SERVER) {
- Client_SetOperByMe(Target, false);
x[0] = 'o';
} else
ok = IRC_WriteErrClient(Origin,
ERR_NOPRIVILEGES_MSG,
Client_ID(Origin));
break;
- case 'q': /* KICK-protected user */
- if (!set || Client_Type(Client) == CLIENT_SERVER
- || Client_OperByMe(Origin))
- x[0] = 'q';
- else
- ok = IRC_WriteErrClient(Origin,
- ERR_NOPRIVILEGES_MSG,
- Client_ID(Origin));
- break;
case 'r': /* Restricted (only settable) */
if (set || Client_Type(Client) == CLIENT_SERVER)
x[0] = 'r';
Client_ID(Origin));
else if (!set || Conf_CloakHostModeX[0]
|| Client_Type(Client) == CLIENT_SERVER
- || Client_OperByMe(Client)) {
+ || Client_HasMode(Origin, 'o')) {
x[0] = 'x';
send_RPL_HOSTHIDDEN_MSG = true;
} else
/* Check if origin is oper and opers can use mode */
use_servermode = Conf_OperServerMode;
- if(Client_OperByMe(Client) && Conf_OperCanMode) {
+ if(Client_HasMode(Client, 'o') && Conf_OperCanMode) {
is_oper = true;
}
blob - 4d17085f4ac3ce7a264bfa900e940d17512f5c5c
blob + 74f17cc0dec9343483ec7844e9b9570a83ba57c0
--- src/ngircd/irc-oper.c
+++ src/ngircd/irc-oper.c
Client_ID(Client));
}
- if (!Client_OperByMe(Client))
- Log(LOG_NOTICE|LOG_snotice,
- "Got valid OPER for \"%s\" from \"%s\", user is an IRC operator now.",
- Req->argv[0], Client_Mask(Client));
+ Log(LOG_NOTICE|LOG_snotice,
+ "Got valid OPER for \"%s\" from \"%s\", user is an IRC operator now.",
+ Req->argv[0], Client_Mask(Client));
- Client_SetOperByMe(Client, true);
return IRC_WriteStrClient(Client, RPL_YOUREOPER_MSG, Client_ID(Client));
} /* IRC_OPER */
switch (Client_Type(Client)) {
case CLIENT_USER:
- if (!Client_OperByMe(Client))
- return IRC_WriteErrClient(Client, ERR_NOPRIVILEGES_MSG,
- Client_ID(Client));
+ if (!Op_Check(Client, Req))
+ return Op_NoPrivileges(Client, Req);
from = Client;
break;
case CLIENT_SERVER:
blob - 8c08cdc1a744fc939d183d2fa16a5c657b788ed8
blob + 34180aa7d48eb04130da17ffdd712909859204bf
--- src/ngircd/irc.c
+++ src/ngircd/irc.c
#include "match.h"
#include "messages.h"
#include "parse.h"
+#include "op.h"
#include "tool.h"
#include "exp.h"
assert (Client != NULL);
assert (Req != NULL);
- if (Client_Type(Client) != CLIENT_SERVER && !Client_OperByMe(Client))
- return IRC_WriteErrClient(Client, ERR_NOPRIVILEGES_MSG,
- Client_ID(Client));
+ if (Client_Type(Client) != CLIENT_SERVER && !Op_Check(Client, Req))
+ return Op_NoPrivileges(Client, Req);
/* Get prefix (origin); use the client if no prefix is given. */
if (Req->prefix)
blob - 2d36cd559196c3e7639367370bf6960896f6e451
blob + 71e7cbcec778ae3e65a266846dfa655e04f73cd9
--- src/ngircd/op.c
+++ src/ngircd/op.c
return c;
if (!Client_HasMode(c, 'o'))
return NULL;
- if (!Client_OperByMe(c) && !Conf_AllowRemoteOper)
+ if (Client_Conn(c) <= NONE && !Conf_AllowRemoteOper)
return NULL;
/* The client is an local IRC operator, or this server is configured