|
1 | 1 | /*
|
2 |
| -* Q-LINE MODULE: Provides the /QLINE and /UNQLINE commands, allowing O-lined users with the server-ban:gline privs to manually add Q-lines (global nick bans) |
| 2 | +* Q-LINE MODULE: Provides the /QLINE and /UNQLINE commands, allowing O-lined users with the server-ban:gline privs to manually add Q-lines (global nick bans) |
3 | 3 | * at the server level, rather than relying on Services to do so via the /(UN)SQLINE server-only command or config file access.
|
4 | 4 | *
|
5 | 5 | * USAGE:
|
6 |
| -* |
| 6 | +* |
7 | 7 | * Add a new Q-line entry: /QLINE <nickmask> :<Reason>
|
8 | 8 | * Delete an active Q-line entry: /UNQLINE <nickmask>
|
9 | 9 | * -----------------------------------------------------------------------------------------------------------------------------------------------
|
10 | 10 | * MIT License
|
11 |
| -* |
| 11 | +* |
12 | 12 | * Copyright (c) 2022 Avery 'Hexick' Q. [pseudonym]
|
13 |
| -* |
| 13 | +* |
14 | 14 | * Permission is hereby granted, free of charge, to any person obtaining a copy
|
15 | 15 | * of this software and associated documentation files (the "Software"), to deal
|
16 | 16 | * in the Software without restriction, including without limitation the rights
|
17 | 17 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
18 | 18 | * copies of the Software, and to permit persons to whom the Software is
|
19 | 19 | * furnished to do so, subject to the following conditions:
|
20 |
| -* |
| 20 | +* |
21 | 21 | * The above copyright notice and this permission notice shall be included in all
|
22 | 22 | * copies or substantial portions of the Software.
|
23 |
| -* |
| 23 | +* |
24 | 24 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
25 | 25 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
26 | 26 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
@@ -84,57 +84,59 @@ MOD_UNLOAD() {
|
84 | 84 | /* The actual structure of the QLINE command to be performed */
|
85 | 85 | CMD_FUNC(cmd_qline) {
|
86 | 86 | char mo[32];
|
87 |
| - const char *comment = (parc == 3) ? parv[2] : NULL; |
88 |
| - const char *tkllayer[9] = { |
| 87 | + const char* comment = (parc == 3) ? parv[2] : NULL; |
| 88 | + const char* tkllayer[10] = { |
89 | 89 | me.name, /*0 server.name */
|
90 | 90 | "+", /*1 + = X-line add */
|
91 | 91 | "Q", /*2 X-line type */
|
92 | 92 | "*" , /*3 user */
|
93 | 93 | parv[1], /*4 host */
|
94 |
| - client->name, /*5 Who set the ban */ |
| 94 | + client->name, /*5 Who set the ban */ |
95 | 95 | "0", /*6 expire_at; never expire */
|
96 | 96 | NULL, /*7 set_at */
|
97 |
| - "no reason" /*8 default reason */ |
| 97 | + "no reason", /*8 default reason */ |
| 98 | + NULL /*9 Extra NULL element to prevent OOB */ |
98 | 99 | };
|
99 |
| - |
100 |
| - /* Verify privs */ |
101 |
| - if (!ValidatePermissionsForPath("server-ban:gline",client,NULL,NULL,NULL)) { |
| 100 | + |
| 101 | + /* Verify privs */ |
| 102 | + if (!ValidatePermissionsForPath("server-ban:gline", client, NULL, NULL, NULL)) { |
102 | 103 | sendnumeric(client, ERR_NOPRIVILEGES);
|
103 | 104 | return;
|
104 | 105 | }
|
105 |
| - |
106 |
| - /* Ensure the proper number of parameters */ |
| 106 | + |
| 107 | + /* Ensure the proper number of parameters */ |
107 | 108 | if (parc < 2)
|
108 | 109 | return;
|
109 |
| - |
110 |
| - /* Do the thang */ |
| 110 | + |
| 111 | + /* Do the thang */ |
111 | 112 | ircsnprintf(mo, sizeof(mo), "%lld", (long long)TStime());
|
112 | 113 | tkllayer[7] = mo;
|
113 | 114 | tkllayer[8] = comment ? comment : "no reason";
|
114 |
| - cmd_tkl(&me, NULL, 9, tkllayer); |
| 115 | + cmd_tkl(&me, NULL, 10, tkllayer); |
115 | 116 | }
|
116 | 117 |
|
117 | 118 | /* The actual structure of the UNQLINE command to be performed */
|
118 | 119 | CMD_FUNC(cmd_unqline) {
|
119 |
| - const char *tkllayer[6] = { |
| 120 | + const char* tkllayer[7] = { |
120 | 121 | me.name, /*0 server.name */
|
121 | 122 | "-", /*1 - = X-line removed */
|
122 | 123 | "Q", /*2 X-line type */
|
123 | 124 | "*", /*3 unused */
|
124 | 125 | parv[1], /*4 host */
|
125 |
| - client->name /*5 who removed the line */ |
| 126 | + client->name, /*5 who removed the line */ |
| 127 | + NULL /*6 Extra NULL element to prevent OOB */ |
126 | 128 | };
|
127 |
| - |
| 129 | + |
128 | 130 | /* Verify privs */
|
129 |
| - if (!ValidatePermissionsForPath("server-ban:gline",client,NULL,NULL,NULL)) { |
| 131 | + if (!ValidatePermissionsForPath("server-ban:gline", client, NULL, NULL, NULL)) { |
130 | 132 | sendnumeric(client, ERR_NOPRIVILEGES);
|
131 | 133 | return;
|
132 | 134 | }
|
133 |
| - |
| 135 | + |
134 | 136 | /* Ensure the proper number of parameters */
|
135 | 137 | if (parc < 2)
|
136 | 138 | return;
|
137 |
| - |
138 |
| - /* Do the thang */ |
139 |
| - cmd_tkl(&me, NULL, 6, tkllayer); |
| 139 | + |
| 140 | + /* Do the thang */ |
| 141 | + cmd_tkl(&me, NULL, 7, tkllayer); |
140 | 142 | }
|
0 commit comments