2 * ngIRCd -- The Next Generation IRC Daemon
3 * Copyright (c)2001-2013 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
29 #include "irc-write.h"
36 * Return and log a "no privileges" message.
39 Op_NoPrivileges(CLIENT * Client, REQUEST * Req)
44 from = Client_Search(Req->prefix);
47 Log(LOG_NOTICE, "No privileges: client \"%s\" (%s), command \"%s\"!",
48 Req->prefix, Client_Mask(Client), Req->command);
49 return IRC_WriteErrClient(from, ERR_NOPRIVILEGES_MSG,
52 Log(LOG_NOTICE, "No privileges: client \"%s\", command \"%s\"!",
53 Client_Mask(Client), Req->command);
54 return IRC_WriteErrClient(Client, ERR_NOPRIVILEGES_MSG,
57 } /* Op_NoPrivileges */
60 * Check that the originator of a request is an IRC operator and allowed
61 * to administer this server.
63 * @param CLient Client from which the command has been received.
64 * @param Req Request structure.
65 * @return CLIENT structure of the client that initiated the command or
66 * NULL if client is not allowed to execute operator commands.
69 Op_Check(CLIENT * Client, REQUEST * Req)
73 assert(Client != NULL);
76 if (Client_Type(Client) == CLIENT_SERVER && Req->prefix)
77 c = Client_Search(Req->prefix);
83 if (Client_Type(Client) == CLIENT_SERVER
84 && Client_Type(c) == CLIENT_SERVER)
86 if (!Client_HasMode(c, 'o'))
88 if (Client_Conn(c) <= NONE && !Conf_AllowRemoteOper)
91 /* The client is an local IRC operator, or this server is configured
92 * to trust remote operators. */