]>
Commit | Line | Data |
---|---|---|
1 | # HG changeset patch | |
2 | # Parent 956177bd34a75c9221a0f81bfeb69f769ba7c86f | |
3 | ||
4 | diff -r 956177bd34a7 ircd/m_wallchops.c | |
5 | --- a/ircd/m_wallchops.c Fri Jul 19 22:51:36 2013 +0100 | |
6 | +++ b/ircd/m_wallchops.c Fri Jul 19 22:54:29 2013 +0100 | |
7 | @@ -162,8 +162,7 @@ | |
8 | return 0; | |
9 | ||
10 | if (!IsLocalChannel(parv[1]) && (chptr = FindChannel(parv[1]))) { | |
11 | - if (client_can_send_to_channel(sptr, chptr, 0) && !(chptr->mode.mode & MODE_NONOTICE)) { | |
12 | - RevealDelayedJoinIfNeeded(sptr, chptr); | |
13 | + if (client_can_send_to_channel(sptr, chptr, 1)) { | |
14 | sendcmdto_channel_butone(sptr, CMD_WALLCHOPS, chptr, cptr, | |
15 | SKIP_DEAF | SKIP_BURST | SKIP_NONOPS, | |
16 | "%H :%s", chptr, parv[parc - 1]); | |
17 | diff -r 956177bd34a7 ircd/m_wallvoices.c | |
18 | --- a/ircd/m_wallvoices.c Fri Jul 19 22:51:36 2013 +0100 | |
19 | +++ b/ircd/m_wallvoices.c Fri Jul 19 22:54:29 2013 +0100 | |
20 | @@ -161,8 +161,7 @@ | |
21 | return 0; | |
22 | ||
23 | if (!IsLocalChannel(parv[1]) && (chptr = FindChannel(parv[1]))) { | |
24 | - if (client_can_send_to_channel(sptr, chptr, 0) && !(chptr->mode.mode & MODE_NONOTICE)) { | |
25 | - RevealDelayedJoinIfNeeded(sptr, chptr); | |
26 | + if (client_can_send_to_channel(sptr, chptr, 1)) { | |
27 | sendcmdto_channel_butone(sptr, CMD_WALLVOICES, chptr, cptr, | |
28 | SKIP_DEAF | SKIP_BURST | SKIP_NONVOICES, | |
29 | "%H :%s", chptr, parv[parc - 1]); | |
30 | diff -r 956177bd34a7 ircd/s_auth.c | |
31 | --- a/ircd/s_auth.c Fri Jul 19 22:51:36 2013 +0100 | |
32 | +++ b/ircd/s_auth.c Fri Jul 19 22:54:29 2013 +0100 | |
33 | @@ -1940,9 +1940,9 @@ | |
34 | if (*end2 == ':') | |
35 | cli_user(cli)->acc_flags = strtoull(end2 + 1, NULL, 10); | |
36 | } | |
37 | + params[0][len] = '\0'; | |
38 | } | |
39 | ||
40 | - | |
41 | /* Copy account name to User structure. */ | |
42 | ircd_strncpy(cli_user(cli)->account, params[0], ACCOUNTLEN); | |
43 | SetAccount(cli); | |
44 | diff -r 956177bd34a7 ircd/s_user.c | |
45 | --- a/ircd/s_user.c Fri Jul 19 22:51:36 2013 +0100 | |
46 | +++ b/ircd/s_user.c Fri Jul 19 22:54:29 2013 +0100 | |
47 | @@ -485,6 +485,7 @@ | |
48 | NumNick(sptr), cli_info(sptr)); | |
49 | ||
50 | tmpstr = umode_str(sptr, UMODE_ALL_PARAMS); | |
51 | + | |
52 | /* Send oper name and full IP address to IPv6-grokking servers. */ | |
53 | sendcmdto_flagarray_serv_butone(user->server, CMD_NICK, cptr, | |
54 | ipv6andopername, 2, NULL, 0, | |
55 | @@ -570,7 +571,6 @@ | |
56 | const char* nick, int parc, char* parv[]) | |
57 | { | |
58 | if (IsServer(sptr)) { | |
59 | - | |
60 | /* | |
61 | * A server introducing a new client, change source | |
62 | */ | |
63 | @@ -749,6 +749,10 @@ | |
64 | assert(cli_local(sptr)); | |
65 | targets = cli_targets(sptr); | |
66 | ||
67 | + /* opers always have a free target */ | |
68 | + if (IsAnOper(sptr)) | |
69 | + return 0; | |
70 | + | |
71 | /* | |
72 | * Same target as last time? | |
73 | */ | |
74 | @@ -846,6 +850,12 @@ | |
75 | } | |
76 | if (is_silenced(source, dest)) | |
77 | return 0; | |
78 | + | |
79 | + if (IsAccountOnly(dest) && !IsAccount(source) && !IsXtraOp(source)) { | |
80 | + if(!is_notice) | |
81 | + send_reply(source, ERR_ACCOUNTONLY, cli_name(source), feature_str(FEAT_URLREG)); | |
82 | + return 0; | |
83 | + } | |
84 | ||
85 | if (is_notice) | |
86 | sendcmdto_one(source, CMD_NOTICE, dest, "%C :%s", dest, text); | |
87 | @@ -966,10 +976,6 @@ | |
88 | if (MyConnect(cptr)) | |
89 | send_reply(cptr, RPL_HOSTHIDDEN, cli_user(cptr)->host); | |
90 | ||
91 | - /* opers always have a free target */ | |
92 | - if (IsAnOper(sptr)) | |
93 | - return 0; | |
94 | - | |
95 | /* | |
96 | * Go through all channels the client was on, rejoin him | |
97 | * and set the modes, if any | |
98 | @@ -1042,17 +1048,30 @@ | |
99 | /* MODE_ADD: set a new hostmask */ | |
100 | } else { | |
101 | /* chop up ident and host.cc */ | |
102 | - if ((host = strrchr(hostmask, '@'))) /* oper can specifiy ident@host.cc */ | |
103 | + if ((host = strrchr(hostmask, '@'))) { /* oper can specifiy ident@host.cc */ | |
104 | *host++ = '\0'; | |
105 | - else /* user can only specifiy host.cc [password] */ | |
106 | + if ( MyConnect(cptr) && (0 == strcmp(host, cli_user(cptr)->host)) && (0 == strcmp(hostmask, cli_user(cptr)->username))) { | |
107 | + ircd_snprintf(0, hiddenhost, HOSTLEN + USERLEN + 2, "%s@%s", | |
108 | + cli_user(cptr)->username, cli_user(cptr)->host); | |
109 | + send_reply(cptr, RPL_HOSTHIDDEN, hiddenhost); | |
110 | + return 0; | |
111 | + } | |
112 | + } else { /* user can only specifiy host.cc [password] */ | |
113 | host = hostmask; | |
114 | + if ( MyConnect(cptr) && (0 == strcmp(host, cli_user(cptr)->host))) { | |
115 | + ircd_snprintf(0, hiddenhost, HOSTLEN + USERLEN + 2, "%s@%s", | |
116 | + cli_user(cptr)->username, cli_user(cptr)->host); | |
117 | + send_reply(cptr, RPL_HOSTHIDDEN, hiddenhost); | |
118 | + return 0; | |
119 | + } | |
120 | + } | |
121 | /* | |
122 | * Oper sethost | |
123 | */ | |
124 | if (MyConnect(cptr)) { | |
125 | if (IsAnOper(cptr)) { | |
126 | if ((new_vhost = IsVhost(host, 1)) == NULL) { | |
127 | - if (!feature_bool(FEAT_SETHOST_FREEFORM)) { | |
128 | + if (!HasPriv(cptr, PRIV_FREEFORM)) { | |
129 | send_reply(cptr, ERR_HOSTUNAVAIL, hostmask); | |
130 | log_write(LS_SETHOST, L_INFO, LOG_NOSNOTICE, | |
131 | "SETHOST (%s@%s) by (%#R): no such s-line", | |
132 | @@ -1167,10 +1186,10 @@ | |
133 | "%H", chan->channel); | |
134 | } | |
135 | if (IsChanOp(chan) && HasVoice(chan)) { | |
136 | - sendcmdto_channel_butserv_butone(&me, CMD_MODE, chan->channel, cptr, 0, | |
137 | + sendcmdto_channel_butserv_butone(&his, CMD_MODE, chan->channel, cptr, 0, | |
138 | "%H +ov %C %C", chan->channel, cptr, cptr); | |
139 | } else if (IsChanOp(chan) || HasVoice(chan)) { | |
140 | - sendcmdto_channel_butserv_butone(&me, CMD_MODE, chan->channel, cptr, 0, | |
141 | + sendcmdto_channel_butserv_butone(&his, CMD_MODE, chan->channel, cptr, 0, | |
142 | "%H +%c %C", chan->channel, IsChanOp(chan) ? 'o' : 'v', cptr); | |
143 | } | |
144 | } | |
145 | @@ -1201,11 +1220,15 @@ | |
146 | unsigned int tmpmask = 0; | |
147 | int snomask_given = 0; | |
148 | char buf[BUFSIZE]; | |
149 | + char *hostmask, *password; | |
150 | int prop = 0; | |
151 | int do_host_hiding = 0; | |
152 | int do_set_host = 0; | |
153 | + size_t opernamelen; | |
154 | + char *opername = 0; | |
155 | char* account = NULL; | |
156 | ||
157 | + hostmask = password = NULL; | |
158 | what = MODE_ADD; | |
159 | ||
160 | if (parc < 3) | |
161 | @@ -1367,8 +1390,8 @@ | |
162 | break; | |
163 | case 'x': | |
164 | if (what == MODE_ADD) | |
165 | - do_host_hiding = 1; | |
166 | - break; | |
167 | + do_host_hiding = 1; | |
168 | + break; | |
169 | case 'h': | |
170 | if (what == MODE_ADD) { | |
171 | if (*(p + 1) && is_hostmask(*(p + 1))) { | |
172 | @@ -1393,13 +1416,6 @@ | |
173 | password = NULL; | |
174 | } | |
175 | break; | |
176 | - case 'r': | |
177 | - if (*(p + 1) && (what == MODE_ADD)) { | |
178 | - account = *(++p); | |
179 | - SetAccount(sptr); | |
180 | - } | |
181 | - /* There is no -r */ | |
182 | - break; | |
183 | case 'R': | |
184 | if (what == MODE_ADD) | |
185 | SetAccountOnly(sptr); | |
186 | @@ -1412,6 +1428,13 @@ | |
187 | else | |
188 | ClearParanoid(sptr); | |
189 | break; | |
190 | + case 'r': | |
191 | + if ((what == MODE_ADD) && *(p + 1)) { | |
192 | + account = *(++p); | |
193 | + SetAccount(sptr); | |
194 | + } | |
195 | + /* There is no -r */ | |
196 | + break; | |
197 | default: | |
198 | send_reply(sptr, ERR_UMODEUNKNOWNFLAG, *m); | |
199 | break; | |
200 | @@ -1436,13 +1459,13 @@ | |
201 | */ | |
202 | if (!FlagHas(&setflags, FLAG_CHSERV) && !(IsOper(sptr) && HasPriv(sptr, PRIV_CHANSERV))) | |
203 | ClearChannelService(sptr); | |
204 | - if (!FlagHas(&setflags, FLAG_XTRAOP) && !(IsOper(sptr) && HasPriv(sptr, PRIV_XTRA_OPER))) | |
205 | + if (!FlagHas(&setflags, FLAG_XTRAOP) && !(IsOper(sptr) && HasPriv(sptr, PRIV_XTRA_OPER))) | |
206 | ClearXtraOp(sptr); | |
207 | if (!FlagHas(&setflags, FLAG_NOCHAN) && !(IsOper(sptr) || feature_bool(FEAT_USER_HIDECHANS))) | |
208 | ClearNoChan(sptr); | |
209 | - if (!FlagHas(&setflags, FLAG_NOIDLE) && !((IsOper(sptr) && HasPriv(sptr, PRIV_NOIDLE)) || feature_bool(FEAT_USER_HIDEIDLETIME))) | |
210 | + if (!FlagHas(&setflags, FLAG_NOIDLE) && !((IsOper(sptr) && HasPriv(sptr, PRIV_NOIDLE)) || feature_bool(FEAT_USER_HIDEIDLETIME))) | |
211 | ClearNoIdle(sptr); | |
212 | - if (!FlagHas(&setflags, FLAG_PARANOID) && !(IsOper(sptr) && HasPriv(sptr, PRIV_PARANOID))) | |
213 | + if (!FlagHas(&setflags, FLAG_PARANOID) && !(IsOper(sptr) && HasPriv(sptr, PRIV_PARANOID))) | |
214 | ClearParanoid(sptr); | |
215 | ||
216 | /* | |
217 | @@ -1498,6 +1521,12 @@ | |
218 | } | |
219 | if (!FlagHas(&setflags, FLAG_HIDDENHOST) && do_host_hiding && allow_modes != ALLOWMODES_DEFAULT) | |
220 | hide_hostmask(sptr, FLAG_HIDDENHOST); | |
221 | + if (do_set_host) { | |
222 | + /* We clear the flag in the old mask, so that the +h will be sent */ | |
223 | + /* Only do this if we're SETTING +h and it succeeded */ | |
224 | + if (set_hostmask(sptr, hostmask, password) && hostmask) | |
225 | + FlagClr(&setflags, FLAG_SETHOST); | |
226 | + } | |
227 | ||
228 | if (IsRegistered(sptr)) { | |
229 | if (!FlagHas(&setflags, FLAG_OPER) && IsOper(sptr)) { | |
230 | @@ -1521,7 +1550,18 @@ | |
231 | /* user no longer oper */ | |
232 | assert(UserStats.opers > 0); | |
233 | --UserStats.opers; | |
234 | - | |
235 | + | |
236 | + /* notify my operators an operator has deOPERed on the network - wiebe */ | |
237 | + if (MyConnect(sptr)) { | |
238 | + sendto_opmask_butone(0, SNO_OLDSNO, "%s (%s@%s) is no longer operator (O) as %s", | |
239 | + cli_name(sptr), cli_user(sptr)->realusername, cli_user(sptr)->realhost, | |
240 | + cli_user(sptr)->opername ? cli_user(sptr)->opername : "<unknown>"); | |
241 | + } else { | |
242 | + sendto_opmask_butone(0, SNO_OLDSNO, "%s (%s@%s) is no longer operator (O) as %s on %s", | |
243 | + cli_name(sptr), cli_user(sptr)->realusername, cli_user(sptr)->realhost, | |
244 | + cli_user(sptr)->opername ? cli_user(sptr)->opername : "<unknown>", cli_name(cli_user(sptr)->server)); | |
245 | + } | |
246 | + | |
247 | client_set_privs(sptr, NULL); /* will clear propagate privilege */ | |
248 | if (cli_user(sptr)->opername) { | |
249 | MyFree(cli_user(sptr)->opername); | |
250 | @@ -1589,7 +1629,6 @@ | |
251 | cli_user(cptr)->account, cli_user(cptr)->acc_create, | |
252 | cli_user(cptr)->acc_id, cli_user(cptr)->acc_flags); | |
253 | ||
254 | - | |
255 | while ((*m++ = *t++)) | |
256 | ; /* Empty loop */ | |
257 | ||
258 | @@ -1695,6 +1734,7 @@ | |
259 | char* t = cli_user(sptr)->opername; | |
260 | while ((*m++ = *t++)) | |
261 | ; /* Empty loop */ | |
262 | + m--; /* Step back over the '\0' */ | |
263 | } else { | |
264 | *m++ = NOOPERNAMECHARACTER; | |
265 | } |