mirror of
git://git.psyced.org/git/psyced
synced 2024-08-15 03:25:10 +00:00
expect TLS autodetect only when libpsyc is compiled in (fixes alice' dot bug)
This commit is contained in:
parent
47232884b9
commit
069a3b66ae
6 changed files with 39 additions and 38 deletions
12
CHANGESTODO
12
CHANGESTODO
|
@ -118,10 +118,10 @@ ________________________________________________________________________
|
||||||
== psyced 1.0 ==========================================================
|
== psyced 1.0 ==========================================================
|
||||||
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
|
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
|
||||||
> SPYC
|
> SPYC
|
||||||
- net/spyc is buggy and incomplete
|
- net/spyc depends on libpsyc being compiled into the driver
|
||||||
(implementation of http://about.psyc.eu/Specification)
|
if it is available, it will be activated passively
|
||||||
_ to activate spyc support, defined USE_SPYC
|
- #define USE_SPYC if you want outgoing connections to require libpsyc
|
||||||
it will attempt to use new syntax on outgoing links by default
|
|
||||||
_ to debug verification, define USE_VERIFICATION
|
_ to debug verification, define USE_VERIFICATION
|
||||||
_ to spend an extra round trip time negotiating, define USE_FEATURES
|
_ to spend an extra round trip time negotiating, define USE_FEATURES
|
||||||
|
|
||||||
|
@ -3927,4 +3927,6 @@ net/person
|
||||||
* removed interesting but unrecoverable FORK code
|
* removed interesting but unrecoverable FORK code
|
||||||
* unlink detection rewrite and other fixes in client linking code
|
* unlink detection rewrite and other fixes in client linking code
|
||||||
edit.i now renamed into render.i because it renders psyc packets
|
edit.i now renamed into render.i because it renders psyc packets
|
||||||
|
=== 201105 ============================================================
|
||||||
|
net/spyc net/psyc
|
||||||
|
tg added support for libpsyc aka PSYC syntax according to spec!
|
||||||
|
|
|
@ -17,10 +17,12 @@
|
||||||
|
|
||||||
#include DRIVER_PATH "sys/tls.h"
|
#include DRIVER_PATH "sys/tls.h"
|
||||||
|
|
||||||
#ifndef ERR_TLS_NOT_DETECTED
|
#if __EFUN_DEFINED__(psyc_parse)
|
||||||
# define ERR_TLS_NOT_DETECTED -31337
|
# define AUTODETECT 1 // use TLS autodetect if libpsyc is available
|
||||||
|
#else
|
||||||
|
# define AUTODETECT 0
|
||||||
# ifdef SPYC_PATH
|
# ifdef SPYC_PATH
|
||||||
# echo Warning: TLS autodetect is not enabled in driver.
|
# echo PSYC 1.0 will not work: libpsyc is not enabled in driver.
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -70,7 +72,7 @@ object connect(int uid, int port, string service) {
|
||||||
// we dont want the telnet machine most of the time
|
// we dont want the telnet machine most of the time
|
||||||
// but disabling and re-enabling it for telnet doesn't work
|
// but disabling and re-enabling it for telnet doesn't work
|
||||||
switch(port || query_mud_port()) {
|
switch(port || query_mud_port()) {
|
||||||
#if HAS_PORT(PSYC_PORT, PSYC_PATH)
|
#if HAS_PORT(PSYC_PORT, PSYC_PATH) && AUTODETECT
|
||||||
case PSYC_PORT:
|
case PSYC_PORT:
|
||||||
#endif
|
#endif
|
||||||
#if HAS_PORT(PSYCS_PORT, PSYC_PATH)
|
#if HAS_PORT(PSYCS_PORT, PSYC_PATH)
|
||||||
|
@ -86,6 +88,9 @@ object connect(int uid, int port, string service) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif // fall thru
|
#endif // fall thru
|
||||||
|
#if HAS_PORT(PSYC_PORT, PSYC_PATH) &&! AUTODETECT
|
||||||
|
case PSYC_PORT:
|
||||||
|
#endif
|
||||||
#if HAS_PORT(PSYC_PORT, PSYC_PATH) || HAS_PORT(PSYCS_PORT, PSYC_PATH)
|
#if HAS_PORT(PSYC_PORT, PSYC_PATH) || HAS_PORT(PSYCS_PORT, PSYC_PATH)
|
||||||
# ifdef DRIVER_HAS_CALL_BY_REFERENCE
|
# ifdef DRIVER_HAS_CALL_BY_REFERENCE
|
||||||
arg = ME;
|
arg = ME;
|
||||||
|
@ -112,6 +117,7 @@ object connect(int uid, int port, string service) {
|
||||||
return t -> load(query_ip_number(), -peerport);
|
return t -> load(query_ip_number(), -peerport);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// dedicated SPYC port.. should not be used, we have AUTODETECT
|
||||||
#if HAS_PORT(SPYCS_PORT, SPYC_PATH)
|
#if HAS_PORT(SPYCS_PORT, SPYC_PATH)
|
||||||
case SPYCS_PORT: // interim name for PSYC 1.0 according to SPEC
|
case SPYCS_PORT: // interim name for PSYC 1.0 according to SPEC
|
||||||
# if __EFUN_DEFINED__(tls_want_peer_certificate)
|
# if __EFUN_DEFINED__(tls_want_peer_certificate)
|
||||||
|
@ -260,7 +266,7 @@ object connect(int uid, int port, string service) {
|
||||||
return clone_object(IRC_PATH "server");
|
return clone_object(IRC_PATH "server");
|
||||||
#endif
|
#endif
|
||||||
#if HAS_PORT(IRC_PORT, IRC_PATH)
|
#if HAS_PORT(IRC_PORT, IRC_PATH)
|
||||||
case IRC_PORT:
|
case IRC_PORT: // we could enable AUTODETECT for this..
|
||||||
# if 0 // __EFUN_DEFINED__(enable_telnet)
|
# if 0 // __EFUN_DEFINED__(enable_telnet)
|
||||||
enable_telnet(0); // shouldn't harm.. but it does!!!
|
enable_telnet(0); // shouldn't harm.. but it does!!!
|
||||||
# endif
|
# endif
|
||||||
|
@ -285,11 +291,8 @@ object connect(int uid, int port, string service) {
|
||||||
return clone_object(TELNET_PATH "server");
|
return clone_object(TELNET_PATH "server");
|
||||||
#endif
|
#endif
|
||||||
#if HAS_PORT(TELNET_PORT, TELNET_PATH)
|
#if HAS_PORT(TELNET_PORT, TELNET_PATH)
|
||||||
case TELNET_PORT:
|
case TELNET_PORT: // we could enable AUTODETECT for this.. (wait 4s)
|
||||||
// set_prompt("> ");
|
// set_prompt("> ");
|
||||||
// we can't do the usual autodetect here, as telnet users
|
|
||||||
// don't send first and rather expect the server to prompt
|
|
||||||
// the correct way to do this: implement telnet nego for tls. bah!
|
|
||||||
t = clone_object(TELNET_PATH "server");
|
t = clone_object(TELNET_PATH "server");
|
||||||
# ifdef UID2NICK
|
# ifdef UID2NICK
|
||||||
if (uid && (arg = UID2NICK(uid))) { t -> sName(arg); }
|
if (uid && (arg = UID2NICK(uid))) { t -> sName(arg); }
|
||||||
|
@ -314,7 +317,7 @@ object connect(int uid, int port, string service) {
|
||||||
#endif
|
#endif
|
||||||
/* don't fall thru. allow for https: to be available without http: */
|
/* don't fall thru. allow for https: to be available without http: */
|
||||||
#if HAS_PORT(HTTP_PORT, HTTP_PATH)
|
#if HAS_PORT(HTTP_PORT, HTTP_PATH)
|
||||||
case HTTP_PORT:
|
case HTTP_PORT: // AUTODETECT on the HTTP port? we could do that too
|
||||||
return clone_object(HTTP_PATH "server");
|
return clone_object(HTTP_PATH "server");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -205,13 +205,6 @@ void disconnect(object ob, string remaining) {
|
||||||
" with "+ strlen(remaining) +" bytes remaining" : ""))
|
" with "+ strlen(remaining) +" bytes remaining" : ""))
|
||||||
}
|
}
|
||||||
|
|
||||||
// even though the name of the function is weird, this is the
|
|
||||||
// place where UDP messages arrive
|
|
||||||
//
|
|
||||||
// how to multiplex InterMUD and PSYC on the same udp port:
|
|
||||||
// PSYC UDP packets always start with ".\n", just forward them to
|
|
||||||
// the PSYC UDP server daemon.
|
|
||||||
//
|
|
||||||
volatile object psycd;
|
volatile object psycd;
|
||||||
#ifdef SPYC_PATH
|
#ifdef SPYC_PATH
|
||||||
volatile object spycd;
|
volatile object spycd;
|
||||||
|
@ -223,6 +216,9 @@ volatile object sipd;
|
||||||
void receive_udp(string host, string msg, int port) {
|
void receive_udp(string host, string msg, int port) {
|
||||||
if (strlen(msg) > 1 && msg[1] == '\n') switch(msg[0]) {
|
if (strlen(msg) > 1 && msg[1] == '\n') switch(msg[0]) {
|
||||||
#ifdef SPYC_PATH
|
#ifdef SPYC_PATH
|
||||||
|
# if !__EFUN_DEFINED__(psyc_parse)
|
||||||
|
# echo New PSYC syntax will not work: Driver compiled without libpsyc!
|
||||||
|
# else
|
||||||
case '|':
|
case '|':
|
||||||
unless (spycd) {
|
unless (spycd) {
|
||||||
spycd = SPYC_PATH "udp" -> load();
|
spycd = SPYC_PATH "udp" -> load();
|
||||||
|
@ -231,6 +227,7 @@ void receive_udp(string host, string msg, int port) {
|
||||||
}
|
}
|
||||||
spycd -> parseUDP(host, port, msg);
|
spycd -> parseUDP(host, port, msg);
|
||||||
return;
|
return;
|
||||||
|
# endif
|
||||||
#endif
|
#endif
|
||||||
case '.':
|
case '.':
|
||||||
unless (psycd) {
|
unless (psycd) {
|
||||||
|
|
|
@ -35,7 +35,7 @@ private volatile mapping temp_state;
|
||||||
inherit NET_PATH "state";
|
inherit NET_PATH "state";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef USE_SPYC
|
#if __EFUN_DEFINED__(psyc_parse)
|
||||||
mapping _state; // should probably merge with ifdef CONTEXT_STATE..
|
mapping _state; // should probably merge with ifdef CONTEXT_STATE..
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -47,7 +47,7 @@ void create() {
|
||||||
unless(mappingp(cast_state)) cast_state = ([ ]);
|
unless(mappingp(cast_state)) cast_state = ([ ]);
|
||||||
unless(mappingp(temp_state)) temp_state = ([ ]);
|
unless(mappingp(temp_state)) temp_state = ([ ]);
|
||||||
#endif
|
#endif
|
||||||
#ifdef USE_SPYC
|
#if __EFUN_DEFINED__(psyc_parse)
|
||||||
unless(mappingp(_state)) _state = ([ ]);
|
unless(mappingp(_state)) _state = ([ ]);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -273,7 +273,7 @@ void Diminish(mixed source, string key, mixed value) {
|
||||||
|
|
||||||
#endif // }}}
|
#endif // }}}
|
||||||
|
|
||||||
#ifdef USE_SPYC
|
#if __EFUN_DEFINED__(psyc_parse)
|
||||||
get_state() {
|
get_state() {
|
||||||
PT(("cstate for %O picked up by %O: %O\n", ME,
|
PT(("cstate for %O picked up by %O: %O\n", ME,
|
||||||
previous_object(), _state))
|
previous_object(), _state))
|
||||||
|
|
|
@ -1113,23 +1113,17 @@ protected int deliver(mixed ip, string host, string mc, string buffer, mapping c
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if __EFUN_DEFINED__(psyc_parse)
|
||||||
// temporary new "lfun" called from driver's comm.c to peek into new connection
|
// temporary new "lfun" called from driver's comm.c to peek into new connection
|
||||||
|
// only exists if libpsyc is provided
|
||||||
void connection_peek(string data) {
|
void connection_peek(string data) {
|
||||||
P4((">> peek: %O\n", data));
|
P4((">> peek: %O\n", data));
|
||||||
#ifdef USE_SPYC
|
|
||||||
# if !__EFUN_DEFINED__(psyc_parse)
|
|
||||||
# echo New PSYC syntax will not work: Driver compiled without libpsyc!
|
|
||||||
# endif
|
|
||||||
if (data[0] == C_GLYPH_NEW_PACKET_DELIMITER) {
|
if (data[0] == C_GLYPH_NEW_PACKET_DELIMITER) {
|
||||||
# if __EFUN_DEFINED__(enable_binary)
|
|
||||||
enable_binary(ME);
|
enable_binary(ME);
|
||||||
# else
|
}
|
||||||
# echo New PSYC syntax will not work: Driver compiled without enable_binary!
|
|
||||||
raise_error("Driver compiled without enable_binary()");
|
|
||||||
# endif
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef PSYC_TCP
|
#ifdef PSYC_TCP
|
||||||
vamixed startParse(string a) {
|
vamixed startParse(string a) {
|
||||||
|
@ -1137,8 +1131,7 @@ vamixed startParse(string a) {
|
||||||
restart();
|
restart();
|
||||||
if (isServer()) greet();
|
if (isServer()) greet();
|
||||||
}
|
}
|
||||||
// new syntax is so broken, we should not pretend to support it yet FIXME
|
# if defined(SPYC_PATH) && __EFUN_DEFINED__(psyc_parse)
|
||||||
# if defined(SPYC_PATH) && defined(USE_SPYC)
|
|
||||||
else if (a[0] == C_GLYPH_NEW_PACKET_DELIMITER) {
|
else if (a[0] == C_GLYPH_NEW_PACKET_DELIMITER) {
|
||||||
object o = clone_object(SPYC_PATH "server");
|
object o = clone_object(SPYC_PATH "server");
|
||||||
unless (o && exec(o, ME) && o->logon(0)) {
|
unless (o && exec(o, ME) && o->logon(0)) {
|
||||||
|
|
|
@ -86,6 +86,12 @@ void dispatch(mapping rvars, mapping evars, mixed method, mixed body) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void psyc_dispatch(mixed p) {
|
void psyc_dispatch(mixed p) {
|
||||||
|
if (p[PACKET_METHOD][0] != '_') {
|
||||||
|
log_file("SPYC", "%O SYNTAX %O\n", query_ip_name(), p);
|
||||||
|
croak("_error_invalid_method_compact",
|
||||||
|
"Compact methods undefined as yet.");
|
||||||
|
QUIT
|
||||||
|
}
|
||||||
dispatch(p[PACKET_ROUTING], p[PACKET_ENTITY], p[PACKET_METHOD], p[PACKET_BODY]);
|
dispatch(p[PACKET_ROUTING], p[PACKET_ENTITY], p[PACKET_METHOD], p[PACKET_BODY]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue