return;
}
- if(!IsOper(source_p))
+ if(!IsOperGeneral(source_p))
{
/* seeing as this is going across servers, we should limit it */
if((last_used + ConfigFileEntry.pace_wait_simple) > rb_current_time() || !ratelimit_client(source_p, 2))
single_whois(struct Client *source_p, struct Client *target_p, int operspy)
{
char buf[BUFSIZE];
- rb_dlink_node *ptr;
- struct membership *msptr;
- struct Channel *chptr;
int cur_len = 0;
int mlen;
char *t;
if (!IsService(target_p))
{
- RB_DLINK_FOREACH(ptr, target_p->user->channel.head)
+ hook_data_channel_visibility hdata_vis;
+ rb_dlink_node *ps, *pt;
+ struct Channel *chptr;
+ struct membership *ms, *mt;
+
+ hdata_vis.client = source_p;
+ hdata_vis.target = target_p;
+
+ ITER_COMM_CHANNELS(ps, pt, source_p->user->channel.head, target_p->user->channel.head, ms, mt, chptr)
{
- msptr = ptr->data;
- chptr = msptr->chptr;
+ if (mt == NULL)
+ continue;
- hdata.chptr = chptr;
+ hdata_vis.chptr = chptr;
+ hdata_vis.clientms = ms;
+ hdata_vis.targetms = mt;
+ hdata_vis.approved = ms != NULL || PubChannel(chptr);
- hdata.approved = ShowChannel(source_p, chptr);
- call_hook(doing_whois_channel_visibility_hook, &hdata);
+ call_hook(doing_whois_channel_visibility_hook, &hdata_vis);
- if(hdata.approved || operspy)
+ if(hdata_vis.approved || operspy)
{
- if((cur_len + strlen(chptr->chname) + 3) > (BUFSIZE - 5))
+ if((cur_len + strlen(chptr->chname) + strlen("!@+ ")) > (BUFSIZE - strlen("\r\n")))
{
sendto_one(source_p, "%s", buf);
cur_len = mlen + extra_space;
}
tlen = sprintf(t, "%s%s%s ",
- hdata.approved ? "" : "!",
- find_channel_status(msptr, 1),
+ hdata_vis.approved ? "" : "!",
+ find_channel_status(mt, 1),
chptr->chname);
t += tlen;
cur_len += tlen;
GlobalSetOptions.operstring));
}
- if(MyClient(target_p) && !EmptyString(target_p->localClient->opername) && IsOper(target_p) && IsOper(source_p))
+ if(!EmptyString(target_p->user->opername) && IsOper(target_p) && (target_p == source_p || HasPrivilege(source_p, "oper:privs")))
{
char buf[512];
+ const char *privset = "(missing)";
+ if (target_p->user->privset != NULL)
+ privset = target_p->user->privset->name;
snprintf(buf, sizeof(buf), "is opered as %s, privset %s",
- target_p->localClient->opername, target_p->localClient->privset->name);
+ target_p->user->opername, privset);
sendto_one_numeric(source_p, RPL_WHOISSPECIAL, form_str(RPL_WHOISSPECIAL),
target_p->name, buf);
}
{
char cbuf[256] = "is using a secure connection";
- if (MyClient(target_p) && target_p->localClient->cipher_string != NULL)
+ if (MyClient(target_p) && target_p->localClient->cipher_string != NULL &&
+ (!ConfigFileEntry.tls_ciphers_oper_only || source_p == target_p || IsOper(source_p)))
rb_snprintf_append(cbuf, sizeof(cbuf), " [%s]", target_p->localClient->cipher_string);
sendto_one_numeric(source_p, RPL_WHOISSECURE, form_str(RPL_WHOISSECURE),
target_p->name, cbuf);
- if((source_p == target_p || IsOper(source_p)) &&
+ if((source_p == target_p || IsOperGeneral(source_p)) &&
target_p->certfp != NULL)
sendto_one_numeric(source_p, RPL_WHOISCERTFP,
form_str(RPL_WHOISCERTFP),
if(MyClient(target_p))
{
- if (IsDynSpoof(target_p) && (IsOper(source_p) || source_p == target_p))
+ if (IsDynSpoof(target_p) && (HasPrivilege(source_p, "auspex:hostname") || source_p == target_p))
{
/* trick here: show a nonoper their own IP if
* dynamic spoofed but not if auth{} spoofed
}
else
{
- if (IsDynSpoof(target_p) && (IsOper(source_p) || source_p == target_p))
+ if (IsDynSpoof(target_p) && (HasPrivilege(source_p, "auspex:hostname") || source_p == target_p))
{
ClearDynSpoof(target_p);
sendto_one_numeric(source_p, RPL_WHOISHOST,