2 * ngIRCd -- The Next Generation IRC Daemon
3 * Copyright (c)2001-2018 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_ERR|LOG_snotice,
44 "No privileges: client \"%s\" (%s), command \"%s\"!",
45 Req->prefix, Client_Mask(Client), Req->command);
46 return IRC_WriteErrClient(from, ERR_NOPRIVILEGES_MSG,
49 Log(LOG_ERR|LOG_snotice,
50 "No privileges: client \"%s\", command \"%s\"!",
51 Client_Mask(Client), Req->command);
52 return IRC_WriteErrClient(Client, ERR_NOPRIVILEGES_MSG,
55 } /* Op_NoPrivileges */
58 * Check that the originator of a request is an IRC operator and allowed
59 * to administer this server.
61 * @param Client Client from which the command has been received.
62 * @param Req Request structure.
63 * @return CLIENT structure of the client that initiated the command or
64 * NULL if client is not allowed to execute operator commands.
67 Op_Check(CLIENT * Client, REQUEST * Req)
71 assert(Client != NULL);
74 if (Client_Type(Client) == CLIENT_SERVER && Req->prefix)
75 c = Client_Search(Req->prefix);
81 if (Client_Type(Client) == CLIENT_SERVER
82 && Client_Type(c) == CLIENT_SERVER)
84 if (!Client_HasMode(c, 'o'))
86 if (Client_Conn(c) <= NONE && !Conf_AllowRemoteOper)
89 /* The client is an local IRC operator, or this server is configured
90 * to trust remote operators. */