From c889ac92251042ad95dd86a4e1e8caa2c0072538 Mon Sep 17 00:00:00 2001 From: Spoike Date: Sun, 19 Apr 2009 01:48:10 +0000 Subject: [PATCH] TLS bugfixes. git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@3183 fc73d0e0-1445-4013-8a0c-d673dee63da5 --- plugins/jabber/jabberclient.c | 32 +++++++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/plugins/jabber/jabberclient.c b/plugins/jabber/jabberclient.c index e632853ea..72f4140cb 100644 --- a/plugins/jabber/jabberclient.c +++ b/plugins/jabber/jabberclient.c @@ -275,11 +275,11 @@ jclient_t *JCL_Connect(char *server, int defport, qboolean usesecure, char *acco if (usesecure) { - if (Net_SetTLSClient(jclient->socket)<0) + if (Net_SetTLSClient(jcl->socket)<0) { - Net_Close(jclient->socket); - free(jclient); - jclient = NULL; + Net_Close(jcl->socket); + free(jcl); + jcl = NULL; return NULL; } @@ -809,7 +809,7 @@ int JCL_ClientFrame(jclient_t *jcl) { if (jcl->tagdepth != 1) { - if (jcl->tagdepth < 1) + if (jcl->tagdepth < 1 && jcl->bufferedinammount==jcl->instreampos) { Con_Printf("End of XML stream\n"); return JCL_KILL; @@ -1093,6 +1093,12 @@ void JCL_Command(void) { if (!strcmp(arg[0]+1, "tlsopen") || !strcmp(arg[0]+1, "tlsconnect")) { + if (!*arg[1]) + { + Con_Printf("tlsopen [server] [account] [password]\n"); + return; + } + if (jclient) { Con_Printf("You are already connected\nPlease /quit first\n"); @@ -1104,9 +1110,20 @@ void JCL_Command(void) return; } jclient = JCL_Connect(arg[1], 5223, true, arg[2], arg[3]); + if (!jclient) + { + Con_Printf("Connect failed\n"); + return; + } } else if (!strcmp(arg[0]+1, "open") || !strcmp(arg[0]+1, "connect")) { + if (!*arg[1]) + { + Con_Printf("open [server] [account] [password]\n"); + return; + } + if (jclient) { Con_Printf("You are already connected\nPlease /quit first\n"); @@ -1118,6 +1135,11 @@ void JCL_Command(void) return; } jclient = JCL_Connect(arg[1], 5222, false, arg[2], arg[3]); + if (!jclient) + { + Con_Printf("Connect failed\n"); + return; + } } else if (!jclient) {