X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?p=ngircd-alex.git;a=blobdiff_plain;f=src%2Fngircd%2Fop.c;h=588513dd43dd87271d64f3b6111d25b68300ddbb;hp=64c7e1e1fb2142e0bd6f3c5850220c669a422756;hb=33fae67579eeab31d7f96f9e53f0529f584b0b1f;hpb=03628dbeaf40a9de34b3eb6d5bf6dd34eed8248c diff --git a/src/ngircd/op.c b/src/ngircd/op.c index 64c7e1e1..588513dd 100644 --- a/src/ngircd/op.c +++ b/src/ngircd/op.c @@ -9,7 +9,6 @@ * Please read the file COPYING, README and AUTHORS for more information. */ - #include "portab.h" /** @@ -32,6 +31,7 @@ #include #include "op.h" + /** * Return and log a "no privileges" message. */ @@ -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) { CLIENT *c; @@ -72,13 +78,21 @@ Op_Check(CLIENT * Client, REQUEST * Req) c = Client_Search(Req->prefix); else c = Client; + if (!c) - return false; + return NULL; + if (Client_Type(Client) == CLIENT_SERVER + && Client_Type(c) == CLIENT_SERVER) + return c; if (!Client_HasMode(c, 'o')) - return false; + return NULL; if (!Client_OperByMe(c) && !Conf_AllowRemoteOper) - return false; + return NULL; + /* The client is an local IRC operator, or this server is configured * to trust remote operators. */ - return true; + return c; } /* Op_Check */ + + +/* -eof- */