2 * ngIRCd -- The Next Generation IRC Daemon
3 * Copyright (c)2001-2014 Alexander Barton (alex@barton.de) and Contributors.
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 * Please read the file COPYING, README and AUTHORS for more information.
16 * IRC operator functions
27 #include "irc-write.h"
32 * Return and log a "no privileges" message.
35 Op_NoPrivileges(CLIENT * Client, REQUEST * Req)
40 from = Client_Search(Req->prefix);
43 Log(LOG_NOTICE, "No privileges: client \"%s\" (%s), command \"%s\"!",
44 Req->prefix, Client_Mask(Client), Req->command);
45 return IRC_WriteErrClient(from, ERR_NOPRIVILEGES_MSG,
48 Log(LOG_NOTICE, "No privileges: client \"%s\", command \"%s\"!",
49 Client_Mask(Client), Req->command);
50 return IRC_WriteErrClient(Client, ERR_NOPRIVILEGES_MSG,
53 } /* Op_NoPrivileges */
56 * Check that the originator of a request is an IRC operator and allowed
57 * to administer this server.
59 * @param CLient Client from which the command has been received.
60 * @param Req Request structure.
61 * @return CLIENT structure of the client that initiated the command or
62 * NULL if client is not allowed to execute operator commands.
65 Op_Check(CLIENT * Client, REQUEST * Req)
69 assert(Client != NULL);
72 if (Client_Type(Client) == CLIENT_SERVER && Req->prefix)
73 c = Client_Search(Req->prefix);
79 if (Client_Type(Client) == CLIENT_SERVER
80 && Client_Type(c) == CLIENT_SERVER)
82 if (!Client_HasMode(c, 'o'))
84 if (Client_Conn(c) <= NONE && !Conf_AllowRemoteOper)
87 /* The client is an local IRC operator, or this server is configured
88 * to trust remote operators. */