mirror of
git://git.psyced.org/git/psyclpc
synced 2024-08-15 03:20:16 +00:00
provide autodetect when libpsyc is available
This commit is contained in:
parent
417f1703c6
commit
723775f1f9
4 changed files with 17 additions and 10 deletions
17
src/comm.c
17
src/comm.c
|
@ -3187,8 +3187,9 @@ get_message (char *buff, size_t *len)
|
||||||
inet_volume_in += l;
|
inet_volume_in += l;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// If we're receiving the first bytes call a peek function
|
#ifdef HAS_PSYC
|
||||||
// which could enable_binary depending on the content of the buffer
|
// If we're receiving the first bytes call a peek function which
|
||||||
|
// could enable_binary depending on the content of the buffer
|
||||||
// We only need this until we give up the old PSYC syntax.
|
// We only need this until we give up the old PSYC syntax.
|
||||||
if (!ip->connected) {
|
if (!ip->connected) {
|
||||||
put_c_n_string(++inter_sp, ip->text, l);
|
put_c_n_string(++inter_sp, ip->text, l);
|
||||||
|
@ -3197,7 +3198,7 @@ get_message (char *buff, size_t *len)
|
||||||
sapply(new_tabled("connection_peek"), ip->ob, 1);
|
sapply(new_tabled("connection_peek"), ip->ob, 1);
|
||||||
ip->connected = MY_TRUE;
|
ip->connected = MY_TRUE;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
/* Experimental support for
|
/* Experimental support for
|
||||||
* binary data streams, by fippo 2008
|
* binary data streams, by fippo 2008
|
||||||
*/
|
*/
|
||||||
|
@ -4012,8 +4013,12 @@ new_player ( object_t *ob, SOCKET_T new_socket
|
||||||
new_interactive->tls_status = TLS_INACTIVE;
|
new_interactive->tls_status = TLS_INACTIVE;
|
||||||
new_interactive->tls_session = NULL;
|
new_interactive->tls_session = NULL;
|
||||||
new_interactive->tls_cb = NULL;
|
new_interactive->tls_cb = NULL;
|
||||||
# ifdef USE_EXPERIMENTAL
|
# ifdef HAS_PSYC
|
||||||
new_interactive->tls_autodetect = ob == NULL? 9 : 0; /* give tls 9 seconds to start */
|
/* give TLS 4 seconds to start. in fact even 1 second should
|
||||||
|
* be enough as the TLS init packet is sent immediately with
|
||||||
|
* the TCP 3-way handshake completion.
|
||||||
|
*/
|
||||||
|
new_interactive->tls_autodetect = ob == NULL? 4 : 0;
|
||||||
# endif
|
# endif
|
||||||
new_interactive->tls_want_peer_cert = MY_FALSE;
|
new_interactive->tls_want_peer_cert = MY_FALSE;
|
||||||
#endif
|
#endif
|
||||||
|
@ -4543,7 +4548,7 @@ call_function_interactive (interactive_t *i, char *str, size_t len)
|
||||||
|
|
||||||
/* Call the input_to() function with the newly input string */
|
/* Call the input_to() function with the newly input string */
|
||||||
|
|
||||||
#ifdef USE_EXPERIMENTAL
|
#ifdef HAS_PSYC // enable_binary i suppose
|
||||||
if (len == 0) {
|
if (len == 0) {
|
||||||
push_c_string(inter_sp, str);
|
push_c_string(inter_sp, str);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -290,7 +290,7 @@ struct interactive_s {
|
||||||
# define TLS_ACTIVE 2 /* Session is secure */
|
# define TLS_ACTIVE 2 /* Session is secure */
|
||||||
# define TLS_BROKEN 3 /* Error has occurred */
|
# define TLS_BROKEN 3 /* Error has occurred */
|
||||||
CBool tls_want_peer_cert;
|
CBool tls_want_peer_cert;
|
||||||
# ifdef USE_EXPERIMENTAL
|
# ifdef HAS_PSYC
|
||||||
int tls_autodetect;
|
int tls_autodetect;
|
||||||
# endif
|
# endif
|
||||||
callback_t *tls_cb;
|
callback_t *tls_cb;
|
||||||
|
|
|
@ -12,6 +12,8 @@
|
||||||
|
|
||||||
#ifdef USE_TLS
|
#ifdef USE_TLS
|
||||||
|
|
||||||
|
/* #define DEBUG **/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#if defined(HAS_OPENSSL)
|
#if defined(HAS_OPENSSL)
|
||||||
|
@ -802,7 +804,7 @@ tls_continue_handshake (interactive_t *ip)
|
||||||
return 1;
|
return 1;
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAS_OPENSSL
|
#ifdef HAS_OPENSSL
|
||||||
# ifdef USE_EXPERIMENTAL
|
# ifdef HAS_PSYC
|
||||||
/* detect non-tls data on a tls connection
|
/* detect non-tls data on a tls connection
|
||||||
* heuristic taken from jabberds jadc2s
|
* heuristic taken from jabberds jadc2s
|
||||||
*/
|
*/
|
||||||
|
@ -1445,7 +1447,7 @@ f_tls_error(svalue_t *sp)
|
||||||
const char *text;
|
const char *text;
|
||||||
int err = sp->u.number;
|
int err = sp->u.number;
|
||||||
|
|
||||||
#ifdef USE_EXPERIMENTAL
|
#ifdef HAS_PSYC
|
||||||
if (err == ERR_TLS_NOT_DETECTED) text = "Unencrypted connection detected";
|
if (err == ERR_TLS_NOT_DETECTED) text = "Unencrypted connection detected";
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -17,7 +17,7 @@ version_longtype="stable"
|
||||||
# A timestamp, to be used by bumpversion and other scripts.
|
# A timestamp, to be used by bumpversion and other scripts.
|
||||||
# It can be used, for example, to 'touch' this file on every build, thus
|
# It can be used, for example, to 'touch' this file on every build, thus
|
||||||
# forcing revision control systems to add it on every checkin automatically.
|
# forcing revision control systems to add it on every checkin automatically.
|
||||||
version_stamp="Tue May 24 16:27:09 CEST 2011"
|
version_stamp="Tue May 24 18:47:17 CEST 2011"
|
||||||
|
|
||||||
# Okay, LDMUD is using 3.x.x so to avoid conflicts let's just use 4.x.x
|
# Okay, LDMUD is using 3.x.x so to avoid conflicts let's just use 4.x.x
|
||||||
version_major=4
|
version_major=4
|
||||||
|
|
Loading…
Reference in a new issue