mirror of
				https://github.com/osmarks/ngircd.git
				synced 2025-10-31 14:02:59 +00:00 
			
		
		
		
	Op_Check(): return client that initiated the request or NULL
The old behavior of returning true/false is compatible to this change, so there are no other code changes required.
This commit is contained in:
		| @@ -58,9 +58,15 @@ Op_NoPrivileges(CLIENT * Client, REQUEST * Req) | |||||||
|  |  | ||||||
|  |  | ||||||
| /** | /** | ||||||
|  * Check that the client is an IRC operator allowed to administer this server. |  * Check that the originator of a request is an IRC operator and allowed | ||||||
|  |  * to administer this server. | ||||||
|  |  * | ||||||
|  |  * @param CLient Client from which the command has been received. | ||||||
|  |  * @param Req Request structure. | ||||||
|  |  * @return CLIENT structure of the client that initiated the command or | ||||||
|  |  *	   NULL if client is not allowed to execute operator commands. | ||||||
|  */ |  */ | ||||||
| GLOBAL bool | GLOBAL CLIENT * | ||||||
| Op_Check(CLIENT * Client, REQUEST * Req) | Op_Check(CLIENT * Client, REQUEST * Req) | ||||||
| { | { | ||||||
| 	CLIENT *c; | 	CLIENT *c; | ||||||
| @@ -72,15 +78,17 @@ Op_Check(CLIENT * Client, REQUEST * Req) | |||||||
| 		c = Client_Search(Req->prefix); | 		c = Client_Search(Req->prefix); | ||||||
| 	else | 	else | ||||||
| 		c = Client; | 		c = Client; | ||||||
|  |  | ||||||
| 	if (!c) | 	if (!c) | ||||||
| 		return false; | 		return NULL; | ||||||
| 	if (!Client_HasMode(c, 'o')) | 	if (!Client_HasMode(c, 'o')) | ||||||
| 		return false; | 		return NULL; | ||||||
| 	if (!Client_OperByMe(c) && !Conf_AllowRemoteOper) | 	if (!Client_OperByMe(c) && !Conf_AllowRemoteOper) | ||||||
| 		return false; | 		return NULL; | ||||||
|  |  | ||||||
| 	/* The client is an local IRC operator, or this server is configured | 	/* The client is an local IRC operator, or this server is configured | ||||||
| 	 * to trust remote operators. */ | 	 * to trust remote operators. */ | ||||||
| 	return true; | 	return c; | ||||||
| } /* Op_Check */ | } /* Op_Check */ | ||||||
|  |  | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,6 +1,6 @@ | |||||||
| /* | /* | ||||||
|  * ngIRCd -- The Next Generation IRC Daemon |  * ngIRCd -- The Next Generation IRC Daemon | ||||||
|  * Copyright (c)2001-2009 Alexander Barton (alex@barton.de) |  * Copyright (c)2001-2011 Alexander Barton (alex@barton.de) and Contributors. | ||||||
|  * |  * | ||||||
|  * This program is free software; you can redistribute it and/or modify |  * 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 |  * it under the terms of the GNU General Public License as published by | ||||||
| @@ -18,7 +18,7 @@ | |||||||
|  */ |  */ | ||||||
|  |  | ||||||
| GLOBAL bool Op_NoPrivileges PARAMS((CLIENT * Client, REQUEST * Req)); | GLOBAL bool Op_NoPrivileges PARAMS((CLIENT * Client, REQUEST * Req)); | ||||||
| GLOBAL bool Op_Check PARAMS((CLIENT * Client, REQUEST * Req)); | GLOBAL CLIENT *Op_Check PARAMS((CLIENT * Client, REQUEST * Req)); | ||||||
|  |  | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Alexander Barton
					Alexander Barton