From 9f9bdc4e2093ce6708ae44480df4f3c83757593e Mon Sep 17 00:00:00 2001 From: "psyc://psyced.org/~lynX" <@> Date: Sun, 31 Jul 2011 10:46:36 +0200 Subject: [PATCH] should we do NAMEPREP automatically? --- world/net/jabber/gateway.c | 1 + world/net/jabber/jabber.h | 1 + world/net/jabber/user.c | 1 + world/net/library.i | 9 ++++++--- world/net/psyc/circuit.c | 6 +++--- world/net/psyc/parse.i | 2 +- world/net/spyc/circuit.c | 8 ++++---- world/net/spyc/dispatch.i | 2 +- 8 files changed, 18 insertions(+), 12 deletions(-) diff --git a/world/net/jabber/gateway.c b/world/net/jabber/gateway.c index 3a4a986..6979250 100644 --- a/world/net/jabber/gateway.c +++ b/world/net/jabber/gateway.c @@ -298,6 +298,7 @@ jabberMsg(XMLNode node) { sendmsg(origin, "_dialback_request_verify", 0, ([ "_INTERNAL_target_jabber" : source, + // we shouldnt have to NAMEPREP a static string.. FIXME "_INTERNAL_source_jabber" : NAMEPREP(_host_XMPP), "_dialback_key" : node[Cdata], "_tag" : streamid diff --git a/world/net/jabber/jabber.h b/world/net/jabber/jabber.h index 6232722..b836c11 100644 --- a/world/net/jabber/jabber.h +++ b/world/net/jabber/jabber.h @@ -86,6 +86,7 @@ virtual inherit JABBER_PATH "common"; // net/jabber is not ready for regular is_localhost #define is_localhost(a) (lower_case(a)) == _host_XMPP +// but.. what about NAMEPREP here? #define JABSOURCE "_INTERNAL_source_jabber" diff --git a/world/net/jabber/user.c b/world/net/jabber/user.c index 4f43422..e72c742 100644 --- a/world/net/jabber/user.c +++ b/world/net/jabber/user.c @@ -277,6 +277,7 @@ logon() { #endif nodeHandler = #'jabberMsg; set_prompt(""); + // we shouldn't have to NAMEPREP our SERVER_HOST for each new user.. FIXME myjid = NODEPREP(MYLOWERNICK) +"@" + NAMEPREP(SERVER_HOST); myjidresource = myjid +"/"+ RESOURCEPREP(resource); P2(("%O ready to rumble (%O)\n", myjidresource, ME)) diff --git a/world/net/library.i b/world/net/library.i index 26d57c6..328135d 100644 --- a/world/net/library.i +++ b/world/net/library.i @@ -132,6 +132,8 @@ static varargs void ready_freddie(vamixed ip) { static void create() { PROTECT("CREATE") + string t; + #ifndef __PIKE__ master = previous_object(); restore_object(DATA_PATH "library"); @@ -259,9 +261,10 @@ static void create() { #ifdef JABBER_PATH register_target("xmpp:"+ myLowerCaseHost); # ifdef _host_XMPP - register_localhost(lower_case(_host_XMPP)); - register_target(lower_case(_host_XMPP)); - register_target("xmpp:"+ lower_case(_host_XMPP)); + t = NAMEPREP(_host_XMPP); + register_localhost(t); + register_target(t); + register_target("xmpp:"+ t); # endif #endif // base64decode("test2000"); diff --git a/world/net/psyc/circuit.c b/world/net/psyc/circuit.c index e35d28b..0f82c61 100644 --- a/world/net/psyc/circuit.c +++ b/world/net/psyc/circuit.c @@ -225,8 +225,8 @@ int logon(int neverfails) { P1(("%O believing dNSName %O\n", ME, m)) // probably also: register_target? // but be careful never to register_target wildcards - if (stringp(m)) sAuthenticated(NAMEPREP(m)); - else foreach(t : m) sAuthenticated(NAMEPREP(t)); + if (stringp(m)) sAuthenticated(m); + else foreach(t : m) sAuthenticated(t); } //#ifdef _flag_allow_certificate_name_common // to be switched this year # ifndef _flag_disallow_certificate_name_common @@ -235,7 +235,7 @@ int logon(int neverfails) { // note: CN is deprecated for good reasons. else if (t = cert["2.5.4.3"]) { P1(("%O believing CN %O\n", ME, t)) - sAuthenticated(NAMEPREP(t)); + sAuthenticated(t); } # endif if (m = tls_query_connection_info(ME)) { diff --git a/world/net/psyc/parse.i b/world/net/psyc/parse.i index 94c7dd3..27b5e5d 100644 --- a/world/net/psyc/parse.i +++ b/world/net/psyc/parse.i @@ -598,7 +598,7 @@ vamixed getdata(string a) { #else # ifdef PSYC_TCP // Authenticated - } else if (qAuthenticated(NAMEPREP(u[UHost]))) { + } else if (qAuthenticated(u[UHost])) { if (u[UTransport] && (u[UTransport] != # if __EFUN_DEFINED__(tls_query_connection_state) tls_query_connection_state() ? "s" : diff --git a/world/net/spyc/circuit.c b/world/net/spyc/circuit.c index a9a053a..4fb1cf3 100644 --- a/world/net/spyc/circuit.c +++ b/world/net/spyc/circuit.c @@ -120,10 +120,10 @@ int logon(int failure) { // probably also: register_target? // but be careful never to register_target wildcards if (stringp(m)) - sAuthenticated(NAMEPREP(m)); + sAuthenticated(m); else foreach(t : m) - sAuthenticated(NAMEPREP(t)); + sAuthenticated(t); } //#ifdef _flag_allow_certificate_name_common // to be switched this year #ifndef _flag_disallow_certificate_name_common @@ -132,7 +132,7 @@ int logon(int failure) { // note: CN is deprecated for good reasons. else if (t = cert["2.5.4.3"]) { P1(("%O believing CN %O\n", ME, t)) - sAuthenticated(NAMEPREP(t)); + sAuthenticated(t); } #endif if (m = tls_query_connection_info(ME)) { @@ -224,7 +224,7 @@ void circuit_msg(string mc, mapping vars, string data) { return; } u = parse_uniform(vars["_uniform_source"]); - u[UHost] = NAMEPREP(u[UHost]); + // qAuthenticated does that:u[UHost] = NAMEPREP(u[UHost]); if (qAuthenticated(u[UHost])) { // possibly different _uniform_target only if (flags & TCP_PENDING_TIMEOUT) { diff --git a/world/net/spyc/dispatch.i b/world/net/spyc/dispatch.i index 8a7026e..818693e 100644 --- a/world/net/spyc/dispatch.i +++ b/world/net/spyc/dispatch.i @@ -163,7 +163,7 @@ void dispatch(mapping rvars, mapping evars, mixed method, mixed body) { } #ifdef USE_VERIFICATION # ifdef PSYC_TCP - unless (qAuthenticated(NAMEPREP(u[UHost]))) { + unless (qAuthenticated(u[UHost])) { DISPATCHERROR("non-authenticated host\n") } # else