Commit Diff


commit - ec5ab4fcd1bc361cacb56e999b2b8f0a00caf5a9
commit + eccbd97e1f2599bfb76818fe6bc32967ed07e0c7
blob - 37b97d689e5ed900fac5bc86eb303a7190063e2a
blob + b1a371fc4e156e683141ab207607bd458fcfe799
--- src/ngircd/client.c
+++ src/ngircd/client.c
@@ -543,14 +543,6 @@ Client_SetIntroducer( CLIENT *Client, CLIENT *Introduc
 	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
@@ -889,14 +881,6 @@ Client_Flags( CLIENT *Client )
 } /* Client_Flags */
 
 
-GLOBAL bool
-Client_OperByMe( CLIENT *Client )
-{
-	assert( Client != NULL );
-	return Client->oper_by_me;
-} /* Client_OperByMe */
-
-
 GLOBAL int
 Client_Hops( CLIENT *Client )
 {
@@ -1426,7 +1410,6 @@ New_Client_Struct( void )
 
 	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
@@ -58,7 +58,6 @@ typedef struct _CLIENT
 	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) */
@@ -120,7 +119,6 @@ GLOBAL const char *Client_IPAText PARAMS(( CLIENT *Cli
 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 ));
@@ -142,7 +140,6 @@ GLOBAL void Client_SetInfo PARAMS(( CLIENT *Client, co
 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
@@ -129,7 +129,7 @@ join_allowed(CLIENT *Client, CHANNEL *chan, const char
 		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);
@@ -619,7 +619,10 @@ IRC_LIST( CLIENT *Client, REQUEST *Req )
 				/* 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
@@ -223,11 +223,12 @@ Client_Mode( CLIENT *Client, REQUEST *Req, CLIENT *Ori
 			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,
@@ -235,22 +236,12 @@ Client_Mode( CLIENT *Client, REQUEST *Req, CLIENT *Ori
 			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';
@@ -274,7 +265,7 @@ Client_Mode( CLIENT *Client, REQUEST *Req, CLIENT *Ori
 							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
@@ -455,7 +446,7 @@ Channel_Mode(CLIENT *Client, REQUEST *Req, CLIENT *Ori
 
 	/* 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
@@ -90,12 +90,10 @@ IRC_OPER( CLIENT *Client, REQUEST *Req )
 					  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 */
 
@@ -357,9 +355,8 @@ IRC_WALLOPS( CLIENT *Client, REQUEST *Req )
 
 	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
@@ -33,6 +33,7 @@
 #include "match.h"
 #include "messages.h"
 #include "parse.h"
+#include "op.h"
 #include "tool.h"
 
 #include "exp.h"
@@ -134,9 +135,8 @@ IRC_KILL(CLIENT *Client, REQUEST *Req)
 	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
@@ -86,7 +86,7 @@ Op_Check(CLIENT * Client, REQUEST * Req)
 		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