thx tg.. is_localhost() was being used very inconsistently

This commit is contained in:
psyc://psyced.org/~lynX 2010-02-26 21:56:20 +01:00
parent 446a3006a8
commit dcbee7a64e
8 changed files with 10 additions and 9 deletions

View File

@ -426,7 +426,7 @@ msg(source, mc, data, vars) {
// and have it replaced by object.. but that's not the case // and have it replaced by object.. but that's not the case
// we _could_ however do that by using _uniform_trustee // we _could_ however do that by using _uniform_trustee
// and doing is_localhost on all _uniform's at parsing time // and doing is_localhost on all _uniform's at parsing time
if (is_localhost(u[UHost])) trustee_nick = u[UNick]; if (is_localhost(lower_case(u[UHost]))) trustee_nick = u[UNick];
} }
if (get_trust(trustee_nick, 0) < MINIMUM_TRUST) return 1; if (get_trust(trustee_nick, 0) < MINIMUM_TRUST) return 1;
// entweder trustee ist ein local nick, dann kriegen wir den // entweder trustee ist ein local nick, dann kriegen wir den

View File

@ -658,7 +658,7 @@ int xmpp_sendmsg(mixed target, string mc, mixed data, mapping vars,
if (o = targets[tmp]) { if (o = targets[tmp]) {
P2(("%O to be delivered on %O\n", P2(("%O to be delivered on %O\n",
otarget, o )) otarget, o ))
} else if (is_localhost(u[UHost])) { } else if (is_localhost(lower_case(u[UHost]))) {
unless (u[UUser]) { unless (u[UUser]) {
P0(("Intercepted %O to %O from %O\n", mc, target, source)) P0(("Intercepted %O to %O from %O\n", mc, target, source))
// 0 makes sendmsg try to relay via xmpp.scheme.psyced.org // 0 makes sendmsg try to relay via xmpp.scheme.psyced.org

View File

@ -2525,7 +2525,7 @@ logon(host) {
&& mode[PPL_NOTIFY] >= PPL_NOTIFY_FRIEND) continue; && mode[PPL_NOTIFY] >= PPL_NOTIFY_FRIEND) continue;
if (u = parse_uniform(ni)) { if (u = parse_uniform(ni)) {
// <lynX> first we change the ppl, then we need this code // <lynX> first we change the ppl, then we need this code
// if (is_localhost(u[UHost])) { // if (is_localhost(lower_case(u[UHost]))) {
// o = summon_person(u[UNick]); // o = summon_person(u[UNick]);
// insert_member(o); // insert_member(o);
// } else { // } else {

View File

@ -411,6 +411,7 @@ int psyc_sendmsg(mixed target, string mc, mixed data, mapping vars,
unless (buf) return 0; unless (buf) return 0;
#endif /* NEW_RENDER */ #endif /* NEW_RENDER */
// host seems to already be in lower_case
if (is_localhost(host)) return send_udp(host, port, buf); if (is_localhost(host)) return send_udp(host, port, buf);
PT(("dns_resolve + send_udp %O:%O packet:\n%s", host,port,buf)) PT(("dns_resolve + send_udp %O:%O packet:\n%s", host,port,buf))
dns_resolve(host, (: if (stringp($1)) dns_resolve(host, (: if (stringp($1))

View File

@ -983,8 +983,8 @@ protected int deliver(mixed ip, string host, string mc, string buffer, mapping c
cvars["_INTERNAL_nick_target"] = u[UNick]; cvars["_INTERNAL_nick_target"] = u[UNick];
#endif #endif
P3(("DEBUG: is_localhost is %O for %O of %O\n", P3(("DEBUG: is_localhost is %O for %O of %O\n",
is_localhost(u[UHost]), u[UHost], u)) is_localhost(lower_case(u[UHost])), u[UHost], u))
unless (is_localhost(u[UHost])) { unless (is_localhost(lower_case(u[UHost]))) {
if (trustworthy > 7) { if (trustworthy > 7) {
P1(("RELAYING permitted for %O to %O (%O)\n", P1(("RELAYING permitted for %O to %O (%O)\n",
source, t, ME)) source, t, ME))

View File

@ -107,7 +107,7 @@ parseUDP(ip, port, msg) {
send_udp(ip, port, reply); send_udp(ip, port, reply);
return; return;
} }
islocaltarget = is_localhost(tu[UHost]); islocaltarget = is_localhost(lower_case(tu[UHost]));
// TODO this may be either local or remote users // TODO this may be either local or remote users
if (islocaltarget && tu[UUser]) target = find_person(tu[UUser]); if (islocaltarget && tu[UUser]) target = find_person(tu[UUser]);
// TODO works only for online users // TODO works only for online users
@ -156,7 +156,7 @@ parseUDP(ip, port, msg) {
su = parse_uniform(source); su = parse_uniform(source);
source = 0; source = 0;
#if 0 #if 0
if (is_localhost(su[UHost])) { if (is_localhost(lower_case(su[UHost]))) {
object o; object o;
o = find_person(su[UUser]); o = find_person(su[UUser]);
// TODO: check that source is coming from // TODO: check that source is coming from

View File

@ -235,7 +235,7 @@ void circuit_msg(string mc, mapping vars, string data) {
if (tls_query_connection_state(ME) == 0) { if (tls_query_connection_state(ME) == 0) {
array(string) targethosts = ({ }); array(string) targethosts = ({ });
foreach(string ho : vars["_list_targets_hosts"]) { foreach(string ho : vars["_list_targets_hosts"]) {
if (is_localhost(ho)) { if (is_localhost(lower_case(ho))) {
targethosts += ({ ho }); targethosts += ({ ho });
} }
} }

View File

@ -49,7 +49,7 @@ void dispatch(mixed header_vars, mixed varops, mixed method, mixed body) {
DISPATCHERROR("target is not an uniform\n") DISPATCHERROR("target is not an uniform\n")
} }
// FIXME relaying support here? // FIXME relaying support here?
if (!is_localhost(u[UHost])) { if (!is_localhost(local_host(u[UHost]))) {
DISPATCHERROR("target is not configured on this server\n") DISPATCHERROR("target is not configured on this server\n")
} }
} }