X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fngircd%2Firc-info.c;h=f9c9b0d2423c97b2ed8e2bf596a5f56fa1efa3ca;hb=4b15f10fbb036da96caaf9ffcffd27cd9f6815d2;hp=4909a96a063a3a9940be0e52d9b9e070925a28c9;hpb=1f2aa4da6f62124bdbed4f2dce7e40ed4b411e2a;p=ngircd-alex.git diff --git a/src/ngircd/irc-info.c b/src/ngircd/irc-info.c index 4909a96a..f9c9b0d2 100644 --- a/src/ngircd/irc-info.c +++ b/src/ngircd/irc-info.c @@ -727,7 +727,7 @@ IRC_USERHOST(CLIENT *Client, REQUEST *Req) strlcat(rpl, "+", sizeof(rpl)); strlcat(rpl, Client_User(c), sizeof(rpl)); strlcat(rpl, "@", sizeof(rpl)); - strlcat(rpl, Client_HostnameCloaked(c), sizeof(rpl)); + strlcat(rpl, Client_HostnameDisplayed(c), sizeof(rpl)); strlcat(rpl, " ", sizeof(rpl)); } } @@ -792,7 +792,7 @@ write_whoreply(CLIENT *Client, CLIENT *c, const char *channelname, const char *f { return IRC_WriteStrClient(Client, RPL_WHOREPLY_MSG, Client_ID(Client), channelname, Client_User(c), - Client_HostnameCloaked(c), + Client_HostnameDisplayed(c), Client_ID(Client_Introducer(c)), Client_ID(c), flags, Client_Hops(c), Client_Info(c)); } @@ -893,7 +893,8 @@ IRC_WHO_Channel(CLIENT *Client, CHANNEL *Chan, bool OnlyOps) is_visible = strchr(client_modes, 'i') == NULL; if (is_member || is_visible) { - strcpy(flags, who_flags_status(client_modes)); + strlcpy(flags, who_flags_status(client_modes), + sizeof(flags)); if (is_ircop) strlcat(flags, "*", sizeof(flags)); @@ -950,7 +951,7 @@ IRC_WHO_Mask(CLIENT *Client, char *Mask, bool OnlyOps) if (Mask) { /* Match pattern against user host/server/name/nick */ client_match = MatchCaseInsensitive(Mask, - Client_Hostname(c)); + Client_HostnameDisplayed(c)); if (!client_match) client_match = MatchCaseInsensitive(Mask, Client_ID(Client_Introducer(c))); @@ -987,7 +988,7 @@ IRC_WHO_Mask(CLIENT *Client, char *Mask, bool OnlyOps) if (IRC_CheckListTooBig(Client, count, MAX_RPL_WHO, "WHO")) break; - strcpy(flags, who_flags_status(Client_Modes(c))); + strlcpy(flags, who_flags_status(Client_Modes(c)), sizeof(flags)); if (strchr(Client_Modes(c), 'o')) strlcat(flags, "*", sizeof(flags)); @@ -1080,7 +1081,7 @@ IRC_WHOIS_SendReply(CLIENT *Client, CLIENT *from, CLIENT *c) /* Nick, user, hostname and client info */ if (!IRC_WriteStrClient(from, RPL_WHOISUSER_MSG, Client_ID(from), Client_ID(c), Client_User(c), - Client_HostnameCloaked(c), Client_Info(c))) + Client_HostnameDisplayed(c), Client_Info(c))) return DISCONNECTED; /* Server */ @@ -1132,14 +1133,20 @@ IRC_WHOIS_SendReply(CLIENT *Client, CLIENT *from, CLIENT *c) return DISCONNECTED; } + /* Service? */ + if (Client_Type(c) == CLIENT_SERVICE && + !IRC_WriteStrClient(from, RPL_WHOISSERVICE_MSG, + Client_ID(from), Client_ID(c))) + return DISCONNECTED; + /* IRC-Operator? */ - if (Client_HasMode(c, 'o') && + if (Client_HasMode(c, 'o') && Client_Type(c) != CLIENT_SERVICE && !IRC_WriteStrClient(from, RPL_WHOISOPERATOR_MSG, Client_ID(from), Client_ID(c))) return DISCONNECTED; /* IRC-Bot? */ - if (Client_HasMode(c, 'B') && + if (Client_HasMode(c, 'B') && Client_Type(c) != CLIENT_SERVICE && !IRC_WriteStrClient(from, RPL_WHOISBOT_MSG, Client_ID(from), Client_ID(c))) return DISCONNECTED; @@ -1150,17 +1157,25 @@ IRC_WHOIS_SendReply(CLIENT *Client, CLIENT *from, CLIENT *c) Client_ID(c))) return DISCONNECTED; - /* Registered nick name? */ + /* Registered nickname? */ if (Client_HasMode(c, 'R') && !IRC_WriteStrClient(from, RPL_WHOISREGNICK_MSG, Client_ID(from), Client_ID(c))) return DISCONNECTED; - if (Client_Conn(c) > NONE && (Client_OperByMe(from) || from == c) && - !IRC_WriteStrClient(from, RPL_WHOISHOST_MSG, Client_ID(from), - Client_ID(c), Client_Hostname(c), - Conn_GetIPAInfo(Client_Conn(c)))) - return DISCONNECTED; + /* Local client and requester is the user itself or an IRC Op? */ + if (Client_Conn(c) > NONE && + (from == c || (!Conf_MorePrivacy && Client_HasMode(from, 'o')))) { + /* Client hostname */ + if (!IRC_WriteStrClient(from, RPL_WHOISHOST_MSG, + Client_ID(from), Client_ID(c), Client_Hostname(c), + Conn_GetIPAInfo(Client_Conn(c)))) + return DISCONNECTED; + /* Client modes */ + if (!IRC_WriteStrClient(from, RPL_WHOISMODES_MSG, + Client_ID(from), Client_ID(c), Client_Modes(c))) + return DISCONNECTED; + } /* Idle and signon time (local clients only!) */ if (!Conf_MorePrivacy && Client_Conn(c) > NONE && @@ -1220,7 +1235,7 @@ IRC_WHOIS( CLIENT *Client, REQUEST *Req ) /* Get target server for this command */ if (Req->argc > 1) { /* Search the target server, which can be specified as a - * nick name on that server as well: */ + * nickname on that server as well: */ target = Client_Search(Req->argv[0]); if (!target) return IRC_WriteStrClient(from, ERR_NOSUCHSERVER_MSG, @@ -1253,7 +1268,8 @@ IRC_WHOIS( CLIENT *Client, REQUEST *Req ) */ if (!has_wildcards || is_remote) { c = Client_Search(query); - if (c && Client_Type(c) == CLIENT_USER) { + if (c && (Client_Type(c) == CLIENT_USER + || Client_Type(c) == CLIENT_SERVICE)) { if (!IRC_WHOIS_SendReply(Client, from, c)) return DISCONNECTED; } else {