mirror of
git://git.psyced.org/git/psyced
synced 2024-08-15 03:25:10 +00:00
things that happened in 2008
This commit is contained in:
parent
8f98522570
commit
94530cc322
136 changed files with 3222 additions and 2873 deletions
|
@ -1,6 +1,7 @@
|
|||
// vim:foldmethod=marker:syntax=lpc:noexpandtab
|
||||
// $Id: active.c,v 1.40 2008/02/20 14:03:30 fippo Exp $
|
||||
// $Id: active.c,v 1.41 2008/06/17 09:35:45 lynx Exp $
|
||||
//
|
||||
#include "common.h"
|
||||
#include <net.h>
|
||||
#include <services.h>
|
||||
|
||||
|
|
|
@ -1,5 +1,17 @@
|
|||
// vim:foldmethod=marker:syntax=lpc:noexpandtab
|
||||
// $Id: circuit.c,v 1.189 2008/03/29 20:36:44 lynx Exp $
|
||||
//
|
||||
// The PSYC Circuit Implementation.
|
||||
// Includes renderers and parsers for the PSYC syntax.
|
||||
//
|
||||
// $Id: circuit.c,v 1.202 2008/12/04 14:20:53 lynx Exp $
|
||||
|
||||
// local debug messages - turn them on by using psyclpc -DDcircuit=<level>
|
||||
#ifdef Dcircuit
|
||||
# undef DEBUG
|
||||
# define DEBUG Dcircuit
|
||||
#endif
|
||||
|
||||
#include "common.h"
|
||||
#include <net.h>
|
||||
#include <services.h>
|
||||
#include <person.h>
|
||||
|
@ -79,7 +91,7 @@ int greet() {
|
|||
// I would like to change that into old list-syntax again.. or lets implement
|
||||
// this @_var stuff.. this damages my brain
|
||||
# define SCHEMES ":_understand_schemes\taim;icq;irc;efnet;euirc;" \
|
||||
"freenode;quakenet;galaxynetwork;xentonix;klingons\n"
|
||||
"freenode;quakenet;galaxynetwork;klingons\n"
|
||||
# define TSCHEMES "Gateways provided: [_understand_schemes].\n"
|
||||
# else
|
||||
# define SCHEMES ""
|
||||
|
@ -187,7 +199,7 @@ static varargs int block(vastring mc, vastring reason) {
|
|||
// saying no.. but it's better to do it differently..
|
||||
P0(("Circuit blocked TCP PSYC connection from %O in %O (%O).\n",
|
||||
query_ip_number(ME), ME, mc))
|
||||
#ifdef EXPERIMENTAL
|
||||
#ifdef DEVELOPMENT
|
||||
unless (ME)
|
||||
raise_error("blocked destructed object?\n");
|
||||
unless (interactive(ME))
|
||||
|
@ -234,16 +246,18 @@ int logon(int neverfails) {
|
|||
}
|
||||
|
||||
#ifdef __TLS__
|
||||
# ifdef EXPERIMENTAL
|
||||
# ifdef GAMMA
|
||||
sAuthHosts(([ ])); // reset authhosts
|
||||
if (tls_available() && tls_query_connection_state(ME) == 1 && mappingp(cert = tls_certificate(ME, 0))) {
|
||||
if (cert[0] != 0) {
|
||||
// log error 17 + cert here
|
||||
// and goodbye.
|
||||
// log error 17 or 18 + cert here
|
||||
P0(("%O encountered a cert verify error %O in %O\n", ME,
|
||||
cert[0], cert))
|
||||
// and goodbye.
|
||||
# ifdef _flag_enable_certificate_any
|
||||
remove_interactive(ME);
|
||||
return 0;
|
||||
# endif
|
||||
}
|
||||
if (m = cert["2.5.29.17:dNSName"]) {
|
||||
// FIXME: this does not yet handle wildcard DNS names
|
||||
|
@ -334,17 +348,27 @@ int logon(int neverfails) {
|
|||
varargs int msg(string source, string mc, string data,
|
||||
mapping vars, vaint showingLog, vamixed target) {
|
||||
string buf, context;
|
||||
mixed rc;
|
||||
|
||||
#ifdef __TLS__
|
||||
P2(( (tls_query_connection_state() ? "TLS": "TCP") +
|
||||
"[%s] <= %s: %s %O\n", peeraddr || "error",
|
||||
to_string(source), mc || "-", data))
|
||||
// to_string(vars["_source_relay"] || source)
|
||||
#else
|
||||
P2(( "TCP[%s] <= %s: %s %O\n", peeraddr || "error",
|
||||
to_string(source), mc || "-", data))
|
||||
#endif
|
||||
buf = "";
|
||||
#ifndef NEW_RENDER
|
||||
ASSERT("mc", mc, "Message from "+source+" w/out mc")
|
||||
if (!stringp(data))
|
||||
data = abbrev("_message", mc)? "": (T(mc, "") || "");
|
||||
else if (data == S_GLYPH_PACKET_DELIMITER || data[0..1] == S_GLYPH_PACKET_DELIMITER "\n"
|
||||
if (!stringp(data)) {
|
||||
if (abbrev("_message", mc)) data = "";
|
||||
else {
|
||||
data = T(mc, "") || "";
|
||||
P3(("fmt from textdb for %O: %O\n", mc, data))
|
||||
}
|
||||
} else if (data == S_GLYPH_PACKET_DELIMITER || data[0..1] == S_GLYPH_PACKET_DELIMITER "\n"
|
||||
|| strstr(data, "\n" S_GLYPH_PACKET_DELIMITER "\n") != -1) {
|
||||
# if 0 // one day we shall be able to parse that, too
|
||||
vars["_length"] = strlen(data);
|
||||
|
@ -359,7 +383,7 @@ varargs int msg(string source, string mc, string data,
|
|||
//
|
||||
// this stuff should not be seperate from the one done
|
||||
// for UDP!!! TODO
|
||||
# if 1 //def NOT_EXPERIMENTAL
|
||||
# if 1
|
||||
if (context = vars["_INTERNAL_context"]) {
|
||||
P4(("retransmit: %O - deleting source\n", data))
|
||||
unless(vars["_source_relay"])
|
||||
|
@ -392,6 +416,7 @@ varargs int msg(string source, string mc, string data,
|
|||
if (context) {
|
||||
buf+= ":_context\t"+ UNIFORM(context) +"\n";
|
||||
if (source) buf += ":_source_relay\t"+ UNIFORM(source) +"\n";
|
||||
// should it be _target_forward here?
|
||||
if (target) buf += ":_target_relay\t"+ target +"\n";
|
||||
} else {
|
||||
if (source) buf += ":_source\t"+ UNIFORM(source) +"\n";
|
||||
|
@ -421,22 +446,36 @@ varargs int msg(string source, string mc, string data,
|
|||
# endif /* MMP_STATE */
|
||||
# endif /* !PRE_SPEC */
|
||||
#endif /* !NEW_RENDER */
|
||||
buf += psyc_render(source, mc, data, vars, showingLog, target);
|
||||
# ifndef EXPERIMENTAL
|
||||
# if 0
|
||||
// i believe this was an old hack to fix psyctext fmts that
|
||||
// came with an extra newline. since the invention of the
|
||||
// single-file textdb (and the ease of detecting wrong newlines),
|
||||
// this should be of no usefulness anymore ...
|
||||
//
|
||||
if (strlen(data) && char_from_end(data, 1) != '\n')
|
||||
buf += "\n" S_GLYPH_PACKET_DELIMITER "\n";
|
||||
else
|
||||
buf += S_GLYPH_PACKET_DELIMITER "\n";
|
||||
# else
|
||||
rc = psyc_render(source, mc, data, vars, showingLog, target);
|
||||
unless (rc) return 0;
|
||||
buf += rc;
|
||||
P4(("psyc_render %O for %O\n", rc, buf))
|
||||
#if 0
|
||||
# ifdef NEW_LINE
|
||||
buf += "\n" S_GLYPH_PACKET_DELIMITER "\n";
|
||||
# else
|
||||
# ifdef SPYC
|
||||
# echo net/spyc Warning: Erroneous extra newlines will be transmitted.
|
||||
buf += "\n" S_GLYPH_PACKET_DELIMITER "\n";
|
||||
# else
|
||||
//# echo net/psyc Warning: Using inaccurate newline guessing strategy.
|
||||
// textdb still provides formats with extra trailing newline.
|
||||
// catching this at this point is kind of wrong. it doesn't
|
||||
// take into consideration data that intentionally ends with
|
||||
// a newline. This is a minor inconvenience, but still.. FIXME
|
||||
//
|
||||
if (strlen(data)) {
|
||||
PT(("Newline guessing for %O (%O) %O\n", data, char_from_end(data, 1), '\n'))
|
||||
}
|
||||
if (strlen(data) && char_from_end(data, 1) != '\n') {
|
||||
buf += "\n" S_GLYPH_PACKET_DELIMITER "\n";
|
||||
} else {
|
||||
// PT(("Guessed %O\n", buf))
|
||||
buf += S_GLYPH_PACKET_DELIMITER "\n";
|
||||
}
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
# ifdef _flag_log_sockets_PSYC
|
||||
log_file("RAW_PSYC", "» %O\n%s\n", ME, buf);
|
||||
# endif
|
||||
|
@ -529,11 +568,16 @@ int disconnected(string remaining) {
|
|||
if (remaining && (!stringp(remaining) || strlen(remaining)))
|
||||
PP(("%O ignoring remaining data from socket: %O\n", ME,
|
||||
remaining));
|
||||
#endif
|
||||
#ifdef _flag_log_sockets_PSYC
|
||||
log_file("RAW_PSYC", "%O disconnected.\n", ME);
|
||||
#endif
|
||||
// wow.. a sincerely expected disconnect!
|
||||
if (flags & TCP_PENDING_DISCONNECT) return 1;
|
||||
#ifndef _flag_disable_report_failure_network_circuit_disconnect
|
||||
monitor_report("_failure_network_circuit_disconnect",
|
||||
object_name(ME) +" · lost PSYC circuit");
|
||||
#endif
|
||||
return 0; // unexpected
|
||||
}
|
||||
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
// vim:foldmethod=marker:syntax=lpc:noexpandtab
|
||||
// $Id: common.c,v 1.64 2008/02/06 18:13:16 lynx Exp $
|
||||
// $Id: common.c,v 1.67 2008/08/05 12:21:34 lynx Exp $
|
||||
//
|
||||
// common code for UDP and TCP server
|
||||
|
||||
#include "common.h"
|
||||
#include <net.h>
|
||||
#include <url.h>
|
||||
#include <psyc.h>
|
||||
|
@ -130,7 +131,7 @@ varargs int rootMsg(mixed source, string mc, string data,
|
|||
}
|
||||
#endif
|
||||
break;
|
||||
#ifdef EXPERIMENTAL
|
||||
#ifdef GAMMA
|
||||
case "_notice_authentication":
|
||||
P0(("rootMsg got a _notice_authentication. never happens since entity.c\n"))
|
||||
register_location(vars["_location"], source, 1);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// vim:foldmethod=marker:syntax=lpc:noexpandtab
|
||||
// $Id: edit.i,v 1.106 2008/04/01 18:27:15 lynx Exp $
|
||||
// $Id: edit.i,v 1.111 2008/12/01 11:31:33 lynx Exp $
|
||||
//
|
||||
// headermaker functions. we should call it render rather than edit.
|
||||
|
||||
|
@ -108,7 +108,7 @@ static int build_header(string key, mixed val, mapping vars) {
|
|||
#endif
|
||||
}
|
||||
else if (mappingp(val)) {
|
||||
#if 1 //def NOT_EXPERIMENTAL
|
||||
#if 1
|
||||
raise_error("Mappings currently not transmittable.\n");
|
||||
#else
|
||||
klopp = "";
|
||||
|
@ -151,16 +151,27 @@ static varargs string psyc_render(mixed source, string mc, mixed data,
|
|||
P4(("%O psyc_render %O for %O\n", ME, vars, previous_object()))
|
||||
string t, context;
|
||||
int needLen = 0;
|
||||
#ifndef NEW_LINE
|
||||
int excessiveNewline = 0;
|
||||
#endif
|
||||
|
||||
rbuf = ebuf = "";
|
||||
#ifdef NEW_RENDER
|
||||
ASSERT("mc", mc, "Message from "+ to_string(source) +" w/out mc")
|
||||
if (!stringp(data)) {
|
||||
#ifdef T // what lynX wants to say here: do we have the textdb
|
||||
if (!stringp(data))
|
||||
data = abbrev("_message", mc)? "": (T(mc, "") || "");
|
||||
if (abbrev("_message", mc)) data = "";
|
||||
else {
|
||||
data = T(mc, "") || "";
|
||||
P3(("edit: fmt from textdb for %O: %O\n", mc, data))
|
||||
if (strlen(data) && char_from_end(data, 1) == '\n')
|
||||
excessiveNewline = 1;
|
||||
}
|
||||
#else
|
||||
if (!stringp(data)) data = data? to_string(data): "";
|
||||
PT(("non-string data: %O\n", data))
|
||||
data = data? to_string(data): "";
|
||||
#endif
|
||||
}
|
||||
else if (data == S_GLYPH_PACKET_DELIMITER ||
|
||||
(data[0] == C_GLYPH_PACKET_DELIMITER && data[1] == '\n')
|
||||
|| strstr(data, "\n" S_GLYPH_PACKET_DELIMITER "\n") != -1) {
|
||||
|
@ -171,23 +182,50 @@ static varargs string psyc_render(mixed source, string mc, mixed data,
|
|||
# else
|
||||
P1(("%O: %O tried to send %O via psyc. censored.\n",
|
||||
previous_object() || ME, vars["_nick"] || vars, data))
|
||||
// data = "*** censored message ***";
|
||||
data = "*** censored message ***";
|
||||
return 0;
|
||||
# endif
|
||||
}
|
||||
# if 1 //def NOT_EXPERIMENTAL
|
||||
# ifndef NEW_LINE
|
||||
} else
|
||||
# ifdef SPYC
|
||||
if (!needLen)
|
||||
# endif
|
||||
{
|
||||
//# echo net/psyc Warning: Using inaccurate newline guessing strategy.
|
||||
// textdb still provides formats with extra trailing newline.
|
||||
// catching this at this point is kind of wrong. it doesn't
|
||||
// take into consideration data that intentionally ends with
|
||||
// a newline. This is a minor inconvenience, but still.. FIXME
|
||||
//
|
||||
P4(("Newline guessing for %O (%O) %O\n", data,
|
||||
char_from_end(data, 1), '\n'))
|
||||
if (strlen(data) && char_from_end(data, 1) == '\n')
|
||||
excessiveNewline = 1;
|
||||
# endif
|
||||
}
|
||||
# if 1
|
||||
if (context = vars["_INTERNAL_context"]) {
|
||||
P4(("retransmit: %O - deleting source\n", data))
|
||||
# ifdef ALPHA
|
||||
if (source != context && !vars["_source_relay"])
|
||||
vars["_source_relay"] = source;
|
||||
# else
|
||||
unless(vars["_source_relay"])
|
||||
vars["_source_relay"] = source;
|
||||
# endif
|
||||
// public lastlog and history are sent with _context and _target
|
||||
source = 0;
|
||||
}
|
||||
else if (context = vars["_context"]) {
|
||||
P4(("1st transmit: %O - deleting source and target\n", data))
|
||||
// we're not multipeering, so no sources here.
|
||||
# ifdef ALPHA
|
||||
if (source != context && !vars["_source_relay"])
|
||||
vars["_source_relay"] = source;
|
||||
# else
|
||||
unless(vars["_source_relay"])
|
||||
vars["_source_relay"] = source;
|
||||
# endif
|
||||
source = 0;
|
||||
// if (vars["_INTERNAL_context"]) context = 0; // EXPERIMENTAL
|
||||
// else {
|
||||
|
@ -270,20 +308,23 @@ static varargs string psyc_render(mixed source, string mc, mixed data,
|
|||
}
|
||||
#endif
|
||||
}
|
||||
ebuf += "\n"+ mc +"\n"+ data;
|
||||
#if 1 //def EXPERIMENTAL
|
||||
# ifdef SPYC // || MODULE_LENGTH
|
||||
if (data == "") ebuf += "\n"+ mc;
|
||||
else ebuf += "\n"+ mc + "\n"+ data;
|
||||
|
||||
#ifdef SPYC // || MODULE_LENGTH
|
||||
if (needLen || strlen(ebuf) + strlen(rbuf) > 555)
|
||||
return ":_length\t"+ strlen(ebuf) + rbuf +"\n"+
|
||||
ebuf +"\n" S_GLYPH_PACKET_DELIMITER "\n";
|
||||
else
|
||||
# endif
|
||||
#endif
|
||||
#ifndef NEW_LINE
|
||||
if (excessiveNewline) return rbuf[1 ..] +"\n"+
|
||||
ebuf + S_GLYPH_PACKET_DELIMITER "\n";
|
||||
else
|
||||
#endif
|
||||
if (strlen(rbuf)) return rbuf[1 ..] +"\n"+
|
||||
ebuf +"\n" S_GLYPH_PACKET_DELIMITER "\n";
|
||||
return ebuf +"\n" S_GLYPH_PACKET_DELIMITER "\n";
|
||||
#else
|
||||
return ebuf;
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef FORK // {{{
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// vim:foldmethod=marker:syntax=lpc:noexpandtab
|
||||
// $Id: library.i,v 1.170 2008/03/29 20:05:32 lynx Exp $
|
||||
// $Id: library.i,v 1.172 2008/07/26 10:54:31 lynx Exp $
|
||||
|
||||
#include <psyc.h>
|
||||
// #include "../base64.i"
|
||||
|
@ -26,6 +26,7 @@ varargs void register_location(mixed unl, vamixed uni, vaint unsafe) {
|
|||
else m_delete(unl2uni, unl);
|
||||
}
|
||||
|
||||
#ifndef _flag_disable_module_authentication
|
||||
/** finds the _identification for a network source. if it cannot find
|
||||
** the information in the cache, and a second argument is given with
|
||||
** the _identification claimed by the source, that _identification
|
||||
|
@ -57,15 +58,16 @@ varargs mixed lookup_identification(mixed source, vamixed givenUNI) {
|
|||
if (givenUNI == source) return 0;
|
||||
P1(("%O sending _request_authentication to %O for %O\n",
|
||||
ME, givenUNI, source))
|
||||
#ifndef __PIKE__ // TPD
|
||||
# ifndef __PIKE__ // TPD
|
||||
sendmsg(givenUNI, "_request_authentication", 0,
|
||||
([ "_location" : source ]));
|
||||
#endif
|
||||
# endif
|
||||
}
|
||||
// we could look again ;)
|
||||
//if (unl2uni[source]) return unl2uni[source];
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
varargs string psyc_name(mixed source, vastring localpart) {
|
||||
string s;
|
||||
|
@ -396,9 +398,12 @@ int psyc_sendmsg(mixed target, string mc, mixed data, mapping vars,
|
|||
buf = S_GLYPH_PACKET_DELIMITER "\n"
|
||||
":_source\t"+ sname +"\n"
|
||||
":_target\t"+ target +"\n";
|
||||
buf += psyc_render(source, mc, data, vars, showingLog, target);
|
||||
t = psyc_render(source, mc, data, vars, showingLog, target);
|
||||
unless (t) return 0;
|
||||
buf += t;
|
||||
#else
|
||||
buf = psyc_render(source, mc, data, vars, showingLog, target);
|
||||
unless (buf) return 0;
|
||||
#endif /* NEW_RENDER */
|
||||
|
||||
if (is_localhost(host)) return send_udp(host, port, buf);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// vim:foldmethod=marker:syntax=lpc:noexpandtab
|
||||
// $Id: parse.i,v 1.345 2008/04/15 19:36:44 lynx Exp $
|
||||
// $Id: parse.i,v 1.357 2008/12/18 17:45:45 lynx Exp $
|
||||
//
|
||||
#ifndef FORK
|
||||
|
||||
|
@ -171,7 +171,7 @@ private int conclude() {
|
|||
// if (abbrev("_INTERNAL", lastvar)) not necessary because
|
||||
// the following check only allows lowercase for now
|
||||
if (
|
||||
#ifdef EXPERIMENTAL
|
||||
#ifdef GAMMA
|
||||
!legal_keyword(lastvar)
|
||||
#else
|
||||
// very relaxed strategy
|
||||
|
@ -275,7 +275,9 @@ varargs void diminish(string vname, vastring vvalue) {
|
|||
|
||||
vamixed parse(string a) {
|
||||
int i;
|
||||
string vname, vvalue, vdata;
|
||||
string vname, vdata;
|
||||
mixed vvalue;
|
||||
|
||||
#ifdef _flag_log_sockets_PSYC
|
||||
log_file("RAW_PSYC", "%O «\t%s\n", ME, a);
|
||||
#endif
|
||||
|
@ -316,6 +318,11 @@ vamixed parse(string a) {
|
|||
}
|
||||
if (vname != "") {
|
||||
conclude();
|
||||
#ifdef GAMMA
|
||||
// intermediate hack in lack of real type support
|
||||
// which needs to be done in net/spyc
|
||||
if (abbrev("_time", vname)) vvalue = to_int(vvalue);
|
||||
#endif
|
||||
cvars[lastvar = vname] = vvalue;
|
||||
#ifdef SYSTEM_SECRET
|
||||
unless (vcheck) {
|
||||
|
@ -452,7 +459,7 @@ vamixed parse(string a) {
|
|||
#ifdef BITKOENIG_SYNTAX
|
||||
sscanf(a, "%s %s", a, buffer);
|
||||
#endif
|
||||
#ifdef EXPERIMENTAL
|
||||
#ifdef GAMMA
|
||||
if (!legal_keyword(a))
|
||||
#else
|
||||
// pretty inefficient strategy here
|
||||
|
@ -601,7 +608,10 @@ vamixed getdata(string a) {
|
|||
// Authenticated
|
||||
} else if (qAuthenticated(NAMEPREP(u[UHost]))) {
|
||||
if (u[UTransport] && (u[UTransport] !=
|
||||
tls_query_connection_state() ? "s" : "c")) {
|
||||
# if __EFUN_DEFINED__(tls_query_connection_state)
|
||||
tls_query_connection_state() ? "s" :
|
||||
# endif
|
||||
"c")) {
|
||||
P1(("%O sends me wrong transport %O in %O\n",
|
||||
ME, u[UTransport], t))
|
||||
croak("_error_invalid_uniform_transport",
|
||||
|
@ -613,25 +623,27 @@ vamixed getdata(string a) {
|
|||
P2(("%O has accepted %O by qAuthenticated auth\n", ME, t))
|
||||
deliver(0, 0, mc, buffer, cvars);
|
||||
}
|
||||
# if __EFUN_DEFINED__(tls_query_connection_state)
|
||||
} else if (tls_query_connection_state()) {
|
||||
# ifdef _flag_report_bogus_certificates
|
||||
# ifdef _flag_report_bogus_certificates
|
||||
monitor_report("_warning_invalid_host_certificate",
|
||||
S("%O presented an uncertified host %O.",
|
||||
ME, u[UHost]));
|
||||
# else
|
||||
# else
|
||||
P1(("%O presented an uncertified host %O.",
|
||||
ME, u[UHost]))
|
||||
# endif
|
||||
# ifdef _flag_log_bogus_certificates
|
||||
# endif
|
||||
# ifdef _flag_log_bogus_certificates
|
||||
log_file("CERTS", S("%O %O %O\n",
|
||||
ME, u[UHost], tls_certificate(ME, 0)));
|
||||
# endif
|
||||
# endif
|
||||
// vs. _flag_reject_bogus_certificates huh?
|
||||
# ifndef _flag_allow_invalid_host_certificate
|
||||
# ifndef _flag_allow_invalid_host_certificate
|
||||
croak("_error_invalid_host_certificate",
|
||||
"[_host] is not an authenticated source host.",
|
||||
([ "_host": u[UHost] ]));
|
||||
QUIT
|
||||
# endif
|
||||
# endif
|
||||
# endif
|
||||
// fippo suggests we should have a protocol that enables
|
||||
|
@ -826,17 +838,14 @@ protected int deliver(mixed ip, string host, string mc, string buffer, mapping c
|
|||
// hier was rumzuhacken? vermutlich kann man es nicht
|
||||
// oben zuweisen, muss also in ein create()
|
||||
#endif
|
||||
#ifdef TRANSMITTING_FAKE_TIME_IS_A_CAPITAL_CRIME
|
||||
// first of all we can not allow _time, since that is
|
||||
// used internally for last-log functionality and would
|
||||
// irritate the showLog() mechanism in user.c
|
||||
//
|
||||
m_delete(cvars, "_time");
|
||||
#endif
|
||||
//
|
||||
// this may only be set by user:msg()
|
||||
m_delete(cvars, "_nick_verbatim");
|
||||
|
||||
// psyced never acts as multiplexing client proxy (as yet)
|
||||
// so we have no reason to accept this from elsewhere
|
||||
// and risk to forward it somewhere (we could aswell rename
|
||||
// into _INTERNAL_target_forward to ensure it not causing
|
||||
// an outgoing security problem and still be available)
|
||||
m_delete(cvars, "_target_forward");
|
||||
#ifdef PSYC_TCP
|
||||
# ifdef REPATCHING
|
||||
next_input_to(#'parse);
|
||||
|
@ -898,7 +907,7 @@ protected int deliver(mixed ip, string host, string mc, string buffer, mapping c
|
|||
// lowercase policy
|
||||
source = lower_case(t);
|
||||
}
|
||||
#ifndef NOT_EXPERIMENTAL
|
||||
#if 0
|
||||
} else {
|
||||
source = "psyc://"+peeraddr+"/";
|
||||
# ifdef REPATCHING
|
||||
|
@ -906,7 +915,9 @@ protected int deliver(mixed ip, string host, string mc, string buffer, mapping c
|
|||
# endif
|
||||
#endif
|
||||
}
|
||||
// can this safely move into one of the ifs above? TODO
|
||||
// checking _source_XXX etc should be generically done using a
|
||||
// flag in the routing vars share thing..
|
||||
// also, can these safely move into one of the ifs above? TODO
|
||||
if (t = cvars["_source_relay"]) {
|
||||
// recognize local psyc object
|
||||
if (t = psyc_object(t)) {
|
||||
|
@ -918,6 +929,17 @@ protected int deliver(mixed ip, string host, string mc, string buffer, mapping c
|
|||
cvars["_source_relay"] = lower_case(t);
|
||||
}
|
||||
}
|
||||
if (t = cvars["_source_identification"]) {
|
||||
// recognize local psyc object
|
||||
if (t = psyc_object(t)) {
|
||||
P2(("local _source_identification %O for %O from %O, cont %O\n",
|
||||
t, mc, source, context))
|
||||
cvars["_source_identification"] = t;
|
||||
} else if (stringp(t)) {
|
||||
// otherwise: lowercase policy
|
||||
cvars["_source_identification"] = lower_case(t);
|
||||
}
|
||||
}
|
||||
P3(("parse1: source is %O, context is %O\n", source, context))
|
||||
// other side doesn't *have* to provide a source..
|
||||
if (trustworthy > 6 && (t2 = context || source))
|
||||
|
@ -1103,9 +1125,7 @@ protected int deliver(mixed ip, string host, string mc, string buffer, mapping c
|
|||
vamixed startParse(string a) {
|
||||
if (a == ".") { // old S_GLYPH_PACKET_DELIMITER
|
||||
restart();
|
||||
# ifdef NOT_EXPERIMENTAL
|
||||
if (isServer()) greet();
|
||||
# endif
|
||||
}
|
||||
# ifdef SPYC_PATH
|
||||
else if (a == "|") { // new S_GLYPH_PACKET_DELIMITER
|
||||
|
@ -1115,7 +1135,8 @@ vamixed startParse(string a) {
|
|||
"Could not instantiate PSYC parser. Weird.");
|
||||
QUIT
|
||||
}
|
||||
o->feed(a);
|
||||
if (isServer()) o->greet();
|
||||
o->feed("|\n");
|
||||
return 1;
|
||||
}
|
||||
# endif
|
||||
|
@ -1149,11 +1170,13 @@ vamixed startParse(string a) {
|
|||
PT(("PSYC startParse got %O from %O\n", a, query_ip_number()))
|
||||
croak("_error_syntax_initialization",
|
||||
"The protocol begins with a dot on a line by itself.");
|
||||
// experiencing a loop here, because some implementations
|
||||
// try immediate reconnect. idea: in most places where we
|
||||
// QUIT we should put the tcp link on hold instead, and
|
||||
// close it only several seconds later. TODO
|
||||
QUIT
|
||||
}
|
||||
#ifdef NOT_EXPERIMENTAL
|
||||
pvars["_INTERNAL_source"] = "psyc://"+peeraddr+"/";
|
||||
#endif
|
||||
next_input_to(#'parse);
|
||||
return 1;
|
||||
}
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
// $Id: server.c,v 1.98 2008/04/15 19:36:44 lynx Exp $ // vim:syntax=lpc
|
||||
// $Id: server.c,v 1.102 2008/08/05 12:15:11 lynx Exp $ // vim:syntax=lpc
|
||||
//
|
||||
// the thing that answers on port 4404 of psyced.
|
||||
|
||||
#include "common.h"
|
||||
#include <net.h>
|
||||
#include <services.h>
|
||||
|
||||
#define NO_INHERIT
|
||||
#include <server.h>
|
||||
|
||||
|
@ -69,18 +71,18 @@ disconnected(remaining) {
|
|||
static varargs int block(vastring mc, vastring reason) {
|
||||
P0(("Server blocked TCP PSYC connection from %O in %O (%O).\n",
|
||||
query_ip_number(ME), ME, mc))
|
||||
#ifdef BETA
|
||||
# define BETA_REDIR ""
|
||||
#ifdef SYMLYNX
|
||||
# define TEST_REDIR ""
|
||||
# define TEXT_REDIR ""
|
||||
#else
|
||||
# define BETA_REDIR ":_source_redirect\tpsyc://beta.ve.symlynX.com\n"
|
||||
# define TEXT_REDIR "Try the [_source_redirect] server instead!\n"
|
||||
# define TEST_REDIR ":_source_redirect\tpsyc://ve.symlynX.com\n"
|
||||
# define TEXT_REDIR "Try the test server at [_source_redirect] instead!\n"
|
||||
#endif
|
||||
unless(mc) mc = "_error_illegal_source";
|
||||
unless(reason) reason = "";
|
||||
emit(".\n\
|
||||
\n\
|
||||
" BETA_REDIR + mc +"\n\
|
||||
" TEST_REDIR + mc +"\n\
|
||||
Sorry, my configuration does not allow me to talk to you.\n\
|
||||
"+ reason +"\n\
|
||||
" TEXT_REDIR "\
|
||||
|
@ -96,7 +98,7 @@ static void resolved(mixed host) {
|
|||
mixed uni, psycip;
|
||||
|
||||
unless (stringp(host)) {
|
||||
#if 1 //ndef BETA
|
||||
#if 1 //ndef SYMLYNX
|
||||
if (host == -2) {
|
||||
monitor_report("_warning_invalid_hostname",
|
||||
S("%O: %O has an invalid IN PTR", ME,
|
||||
|
@ -127,7 +129,7 @@ static void resolved(mixed host) {
|
|||
return;
|
||||
}
|
||||
#else
|
||||
// we sent them to beta, so let beta be easy on them
|
||||
// we sent them to the test server, so let it be easy on them
|
||||
host = peerip;
|
||||
#endif
|
||||
}
|
||||
|
@ -158,7 +160,7 @@ static void resolved(mixed host) {
|
|||
if (peerport && peerport != PSYC_SERVICE) peeraddr += ":"+peerport;
|
||||
netloc = "psyc://"+peeraddr+"/";
|
||||
register_target( netloc );
|
||||
#if 1 // OPTIONAL
|
||||
#ifndef _flag_disable_module_authentication // OPTIONAL
|
||||
// should this server be connected to a psyc client, then the new
|
||||
// resolved name of the connection may have to be recognized as
|
||||
// location for the person. finally this code should be unnecessary
|
||||
|
@ -173,14 +175,12 @@ static void resolved(mixed host) {
|
|||
// cleanup? are you sure we will never need this again?
|
||||
register_location(psycip, 0); //cleanup
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif // _flag_disable_module_authentication
|
||||
|
||||
// PIKE TPD: says psyc://127.0.0.1/ here .. should say
|
||||
// psyc://localhost:-23232/ instead
|
||||
P2(("%O resolves as %O (UNI %O)\n", ME, netloc, uni))
|
||||
#ifndef NOT_EXPERIMENTAL
|
||||
greet();
|
||||
#endif
|
||||
// in the old days: greet();
|
||||
}
|
||||
|
||||
int logon(int nothing) {
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
// vim:foldmethod=marker:syntax=lpc:noexpandtab
|
||||
// $Id: udp.c,v 1.32 2008/03/29 20:36:44 lynx Exp $
|
||||
// $Id: udp.c,v 1.36 2008/08/05 12:21:34 lynx Exp $
|
||||
//
|
||||
#include "common.h"
|
||||
#include <net.h>
|
||||
#include <person.h>
|
||||
#include <services.h>
|
||||
|
@ -69,13 +70,11 @@ parseUDP2(host, ip, port, msg) {
|
|||
}
|
||||
// else: we presume a UDP 4404 also listens on TCP
|
||||
|
||||
#ifdef PRO_PATH
|
||||
P1(("./psyc/udp.c: restart. why?\n"))
|
||||
#ifndef GAMMA
|
||||
P1(("./psyc/udp.c: paranoid extra restart\n"))
|
||||
restart(); // leading . does that anyway
|
||||
#endif
|
||||
#if 1 //def NOT_EXPERIMENTAL
|
||||
pvars["_INTERNAL_source"] = "psyc://"+peeraddr+"/";
|
||||
#endif
|
||||
// m = regexplode(msg, "\r?\n"); ?
|
||||
m = explode(msg, "\n");
|
||||
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
// $Id: user.c,v 1.13 2008/03/11 13:42:27 lynx Exp $ // vim:syntax=lpc
|
||||
// $Id: user.c,v 1.15 2008/12/09 19:27:32 lynx Exp $ // vim:syntax=lpc
|
||||
//
|
||||
// handler for PSYC clients
|
||||
|
||||
#include "common.h"
|
||||
#include <net.h>
|
||||
#include <user.h>
|
||||
|
||||
|
@ -14,7 +15,11 @@ logon() {
|
|||
// psyc users dont have their own socket, so the driver
|
||||
// does not call disconnected() for them - this enables the
|
||||
// psyc socket to do that
|
||||
this_interactive()->do_notify_on_disconnect(ME);
|
||||
if (this_interactive()) this_interactive()->do_notify_on_disconnect(ME);
|
||||
// connection that is creating us, died while we got here.
|
||||
// rare, but does indeed happen sometimes.
|
||||
else return destruct(ME);
|
||||
|
||||
// no lang support here either
|
||||
vSet("scheme", "psyc");
|
||||
return ::logon();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue