1
0
Fork 0
mirror of git://git.psyced.org/git/psyced synced 2024-08-15 03:25:10 +00:00

removed interesting but unrecoverable FORK code

This commit is contained in:
psyc://psyced.org/~lynX 2011-01-19 10:47:26 +01:00
parent c3a47f7e0a
commit adafed5817
18 changed files with 13 additions and 1532 deletions

View file

@ -702,7 +702,6 @@ int xmpp_sendmsg(mixed target, string mc, mixed data, mapping vars,
showingLog,otarget);
}
#ifndef FORK
// PSYC-enabled message delivery function
varargs mixed sendmsg(mixed target, string mc, mixed data, vamapping vars,
vamixed source, vaint showingLog, vaclosure callback,
@ -972,196 +971,6 @@ varargs mixed sendmsg(mixed target, string mc, mixed data, vamapping vars,
return 0;
}
#else // FORK {{{
volatile object _psyced;
#define PSYCED (_psyced || _psyced = DAEMON_PATH "psyc" -> load(), _psyced)
object cookie_factory(string uni) { // uni must be lowercase
mixed *u;
string tmp;
object o;
if (o = targets[uni]) return o;
u = parse_uniform(uni);
unless (u) return 0;
switch(u[UScheme]) {
#ifdef PSYC_PATH
case "psyc":
if (o = targets[u[URoot]]) {
P2(("%O to be delivered on %O's circuit\n",
uni, query_ip_name(o) || o ))
register_target(uni, o);
// was delivermsg(
return o;
// no more cleansing of targets mapping.. see also net/library.i
// } else {
// P1(("PSYC/TCP target %O gone!\n", t2))
// m_delete( targets, t2 );
// }
}
return PSYCED;;; // three semicolons because of extra importance
//return psyc_sendmsg(target,mc,data,vars,showingLog,source,u);
#endif
#ifdef JABBER_PATH
case "xmpp":
// actually jabber does not allow other ports
// in the url.. but anyway, here
// comes a jabber implementation which does.
// so you can only use it to debug jabber
// code of other psyceds ;)
//
//tmp = u[UCircuit] || "xmpp:"+ u[UHostPort];
tmp = "xmpp:"+ u[UHostPort];
if (o = targets[tmp]) {
P2(("%O to be delivered on %O\n", uni, o ))
} else {
// we use C:xmpp:host(:port) as an object name
// we can change that if it is confusing
#ifdef QUEUE_WITH_SCHEME
o = ("C:"+tmp)-> circuit(u[UHost], u[UPort]
|| JABBER_S2S_SERVICE, 0, "xmpp-server",
tmp, systemQ);
#else
o = ("C:"+tmp)-> circuit(u[UHost], u[UPort]
|| JABBER_S2S_SERVICE, 0, "xmpp-server",
u[UHostPort], systemQ);
#endif
register_target(tmp, o);
// jabber scheme makes it impossible to
// cohost several servers on one ip#
if (u[UPort])
register_target("xmpp:"+ u[UHost], o);
}
register_target(uni, o);
return o;
//return o->msg(source,mc,data,vars, showingLog,otarget);
#else
/*
case "xmpp":
return source -> w("_error_unavailable_scheme",
"Scheme '[_scheme]' is not available",
([ "_scheme" : "xmpp" ]));
*/
#endif
#ifdef SMTP_PATH
case "mailto":
unless (tmp = legal_mailto(u[UUserAtHost])) {
#if 0
source ->w(
"_error_invalid_mailto",
"Sorry, that doesn't look like a valid email address to me.");
#endif
return 0;
}
o = summon_person(tmp, SMTP_PATH "user");
unless (o) return 0;
register_target(uni, o);
return o;
//o -> msg(source, mc, data, vars);
#endif
}
if (schemes[u[UScheme]])
return schemes[u[UScheme]];
//return schemes[u[UScheme]]->msg(source, mc, data, vars, showingLog, target);
// ifdeffing out isnt the smartest of options, but for now..
#ifndef BRAIN
if (u[UScheme]
# if __EFUN_DEFINED__(regmatch)
&&! regmatch(u[UScheme], "[^a-z0-9]")
# else
&&! sizeof(regexp( ({ u[UScheme] }), "[^a-z0-9]"))
# endif
) {
// current gateway discovery strategy
u = parse_uniform("psyc://"+ u[UScheme] +
".scheme.psyced.org/$"+ u[UScheme] +
"/"+ u[UBody]);
return PSYCED;
//return psyc_sendmsg(target,mc,data,vars,showingLog,source,u);
}
#endif
// TODO
#if 0
source ->pr("_error_unknown_scheme",
"%O is not a supported protocol scheme.\n",
u[UScheme]);
#endif
return 0;
}
varargs int sendmsg(mixed target, string mc, mixed data, mapping vars,
mixed source, int showingLog) { // proto.h!
mixed tmp, *u;
object o;
P3(("sendmsg(%O,%O,%O,..,%O,%O)\n",
target, mc, data, source, showingLog))
#ifdef SANDBOX
// we can't avoid having this check in here, so we better avoid
// having two parallel security systems for the sandbox and thus
// disallow sending psyc messages without using sendmsg()..
// this keeps the sandbox tidy and intelligible :)
//
if (extern_call() && (!geteuid(previous_object())
|| stringp(geteuid(previous_object()))
&& geteuid(previous_object())[0] != '/')) {
unless (source == previous_object()
|| source == vars["_context"]) {
raise_error(sprintf("INVALID SENDMSG by %O(%O) (pretended "
"to be target/context %O/%O\n",
previous_object(),
geteuid(previous_object()),
target,
vars["_context"]));
}
}
#endif
unless (source) source = previous_object();
// target = lower_case(target) ist fuer xmpp nicht
// gut, weil der resource-teil dort case-sensitive
// ist... der node@domain-Part aber nicht
if (stringp(target)) {
int i;
string otarget;
// ist das nicht ein alter hack fuer net/irc?
// wieso issn der in der lib?
if ((i = index(target, '%')) != -1) {
target[i] = '@';
}
otarget = target;
target = lower_case(target);
//D("sendmsg for "+target+"\n");
tmp = cookie_factory(target);
if (tmp) { // && interactive(tmp)) {
PT(("delivery agent %O for %O (%s)\n", tmp, target,
mc || "0"))
return tmp->msg(source, mc, data, vars, showingLog, otarget);
}
// TODO ERROR
}
if (objectp(target)) {
// returnwert sagt aus, ob msg dargestellt werden will
// nicht aber, dass sie erfolgreich angekommen ist, denn das ist ja eh
target -> msg(source, mc, data, vars, showingLog);
// deshalb machen wir das lieber selber klar
return 2;
}
D2(else D(S("sendmsg encountered %O as target for (%O,%s,%O,%O)\n",
target, source, mc, data, vars));)
return 0;
}
#endif // FORK }}}
#ifndef __PIKE__
#ifdef PSYC_PATH