1 #include <errno.h>
2 #include <stdio.h>
3 #include <unistd.h>
4 #include <stdlib.h>
5 #include <string.h>
6 #include <fcntl.h>
7 #include <config.h>
8 #include <glib.h>
9 #include <glib/gstdio.h>
10 
11 #ifdef G_OS_WIN32
12 #include <windows.h>
13 #include <ws2tcpip.h>
14 #else
15 #include <sys/socket.h>
16 #include <sys/stat.h>
17 #include <sys/wait.h>
18 #include <netinet/in.h>
19 #include <arpa/inet.h>
20 #endif
21 
22 #ifdef G_OS_UNIX
23 #include <netinet/tcp.h>
24 #endif
25 
26 #include <wocky/wocky.h>
27 
28 #include "wocky-test-connector-server.h"
29 #include "test-resolver.h"
30 #include "wocky-test-helper.h"
31 #include "config.h"
32 
33 #ifdef G_LOG_DOMAIN
34 #undef G_LOG_DOMAIN
35 #endif
36 #define G_LOG_DOMAIN "wocky-connector-test"
37 
38 #define SASL_DB_NAME "sasl-test.db"
39 
40 #define INVISIBLE_HOST "unreachable.host"
41 #define VISIBLE_HOST   "reachable.host"
42 #define REACHABLE      "127.0.0.1"
43 #define UNREACHABLE    "127.255.255.255"
44 #define DUFF_H0ST      "no_such_host.at.all"
45 
46 #define OLD_SSL    TRUE
47 #define OLD_JABBER TRUE
48 #define XMPP_V1    FALSE
49 #define STARTTLS   FALSE
50 
51 #define CERT_CHECK_STRICT  FALSE
52 #define CERT_CHECK_LENIENT TRUE
53 
54 #define TLS_REQUIRED TRUE
55 #define PLAINTEXT_OK FALSE
56 
57 #define QUIET TRUE
58 #define NOISY FALSE
59 
60 #define TLS   TRUE
61 #define NOTLS FALSE
62 
63 #define PLAIN  FALSE
64 #define DIGEST TRUE
65 
66 #define PORT_XMPP 5222
67 #define PORT_NONE 0
68 
69 #define CONNECTOR_INTERNALS_TEST "/connector/basic/internals"
70 
71 #define OK 0
72 #define CONNECTOR_OK { OK, OK, OK, OK, OK, OK }
73 
74 static GError *error = NULL;
75 static GResolver *original;
76 static GResolver *kludged;
77 static GMainLoop *mainloop;
78 
79 enum {
80   OP_CONNECT = 0,
81   OP_REGISTER,
82   OP_CANCEL,
83 };
84 
85 enum {
86   S_NO_ERROR = 0,
87   S_WOCKY_AUTH_ERROR,
88   S_WOCKY_CONNECTOR_ERROR,
89   S_WOCKY_XMPP_CONNECTION_ERROR,
90   S_WOCKY_TLS_CERT_ERROR,
91   S_WOCKY_XMPP_STREAM_ERROR,
92   S_G_IO_ERROR,
93   S_G_RESOLVER_ERROR,
94   S_ANY_ERROR = 0xff
95 };
96 
97 #define MAP(x)  case S_##x: return x
98 static GQuark
map_static_domain(gint domain)99 map_static_domain (gint domain)
100 {
101   switch (domain)
102     {
103       MAP (WOCKY_AUTH_ERROR);
104       MAP (WOCKY_CONNECTOR_ERROR);
105       MAP (WOCKY_XMPP_CONNECTION_ERROR);
106       MAP (WOCKY_TLS_CERT_ERROR);
107       MAP (WOCKY_XMPP_STREAM_ERROR);
108       MAP (G_IO_ERROR);
109       MAP (G_RESOLVER_ERROR);
110       default:
111         g_assert_not_reached ();
112     }
113 }
114 #undef MAP
115 
116 
117 typedef void (*test_setup) (gpointer);
118 
119 typedef struct _ServerParameters ServerParameters;
120 struct _ServerParameters {
121   struct { gboolean tls; gchar *auth_mech; gchar *version; } features;
122   struct { ServerProblem sasl; ConnectorProblem conn; } problem;
123   struct { gchar *user; gchar *pass; } auth;
124   guint port;
125   CertSet cert;
126 
127   /* Extra server for see-other-host problem */
128   ServerParameters *extra_server;
129 
130   /* Runtime */
131   TestConnectorServer *server;
132   GIOChannel *channel;
133   guint watch;
134 };
135 
136 typedef struct {
137   gchar *desc;
138   gboolean quiet;
139   struct { int domain;
140            int code;
141            int fallback_code;
142            gchar *mech;
143            gchar *used_mech;
144            gpointer xmpp;
145            gchar *jid;
146            gchar *sid;
147   } result;
148   ServerParameters server_parameters;
149   struct { char *srv; guint port; char *host; char *addr; char *srvhost; } dns;
150   struct {
151     gboolean require_tls;
152     struct { gchar *jid; gchar *pass; gboolean secure; gboolean tls; } auth;
153     struct { gchar *host; guint port; gboolean jabber; gboolean ssl; gboolean lax_ssl; const gchar *ca; } options;
154     int op;
155     test_setup setup;
156   } client;
157 
158   /* Runtime */
159   WockyConnector *connector;
160   gboolean ok;
161 } test_t;
162 
_set_connector_email_prop(test_t * test)163 static void _set_connector_email_prop (test_t *test)
164 {
165   g_object_set (G_OBJECT (test->connector), "email", "foo@bar.org", NULL);
166 }
167 
168 ServerParameters see_other_host_extra_server =
169   { { TLS, NULL },
170     { SERVER_PROBLEM_NO_PROBLEM, CONNECTOR_OK },
171     { "moose", "something" },
172     8222 };
173 
174 test_t tests[] =
175   { /* basic connection test, no SRV record, no host or port supplied: */
176     /*
177     { "/name/of/test",
178       SUPPRESS_STDERR,
179       // result of test:
180       { DOMAIN, CODE, FALLBACK_CODE,
181         AUTH_MECH_USED, XMPP_CONNECTION_PLACEHOLDER },
182       // When an error is expected it should match the domain and either
183       // the given CODE or the FALLBACK_CODE (GIO over time became more
184       // specific about the error codes it gave in certain conditions)
185 
186       // Server Details:
187       { { TLS_SUPPORT, AUTH_MECH_OR_NULL_FOR_ALL  },
188         { SERVER_PROBLEM..., CONNECTOR_PROBLEM... },
189         { USERNAME, PASSWORD },
190         SERVER_LISTEN_PORT, SERVER_CERT },
191 
192       // Fake DNS Record:
193       // SRV_HOSTs SRV record → { HOSTNAME, PORT }
194       // HOSTs     A   record → IP_ADDRESS
195       // SRV_HOSTs A   record → IP_ADDR_OF_SRV_HOST
196       { SRV_HOST, PORT, HOSTNAME, IP_ADDRESS, IP_ADDR_OF_SRV_HOST },
197 
198       // Client Details
199       { TLS_REQUIRED,
200         { BARE_JID, PASSWORD, MUST_BE_DIGEST_AUTH, MUST_BE_SECURE },
201         { XMPP_HOSTNAME_OR_NULL, XMPP_PORT_OR_ZERO, OLD_JABBER, OLD_SSL } }
202         SERVER_PROCESS_ID }, */
203 
204     /* simple connection, followed by checks on all the internal state *
205      * and get/set property methods to make sure they work             */
206 
207     { CONNECTOR_INTERNALS_TEST,
208       NOISY,
209       { S_NO_ERROR, },
210       { { TLS, NULL },
211         { SERVER_PROBLEM_NO_PROBLEM, CONNECTOR_OK },
212         { "moose", "something" },
213         PORT_XMPP },
214       { NULL, 0, "weasel-juice.org", REACHABLE, NULL },
215       { PLAINTEXT_OK,
216         { "moose@weasel-juice.org", "something", FALSE, NOTLS },
217         { NULL, 0 } } },
218 
219     { "/connector/see-other-host",
220       NOISY,
221       { S_NO_ERROR, },
222       { { TLS, NULL },
223         { SERVER_PROBLEM_NO_PROBLEM,
224           { XMPP_PROBLEM_SEE_OTHER_HOST, OK, OK, OK, OK } },
225         { "moose", "something" },
226         PORT_XMPP, CERT_STANDARD, &see_other_host_extra_server },
227       { "weasel-juice.org", PORT_XMPP, "thud.org", REACHABLE, UNREACHABLE },
228       { PLAINTEXT_OK,
229         { "moose@weasel-juice.org", "something", PLAIN, NOTLS },
230         { NULL, 0 } } },
231 
232     /* No SRV or connect host specified */
233     { "/connector/basic/noserv/nohost/noport",
234       NOISY,
235       { S_NO_ERROR, },
236       { { TLS, NULL },
237         { SERVER_PROBLEM_NO_PROBLEM, CONNECTOR_OK },
238         { "moose", "something" },
239         PORT_XMPP },
240       { NULL, 0, "weasel-juice.org", REACHABLE, NULL },
241       { PLAINTEXT_OK,
242         { "moose@weasel-juice.org", "something", PLAIN, NOTLS },
243         { NULL, 0 } } },
244 
245     /* No SRV or connect host specified, connect port specified */
246     { "/connector/basic/noserv/nohost/port",
247       NOISY,
248       { S_NO_ERROR, },
249       { { TLS, NULL },
250         { SERVER_PROBLEM_NO_PROBLEM, CONNECTOR_OK },
251         { "moose", "something" },
252         8222 },
253       { NULL, 0, "weasel-juice.org", REACHABLE, NULL },
254       { PLAINTEXT_OK,
255         { "moose@weasel-juice.org", "something", PLAIN, NOTLS },
256         { NULL, 8222 } } },
257 
258     /* No SRV or connect host specified, bad port specified: FAIL */
259     { "/connector/basic/noserv/nohost/duffport",
260       NOISY,
261       { S_G_IO_ERROR, G_IO_ERROR_CONNECTION_REFUSED, G_IO_ERROR_FAILED },
262       { { TLS, NULL },
263         { SERVER_PROBLEM_NO_PROBLEM, CONNECTOR_OK },
264         { "moose", "something" },
265         8222 },
266       { NULL, 0, "weasel-juice.org", REACHABLE, NULL },
267       { PLAINTEXT_OK,
268         { "moose@weasel-juice.org", "something", PLAIN, NOTLS },
269         { NULL, 8221 } } },
270 
271     /* No SRV record, connect host specified */
272     { "/connector/basic/noserv/host/noport",
273       NOISY,
274       { S_NO_ERROR, },
275       { { TLS, NULL },
276         { SERVER_PROBLEM_NO_PROBLEM, CONNECTOR_OK },
277         { "moose", "something" },
278         PORT_XMPP },
279       { NULL, 0, "schadenfreude.org", REACHABLE, NULL },
280       { PLAINTEXT_OK,
281         { "moose@weasel-juice.org", "something", PLAIN, NOTLS },
282         { "schadenfreude.org", 0 } } },
283 
284     /* No SRV record, connect host and port specified */
285     { "/connector/basic/noserv/host/port",
286       NOISY,
287       { S_NO_ERROR, },
288       { { TLS, NULL },
289         { SERVER_PROBLEM_NO_PROBLEM, CONNECTOR_OK },
290         { "moose", "something" },
291         5555 },
292       { NULL, 0, "meerkats.net", REACHABLE, NULL },
293       { PLAINTEXT_OK,
294         { "moose@weasel-juice.org", "something", PLAIN, NOTLS },
295         { "meerkats.net", 5555 } } },
296 
297     /* No SRV record, connect host and bad port specified: FAIL */
298     { "/connector/basic/noserv/host/duffport",
299       NOISY,
300       { S_G_IO_ERROR, G_IO_ERROR_CONNECTION_REFUSED, G_IO_ERROR_FAILED },
301       { { TLS, NULL },
302         { SERVER_PROBLEM_NO_PROBLEM, CONNECTOR_OK },
303         { "moose", "something" },
304         5555 },
305       { NULL, 0, "meerkats.net", REACHABLE, NULL },
306       { PLAINTEXT_OK,
307         { "moose@weasel-juice.org", "something", PLAIN, NOTLS },
308         { "meerkats.net", 5554 } } },
309 
310     /* No SRV record, bad connect host: FAIL */
311     { "/connector/basic/noserv/duffhost/noport",
312       NOISY,
313       { S_G_RESOLVER_ERROR, G_RESOLVER_ERROR_NOT_FOUND, -1 },
314       { { TLS, NULL },
315         { SERVER_PROBLEM_NO_PROBLEM, CONNECTOR_OK },
316         { NULL, NULL },
317         PORT_NONE },
318       { NULL, 0, NULL, NULL, NULL },
319       { PLAINTEXT_OK,
320         { "moose@weasel-juice.org", "something", PLAIN, NOTLS },
321         { DUFF_H0ST, 0 } } },
322 
323     /* No SRV record, bad connect host, port specified: FAIL */
324     { "/connector/basic/noserv/duffhost/port",
325       NOISY,
326       { S_G_RESOLVER_ERROR, G_RESOLVER_ERROR_NOT_FOUND, -1 },
327       { { TLS, NULL },
328         { SERVER_PROBLEM_NO_PROBLEM, CONNECTOR_OK },
329         { NULL, NULL },
330         PORT_NONE },
331       { NULL, 0, NULL, NULL, NULL },
332       { PLAINTEXT_OK,
333         { "moose@weasel-juice.org", "something", PLAIN, NOTLS },
334         { "still.no_such_host.at.all", 23 } } },
335 
336     /* SRV record specified */
337     { "/connector/basic/serv/nohost/noport",
338       NOISY,
339       { S_NO_ERROR, },
340       { { TLS, NULL },
341         { SERVER_PROBLEM_NO_PROBLEM, CONNECTOR_OK },
342         { "moose", "something" },
343         5050 },
344       { "weasel-juice.org", 5050, "thud.org", REACHABLE, UNREACHABLE },
345       { PLAINTEXT_OK,
346         { "moose@weasel-juice.org", "something", PLAIN, NOTLS },
347         { NULL, 0 } } },
348 
349     /* SRV record specified, port specified: ignore SRV and connect */
350     { "/connector/basic/serv/nohost/port",
351       NOISY,
352       { S_NO_ERROR, },
353       { { TLS, NULL },
354         { SERVER_PROBLEM_NO_PROBLEM, CONNECTOR_OK },
355         { "moose", "something" },
356         5051 },
357       { "weasel-juice.org", 5050, "thud.org", UNREACHABLE, REACHABLE },
358       { PLAINTEXT_OK,
359         { "moose@weasel-juice.org", "something", PLAIN, NOTLS },
360         { NULL, 5051 } } },
361 
362     /* SRV record specified, bad port: ignore SRV and FAIL */
363     { "/connector/basic/serv/nohost/duffport",
364       NOISY,
365       { S_G_IO_ERROR, G_IO_ERROR_CONNECTION_REFUSED, G_IO_ERROR_FAILED },
366       { { TLS, NULL },
367         { SERVER_PROBLEM_NO_PROBLEM, CONNECTOR_OK },
368         { "moose", "something" },
369         5051 },
370       { "weasel-juice.org", 5050, "thud.org", UNREACHABLE, REACHABLE },
371       { PLAINTEXT_OK,
372         { "moose@weasel-juice.org", "something", PLAIN, NOTLS },
373         { NULL, 5050 } } },
374 
375     /* SRV record, connect host specified: use connect host */
376     { "/connector/basic/serv/host/noport",
377       NOISY,
378       { S_NO_ERROR, },
379       { { TLS, NULL },
380         { SERVER_PROBLEM_NO_PROBLEM, CONNECTOR_OK },
381         { "moose", "something" },
382         PORT_XMPP },
383       { "weasel-juice.org", 5050, "thud.org", UNREACHABLE, UNREACHABLE },
384       { PLAINTEXT_OK,
385         { "moose@weasel-juice.org", "something", PLAIN, NOTLS },
386         { VISIBLE_HOST, 0 } } },
387 
388     /* SRV, connect host and port specified: use host and port */
389     { "/connector/basic/serv/host/port",
390       NOISY,
391       { S_NO_ERROR, },
392       { { TLS, NULL },
393         { SERVER_PROBLEM_NO_PROBLEM, CONNECTOR_OK },
394         { "moose", "something" },
395         5656 },
396       { "weasel-juice.org", 5050, "thud.org", UNREACHABLE, UNREACHABLE },
397       { PLAINTEXT_OK,
398         { "moose@weasel-juice.org", "something", PLAIN, NOTLS },
399         { VISIBLE_HOST, 5656 } } },
400 
401     /* SRV record, connect host, bad port: ignore SRV, FAIL */
402     { "/connector/basic/serv/host/duffport",
403       NOISY,
404       { S_G_IO_ERROR, G_IO_ERROR_CONNECTION_REFUSED, G_IO_ERROR_FAILED },
405       { { TLS, NULL },
406         { SERVER_PROBLEM_NO_PROBLEM, CONNECTOR_OK },
407         { "moose", "something" },
408         5656 },
409       { "weasel-juice.org", 5050, "thud.org", UNREACHABLE, UNREACHABLE },
410       { PLAINTEXT_OK,
411         { "moose@weasel-juice.org", "something", PLAIN, NOTLS },
412         { VISIBLE_HOST, 5655 } } },
413 
414     /* SRV record, bad connect host: use bad host and FAIL */
415     { "/connector/basic/serv/duffhost/noport",
416       NOISY,
417       { S_G_RESOLVER_ERROR, G_RESOLVER_ERROR_NOT_FOUND, -1 },
418       { { TLS, NULL },
419         { SERVER_PROBLEM_NO_PROBLEM, CONNECTOR_OK },
420         { "moose", "something" },
421         PORT_XMPP },
422       { "weasel-juice.org", PORT_XMPP, "thud.org", REACHABLE, REACHABLE },
423       { PLAINTEXT_OK,
424         { "moose@weasel-juice.org", "something", PLAIN, NOTLS },
425         { DUFF_H0ST, 0 } } },
426 
427     /* SRV record, bad connect host, connect port: use bad host and FAIL */
428     { "/connector/basic/serv/duffhost/port",
429       NOISY,
430       { S_G_RESOLVER_ERROR, G_RESOLVER_ERROR_NOT_FOUND, -1 },
431       { { TLS, NULL },
432         { SERVER_PROBLEM_NO_PROBLEM, CONNECTOR_OK },
433         { "moose", "something" },
434         PORT_XMPP },
435       { "weasel-juice.org", PORT_XMPP, "thud.org", REACHABLE, REACHABLE },
436       { PLAINTEXT_OK,
437         { "moose@weasel-juice.org", "something", PLAIN, NOTLS },
438         { DUFF_H0ST, PORT_XMPP } } },
439 
440     /* Facebook Chat has a broken SRV record: you ask for
441      * _xmpp-client._tcp.chat.facebook.com, and it gives you back a CNAME! So
442      * g_socket_client_connect_to_service() fails. But as it happens the real
443      * result should have just been chat.facebook.com anyway, so Wocky tries to
444      * fall back to that.
445      *
446      * So this test has a fake SRV record for an unreachable server, but
447      * expects to succeed because it's listening on the default XMPP port on
448      * our hypothetical 'weasel-juice.org'.
449      */
450     { "/connector/basic/facebook-chat-srv-workaround",
451       NOISY,
452       { S_NO_ERROR, },
453       { { TLS, NULL },
454         { SERVER_PROBLEM_NO_PROBLEM, CONNECTOR_OK },
455         { "moose", "something" },
456         PORT_XMPP },
457       { "weasel-juice.org", PORT_XMPP, "thud.org", UNREACHABLE, REACHABLE },
458       { PLAINTEXT_OK,
459         { "moose@weasel-juice.org", "something", PLAIN, NOTLS },
460         { NULL, 0 } } },
461 
462     /* Further to the above test, this one tests the case where the fallback
463      * doesn't work either. The server isn't listening anywhere (that's the
464      * PORT_NONE in the server_parameters sub-struct), and thud.org (the result
465      * of the SRV lookup) is unreachable. So the connection should fail.
466      */
467     { "/connector/basic/duffserv/nohost/noport",
468       NOISY,
469       { S_G_IO_ERROR, G_IO_ERROR_NETWORK_UNREACHABLE, G_IO_ERROR_FAILED },
470       { { TLS, NULL },
471         { SERVER_PROBLEM_NO_PROBLEM, CONNECTOR_OK },
472         { "moose", "something" },
473         PORT_NONE },
474       { "not.an.xmpp.server", PORT_XMPP, "thud.org", UNREACHABLE, REACHABLE },
475       { PLAINTEXT_OK,
476         { "moose@not.an.xmpp.server", "something", PLAIN, NOTLS },
477         { NULL, 0 } } },
478 
479     /* Bad SRV record, port specified, ignore SRV and connect to domain host */
480     { "/connector/basic/duffserv/nohost/port",
481       NOISY,
482       { S_NO_ERROR, },
483       { { TLS, NULL },
484         { SERVER_PROBLEM_NO_PROBLEM, CONNECTOR_OK },
485         { "moose", "something" },
486         5050 },
487       { "weasel-juice.org", PORT_XMPP, "thud.org", UNREACHABLE, REACHABLE },
488       { PLAINTEXT_OK,
489         { "moose@weasel-juice.org", "something", PLAIN, NOTLS },
490         { NULL, 5050 } } },
491 
492     /* Bad SRV record, bad port specified, ignore SRV and FAIL */
493     { "/connector/basic/duffserv/nohost/duffport",
494       NOISY,
495       { S_G_IO_ERROR, G_IO_ERROR_CONNECTION_REFUSED, G_IO_ERROR_FAILED },
496       { { TLS, NULL },
497         { SERVER_PROBLEM_NO_PROBLEM, CONNECTOR_OK },
498         { "moose", "something" },
499         5050 },
500       { "weasel-juice.org", PORT_XMPP, "thud.org", UNREACHABLE, REACHABLE },
501       { PLAINTEXT_OK,
502         { "moose@weasel-juice.org", "something", PLAIN, NOTLS },
503         { NULL, 5049 } } },
504 
505     /* Bad SRV record, connect host specified, ignore SRV */
506     { "/connector/basic/duffserv/host/noport",
507       NOISY,
508       { S_NO_ERROR, },
509       { { TLS, NULL },
510         { SERVER_PROBLEM_NO_PROBLEM, CONNECTOR_OK },
511         { "moose", "something" },
512         PORT_XMPP },
513       { "weasel-juice.org", 5050, "thud.org", UNREACHABLE, UNREACHABLE },
514       { PLAINTEXT_OK,
515         { "moose@weasel-juice.org", "something", PLAIN, NOTLS },
516         { VISIBLE_HOST, 0 } } },
517 
518     /* Bad SRV record, connect host and port given: ignore SRV */
519     { "/connector/basic/duffserv/host/port",
520       NOISY,
521       { S_NO_ERROR, },
522       { { TLS, NULL },
523         { SERVER_PROBLEM_NO_PROBLEM, CONNECTOR_OK },
524         { "moose", "something" },
525         5151 },
526       { "weasel-juice.org", 5050, "thud.org", UNREACHABLE, REACHABLE },
527       { PLAINTEXT_OK,
528         { "moose@weasel-juice.org", "something", PLAIN, NOTLS },
529         { VISIBLE_HOST, 5151 } } },
530 
531     /* Bad SRV record, connect host and bad port, ignore SRV and FAIL */
532     { "/connector/basic/duffserv/host/duffport",
533       NOISY,
534       { S_G_IO_ERROR, G_IO_ERROR_CONNECTION_REFUSED, G_IO_ERROR_FAILED },
535       { { TLS, NULL },
536         { SERVER_PROBLEM_NO_PROBLEM, CONNECTOR_OK },
537         { "moose", "something" },
538         5151 },
539       { "weasel-juice.org", 5050, "thud.org", UNREACHABLE, REACHABLE },
540       { PLAINTEXT_OK,
541         { "moose@weasel-juice.org", "something", PLAIN, NOTLS },
542         { VISIBLE_HOST, 5149 } } },
543 
544     /* Bad SRV record, bad host and bad port: Just FAIL */
545     { "/connector/basic/duffserv/duffhost/noport",
546       NOISY,
547       { S_G_IO_ERROR, G_IO_ERROR_NETWORK_UNREACHABLE, G_IO_ERROR_FAILED },
548       { { TLS, NULL },
549         { SERVER_PROBLEM_NO_PROBLEM, CONNECTOR_OK },
550         { "moose", "something" },
551         PORT_XMPP },
552       { "weasel-juice.org", 5050, "thud.org", UNREACHABLE, REACHABLE },
553       { PLAINTEXT_OK,
554         { "moose@weasel-juice.org", "something", PLAIN, NOTLS },
555         { INVISIBLE_HOST, 0 } } },
556 
557     /*Bad SRV and connect host, ignore SRV and FAIL */
558     { "/connector/basic/duffserv/duffhost/port",
559       NOISY,
560       { S_G_IO_ERROR, G_IO_ERROR_NETWORK_UNREACHABLE, G_IO_ERROR_FAILED },
561       { { TLS, NULL },
562         { SERVER_PROBLEM_NO_PROBLEM, CONNECTOR_OK },
563         { "moose", "something" },
564         5151 },
565       { "weasel-juice.org", 5050, "thud.org", UNREACHABLE, REACHABLE },
566       { PLAINTEXT_OK,
567         { "moose@weasel-juice.org", "something", PLAIN, NOTLS },
568         { INVISIBLE_HOST, 5151 } } },
569 
570     /* ******************************************************************* *
571      * that's it for the basic DNS/connection-logic tests                  *
572      * now onto the post-tcp-connect stages:                               */
573     { "/connector/auth/secure/no-tlsplain/notls/nodigest",
574       NOISY,
575       { S_WOCKY_AUTH_ERROR, WOCKY_AUTH_ERROR_NO_SUPPORTED_MECHANISMS, -1 },
576       { { NOTLS, "PLAIN" },
577         { SERVER_PROBLEM_NO_PROBLEM, CONNECTOR_OK },
578         { "moose", "something" },
579         PORT_XMPP },
580       { "weasel-juice.org", PORT_XMPP, "thud.org", REACHABLE, UNREACHABLE },
581       { PLAINTEXT_OK,
582         { "moose@weasel-juice.org", "something", DIGEST, TLS },
583         { NULL, 0 } } },
584 
585     { "/connector/auth/secure/no-tlsplain/notls/digest",
586       NOISY,
587       { S_NO_ERROR, 0, 0, "DIGEST-MD5" },
588       { { NOTLS, NULL },
589         { SERVER_PROBLEM_NO_PROBLEM, CONNECTOR_OK },
590         { "moose", "something" },
591         PORT_XMPP },
592       { "weasel-juice.org", PORT_XMPP, "thud.org", REACHABLE, UNREACHABLE },
593       { PLAINTEXT_OK,
594         { "moose@weasel-juice.org", "something", DIGEST, TLS },
595         { NULL, 0 } } },
596 
597     { "/connector/auth/insecure/no-tlsplain/notls/nodigest",
598       NOISY,
599       { S_NO_ERROR, 0, 0, "PLAIN" },
600       { { NOTLS, "PLAIN" },
601         { SERVER_PROBLEM_NO_PROBLEM, CONNECTOR_OK },
602         { "moose", "something" },
603         PORT_XMPP },
604       { "weasel-juice.org", PORT_XMPP, "thud.org", REACHABLE, UNREACHABLE },
605       { PLAINTEXT_OK,
606         { "moose@weasel-juice.org", "something", PLAIN, NOTLS },
607         { NULL, 0 } } },
608 
609     { "/connector/auth/insecure/no-tlsplain/notls/digest",
610       NOISY,
611       { S_NO_ERROR, 0, 0, "DIGEST-MD5" },
612       { { NOTLS, NULL },
613         { SERVER_PROBLEM_NO_PROBLEM, CONNECTOR_OK },
614         { "moose", "something" },
615         PORT_XMPP },
616       { "weasel-juice.org", PORT_XMPP, "thud.org", REACHABLE, UNREACHABLE },
617       { PLAINTEXT_OK,
618         { "moose@weasel-juice.org", "something", PLAIN, NOTLS },
619         { NULL, 0 } } },
620 
621     /* *************************************************************** *
622      * This block of tests will fail as we don't advertise TLS support */
623     { "/connector/auth/insecure/no-tlsplain/notls/any",
624       NOISY,
625       { S_WOCKY_CONNECTOR_ERROR, WOCKY_CONNECTOR_ERROR_TLS_UNAVAILABLE, -1 },
626       { { NOTLS, NULL },
627         { SERVER_PROBLEM_NO_PROBLEM, CONNECTOR_OK },
628         { "moose", "something" },
629         PORT_XMPP },
630       { "weasel-juice.org", PORT_XMPP, "thud.org", REACHABLE, UNREACHABLE },
631       { TLS_REQUIRED,
632         { "moose@weasel-juice.org", "something", PLAIN, TLS },
633         { NULL, 0 } } },
634 
635     { "/connector/auth/insecure/tlsplain/notls/any",
636       NOISY,
637       { S_WOCKY_CONNECTOR_ERROR, WOCKY_CONNECTOR_ERROR_TLS_UNAVAILABLE, -1 },
638       { { NOTLS, NULL },
639         { SERVER_PROBLEM_NO_PROBLEM, CONNECTOR_OK },
640         { "moose", "something" },
641         PORT_XMPP },
642       { "weasel-juice.org", PORT_XMPP, "thud.org", REACHABLE, UNREACHABLE },
643       { TLS_REQUIRED,
644         { "moose@weasel-juice.org", "something", PLAIN, NOTLS },
645         { NULL, 0 } } },
646 
647     { "/connector/auth/secure/no-tlsplain/notls/any",
648       NOISY,
649       { S_WOCKY_CONNECTOR_ERROR, WOCKY_CONNECTOR_ERROR_TLS_UNAVAILABLE, -1 },
650       { { NOTLS, NULL },
651         { SERVER_PROBLEM_NO_PROBLEM, CONNECTOR_OK },
652         { "moose", "something" },
653         PORT_XMPP },
654       { "weasel-juice.org", PORT_XMPP, "thud.org", REACHABLE, UNREACHABLE },
655       { TLS_REQUIRED,
656         { "moose@weasel-juice.org", "something", TRUE, TLS },
657         { NULL, 0 } } },
658 
659     { "/connector/auth/secure/tlsplain/notls/any",
660       NOISY,
661       { S_WOCKY_CONNECTOR_ERROR, WOCKY_CONNECTOR_ERROR_TLS_UNAVAILABLE, -1 },
662       { { NOTLS, NULL },
663         { SERVER_PROBLEM_NO_PROBLEM, CONNECTOR_OK },
664         { "moose", "something" },
665         PORT_XMPP },
666       { "weasel-juice.org", PORT_XMPP, "thud.org", REACHABLE, UNREACHABLE },
667       { TLS_REQUIRED,
668         { "moose@weasel-juice.org", "something", TRUE, NOTLS },
669         { NULL, 0 } } },
670 
671     /* **************************************************************** *
672      * this will be a mix of failures and sucesses depending on whether *
673      * we allow plain auth or not                                       */
674     { "/connector/auth/secure/no-tlsplain/tls/plain",
675       NOISY,
676       { S_WOCKY_AUTH_ERROR, WOCKY_AUTH_ERROR_NO_SUPPORTED_MECHANISMS, -1 },
677       { { TLS, "PLAIN" },
678         { SERVER_PROBLEM_INVALID_PASSWORD, CONNECTOR_OK },
679         { "moose", "something" },
680         PORT_XMPP },
681       { "weasel-juice.org", PORT_XMPP, "thud.org", REACHABLE, UNREACHABLE },
682       { PLAINTEXT_OK,
683         { "moose@weasel-juice.org", "something", DIGEST, TLS },
684         { NULL, 0 } } },
685 
686     { "/connector/auth/secure/tlsplain/tls/plain",
687       NOISY,
688       { S_NO_ERROR, 0, 0, "PLAIN" },
689       { { TLS, "PLAIN" },
690         { SERVER_PROBLEM_NO_PROBLEM, CONNECTOR_OK },
691         { "moose", "something" },
692         PORT_XMPP },
693       { "weasel-juice.org", PORT_XMPP, "thud.org", REACHABLE, UNREACHABLE },
694       { PLAINTEXT_OK,
695         { "moose@weasel-juice.org", "something", PLAIN, TLS },
696         { NULL, 0 } } },
697 
698     { "/connector/auth/insecure/no-tlsplain/tls/plain",
699       NOISY,
700       { S_NO_ERROR, 0, 0, "PLAIN" },
701       { { TLS, "PLAIN" },
702         { SERVER_PROBLEM_NO_PROBLEM, CONNECTOR_OK },
703         { "moose", "something" },
704         PORT_XMPP },
705       { "weasel-juice.org", PORT_XMPP, "thud.org", REACHABLE, UNREACHABLE },
706       { PLAINTEXT_OK,
707         { "moose@weasel-juice.org", "something", DIGEST, NOTLS },
708         { NULL, 0 } } },
709 
710     { "/connector/auth/insecure/tlsplain/tls/plain",
711       NOISY,
712       { S_NO_ERROR, 0, 0, "PLAIN" },
713       { { TLS, "PLAIN" },
714         { SERVER_PROBLEM_NO_PROBLEM, CONNECTOR_OK },
715         { "moose", "something" },
716         PORT_XMPP },
717       { "weasel-juice.org", PORT_XMPP, "thud.org", REACHABLE, UNREACHABLE },
718       { PLAINTEXT_OK,
719         { "moose@weasel-juice.org", "something", PLAIN, NOTLS },
720         { NULL, 0 } } },
721 
722     { "/connector/tls+auth/secure/no-tlsplain/tls/plain",
723       NOISY,
724       { S_WOCKY_AUTH_ERROR, WOCKY_AUTH_ERROR_NO_SUPPORTED_MECHANISMS, -1 },
725       { { TLS, "PLAIN" },
726         { SERVER_PROBLEM_NO_PROBLEM, CONNECTOR_OK },
727         { "moose", "something" },
728         PORT_XMPP },
729       { "weasel-juice.org", PORT_XMPP, "thud.org", REACHABLE, UNREACHABLE },
730       { PLAINTEXT_OK,
731         { "moose@weasel-juice.org", "something", DIGEST, TLS },
732         { NULL, 0 } } },
733 
734     { "/connector/tls+auth/secure/tlsplain/tls/plain",
735       NOISY,
736       { S_NO_ERROR, 0, 0, "PLAIN" },
737       { { TLS, "PLAIN" },
738         { SERVER_PROBLEM_NO_PROBLEM, CONNECTOR_OK },
739         { "moose", "something" },
740         PORT_XMPP },
741       { "weasel-juice.org", PORT_XMPP, "thud.org", REACHABLE, UNREACHABLE },
742       { PLAINTEXT_OK,
743         { "moose@weasel-juice.org", "something", PLAIN, TLS },
744         { NULL, 0 } } },
745 
746     { "/connector/tls+auth/insecure/no-tlsplain/tls/plain",
747       NOISY,
748       { S_NO_ERROR, 0, 0, "PLAIN" },
749       { { TLS, "PLAIN" },
750         { SERVER_PROBLEM_NO_PROBLEM, CONNECTOR_OK },
751         { "moose", "something" },
752         PORT_XMPP },
753       { "weasel-juice.org", PORT_XMPP, "thud.org", REACHABLE, UNREACHABLE },
754       { PLAINTEXT_OK,
755         { "moose@weasel-juice.org", "something", DIGEST, NOTLS },
756         { NULL, 0 } } },
757 
758     { "/connector/tls+auth/insecure/tlsplain/tls/plain",
759       NOISY,
760       { S_NO_ERROR, 0, 0, "PLAIN" },
761       { { TLS, "PLAIN" },
762         { SERVER_PROBLEM_NO_PROBLEM, CONNECTOR_OK },
763         { "moose", "something" },
764         PORT_XMPP },
765       { "weasel-juice.org", PORT_XMPP, "thud.org", REACHABLE, UNREACHABLE },
766       { PLAINTEXT_OK,
767         { "moose@weasel-juice.org", "something", PLAIN, NOTLS },
768         { NULL, 0 } } },
769     /* **************************************************************** *
770      * these should all be digest auth successes                        */
771     { "/connector/auth/secure/no-tlsplain/tls/digest",
772       NOISY,
773       { S_NO_ERROR, 0, 0, "DIGEST-MD5" },
774       { { TLS, NULL },
775         { SERVER_PROBLEM_NO_PROBLEM, CONNECTOR_OK },
776         { "moose", "something" },
777         PORT_XMPP },
778       { "weasel-juice.org", PORT_XMPP, "thud.org", REACHABLE, UNREACHABLE },
779       { PLAINTEXT_OK,
780         { "moose@weasel-juice.org", "something", DIGEST, TLS },
781         { NULL, 0 } } },
782 
783     { "/connector/auth/secure/tlsplain/tls/digest",
784       NOISY,
785       { S_NO_ERROR, 0, 0, "DIGEST-MD5" },
786       { { TLS, NULL },
787         { SERVER_PROBLEM_NO_PROBLEM, CONNECTOR_OK },
788         { "moose", "something" },
789         PORT_XMPP },
790       { "weasel-juice.org", PORT_XMPP, "thud.org", REACHABLE, UNREACHABLE },
791       { PLAINTEXT_OK,
792         { "moose@weasel-juice.org", "something", PLAIN, TLS },
793         { NULL, 0 } } },
794 
795     { "/connector/auth/insecure/no-tlsplain/tls/digest",
796       NOISY,
797       { S_NO_ERROR, 0, 0, "DIGEST-MD5" },
798       { { TLS, NULL },
799         { SERVER_PROBLEM_NO_PROBLEM, CONNECTOR_OK },
800         { "moose", "something" },
801         PORT_XMPP },
802       { "weasel-juice.org", PORT_XMPP, "thud.org", REACHABLE, UNREACHABLE },
803       { PLAINTEXT_OK,
804         { "moose@weasel-juice.org", "something", DIGEST, NOTLS },
805         { NULL, 0 } } },
806 
807     { "/connector/auth/insecure/tlsplain/tls/digest",
808       NOISY,
809       { S_NO_ERROR, 0, 0, "DIGEST-MD5" },
810       { { TLS, NULL },
811         { SERVER_PROBLEM_NO_PROBLEM, CONNECTOR_OK },
812         { "moose", "something" },
813         PORT_XMPP },
814       { "weasel-juice.org", PORT_XMPP, "thud.org", REACHABLE, UNREACHABLE },
815       { PLAINTEXT_OK,
816           { "moose@weasel-juice.org", "something", PLAIN, NOTLS },
817         { NULL, 0 } } },
818 
819     { "/connector/tls+auth/secure/no-tlsplain/tls/digest",
820       NOISY,
821       { S_NO_ERROR, 0, 0, "DIGEST-MD5" },
822       { { TLS, NULL },
823         { SERVER_PROBLEM_NO_PROBLEM, CONNECTOR_OK },
824         { "moose", "something" },
825         PORT_XMPP },
826       { "weasel-juice.org", PORT_XMPP, "thud.org", REACHABLE, UNREACHABLE },
827       { PLAINTEXT_OK,
828         { "moose@weasel-juice.org", "something", DIGEST, TLS },
829         { NULL, 0 } } },
830 
831     { "/connector/tls+auth/secure/tlsplain/tls/digest",
832       NOISY,
833       { S_NO_ERROR, 0, 0, "DIGEST-MD5" },
834       { { TLS, NULL },
835         { SERVER_PROBLEM_NO_PROBLEM, CONNECTOR_OK },
836         { "moose", "something" },
837         PORT_XMPP },
838       { "weasel-juice.org", PORT_XMPP, "thud.org", REACHABLE, UNREACHABLE },
839       { PLAINTEXT_OK,
840         { "moose@weasel-juice.org", "something", PLAIN, TLS },
841         { NULL, 0 } } },
842 
843     { "/connector/tls+auth/insecure/no-tlsplain/tls/digest",
844       NOISY,
845       { S_NO_ERROR, 0, 0, "DIGEST-MD5" },
846       { { TLS, NULL },
847         { SERVER_PROBLEM_NO_PROBLEM, CONNECTOR_OK },
848         { "moose", "something" },
849         PORT_XMPP },
850       { "weasel-juice.org", PORT_XMPP, "thud.org", REACHABLE, UNREACHABLE },
851       { PLAINTEXT_OK,
852         { "moose@weasel-juice.org", "something", DIGEST, NOTLS },
853         { NULL, 0 } } },
854 
855     { "/connector/tls+auth/insecure/tlsplain/tls/digest",
856       NOISY,
857       { S_NO_ERROR, 0, 0, "DIGEST-MD5" },
858       { { TLS, NULL },
859         { SERVER_PROBLEM_NO_PROBLEM, CONNECTOR_OK },
860         { "moose", "something" },
861         PORT_XMPP },
862       { "weasel-juice.org", PORT_XMPP, "thud.org", REACHABLE, UNREACHABLE },
863       { PLAINTEXT_OK,
864         { "moose@weasel-juice.org", "something", PLAIN, NOTLS },
865         { NULL, 0 } } },
866 
867     /* ***************************************************************** *
868      * SASL problems                                                     */
869     { "/connector/problem/sasl/bad-pass",
870       NOISY,
871       { S_WOCKY_AUTH_ERROR, WOCKY_AUTH_ERROR_FAILURE, -1 },
872       { { TLS, NULL },
873         { SERVER_PROBLEM_INVALID_PASSWORD, CONNECTOR_OK },
874         { "foo", "bar" },
875         PORT_XMPP },
876       { "weasel-juice.org", PORT_XMPP, "thud.org", REACHABLE, UNREACHABLE },
877       { PLAINTEXT_OK,
878         { "foo@weasel-juice.org", "notbar", PLAIN, NOTLS },
879         { NULL, 0 } } },
880 
881     { "/connector/problem/sasl/bad-user",
882       NOISY,
883       { S_WOCKY_AUTH_ERROR, WOCKY_AUTH_ERROR_FAILURE, -1 },
884       { { TLS, NULL },
885         { SERVER_PROBLEM_INVALID_USERNAME, CONNECTOR_OK },
886         { "moose", "something" },
887         PORT_XMPP },
888       { "weasel-juice.org", PORT_XMPP, "thud.org", REACHABLE, UNREACHABLE },
889       { PLAINTEXT_OK,
890         { "caribou@weasel-juice.org", "something", PLAIN, NOTLS },
891         { NULL, 0 } } },
892 
893     { "/connector/problem/sasl/no-sasl",
894       NOISY,
895       { S_WOCKY_AUTH_ERROR, WOCKY_AUTH_ERROR_NOT_SUPPORTED, -1 },
896       { { TLS, NULL },
897         { SERVER_PROBLEM_NO_SASL, CONNECTOR_OK },
898         { "moose", "something" },
899         PORT_XMPP },
900       { "weasel-juice.org", PORT_XMPP, "thud.org", REACHABLE, UNREACHABLE },
901       { PLAINTEXT_OK,
902         { "moose@weasel-juice.org", "something", PLAIN, NOTLS },
903         { NULL, 0 } } },
904 
905     { "/connector/problem/sasl/no-mechanisms",
906       NOISY,
907       { S_WOCKY_AUTH_ERROR, WOCKY_AUTH_ERROR_NOT_SUPPORTED, -1 },
908       { { TLS, NULL },
909         { SERVER_PROBLEM_NO_MECHANISMS, CONNECTOR_OK },
910         { "moose", "something" },
911         PORT_XMPP },
912       { "weasel-juice.org", PORT_XMPP, "thud.org", REACHABLE, UNREACHABLE },
913       { PLAINTEXT_OK,
914         { "moose@weasel-juice.org", "something", PLAIN, NOTLS },
915         { NULL, 0 } } },
916 
917     { "/connector/problem/sasl/bad-mechanism",
918       NOISY,
919       { S_WOCKY_AUTH_ERROR, WOCKY_AUTH_ERROR_NO_SUPPORTED_MECHANISMS, -1 },
920       { { TLS, "omg-poniez" },
921         { SERVER_PROBLEM_NO_PROBLEM, CONNECTOR_OK },
922         { "moose", "something" },
923         PORT_XMPP },
924       { "weasel-juice.org", PORT_XMPP, "thud.org", REACHABLE, UNREACHABLE },
925       { PLAINTEXT_OK,
926         { "moose@weasel-juice.org", "something", PLAIN, NOTLS },
927         { NULL, 0 } } },
928 
929     /* ********************************************************************* */
930     /* TLS error conditions */
931     { "/connector/problem/tls/refused",
932       NOISY,
933       { S_WOCKY_CONNECTOR_ERROR, WOCKY_CONNECTOR_ERROR_TLS_REFUSED, -1 },
934       { { TLS, NULL },
935         { SERVER_PROBLEM_NO_PROBLEM,
936           { XMPP_PROBLEM_TLS_REFUSED, OK, OK, OK, OK} },
937         { "moose", "something" },
938         PORT_XMPP },
939       { "weasel-juice.org", PORT_XMPP, "thud.org", REACHABLE, UNREACHABLE },
940       { PLAINTEXT_OK,
941         { "moose@weasel-juice.org", "something", PLAIN, NOTLS },
942         { NULL, 0 } } },
943 
944     /* ********************************************************************* *
945      * Invalid JID                                                           */
946     { "/connector/problem/jid/invalid",
947       NOISY,
948       { S_WOCKY_CONNECTOR_ERROR, WOCKY_CONNECTOR_ERROR_BAD_JID, -1 },
949       { { TLS, NULL },
950         { SERVER_PROBLEM_NO_PROBLEM, CONNECTOR_OK },
951         { "moose", "something" },
952         PORT_NONE },
953       { NULL, 0, "thud.org", REACHABLE },
954       { PLAINTEXT_OK,
955         { "bla@h@_b&la<>h", "something", PLAIN, NOTLS },
956         { "weasel-juice.org", PORT_XMPP } } },
957 
958     { "/connector/problem/jid/domainless",
959       NOISY,
960       { S_WOCKY_CONNECTOR_ERROR, WOCKY_CONNECTOR_ERROR_BAD_JID, -1 },
961       { { TLS, NULL },
962         { SERVER_PROBLEM_NO_PROBLEM, CONNECTOR_OK },
963         { "moose", "something" },
964         PORT_NONE },
965       { "weasel-juice.org", 5001, "thud.org", REACHABLE, REACHABLE },
966       { PLAINTEXT_OK,
967         { "moose@", "something", PLAIN, NOTLS },
968         { "weasel-juice.org", 0 } } },
969 
970     /* ********************************************************************* *
971      * XMPP errors                                                           */
972     { "/connector/problem/xmpp/version/0.x",
973       NOISY,
974       { S_WOCKY_CONNECTOR_ERROR,
975           WOCKY_CONNECTOR_ERROR_NON_XMPP_V1_SERVER, -1 },
976       { { TLS, NULL, "0.9" },
977         { SERVER_PROBLEM_NO_PROBLEM, CONNECTOR_OK },
978         { "moose", "something" },
979         PORT_XMPP },
980       { "weasel-juice.org", PORT_XMPP, "thud.org", REACHABLE, UNREACHABLE },
981       { PLAINTEXT_OK,
982         { "moose@weasel-juice.org", "something", PLAIN, NOTLS },
983         { NULL, 0 } } },
984 
985     /* we actually tolerate > 1.0 versions */
986     { "/connector/problem/xmpp/version/1.x",
987       NOISY,
988       { S_NO_ERROR, 0, 0, "DIGEST-MD5" },
989       { { TLS, NULL, "1.1" },
990         { SERVER_PROBLEM_NO_PROBLEM, CONNECTOR_OK },
991         { "moose", "something" },
992         PORT_XMPP },
993       { "weasel-juice.org", PORT_XMPP, "thud.org", REACHABLE, UNREACHABLE },
994       { PLAINTEXT_OK,
995         { "moose@weasel-juice.org", "something", PLAIN, NOTLS },
996         { NULL, 0 } } },
997 
998     { "/connector/problem/xmpp/error/host-unknown",
999       NOISY,
1000       { S_WOCKY_XMPP_STREAM_ERROR,
1001         WOCKY_XMPP_STREAM_ERROR_HOST_UNKNOWN, -1 },
1002       { { TLS, NULL },
1003         { SERVER_PROBLEM_NO_PROBLEM,
1004           { XMPP_PROBLEM_OTHER_HOST, OK, OK, OK, OK } },
1005         { "moose", "something" },
1006         PORT_XMPP },
1007       { "weasel-juice.org", PORT_XMPP, "thud.org", REACHABLE, UNREACHABLE },
1008       { PLAINTEXT_OK,
1009         { "moose@weasel-juice.org", "something", PLAIN, NOTLS },
1010         { NULL, 0 } } },
1011 
1012     { "/connector/problem/xmpp/error/tls-load",
1013       NOISY,
1014       { S_WOCKY_XMPP_STREAM_ERROR,
1015         WOCKY_XMPP_STREAM_ERROR_RESOURCE_CONSTRAINT, -1 },
1016       { { TLS, NULL },
1017         { SERVER_PROBLEM_NO_PROBLEM,
1018           { XMPP_PROBLEM_TLS_LOAD, OK, OK, OK, OK } },
1019         { "moose", "something" },
1020         PORT_XMPP },
1021       { "weasel-juice.org", PORT_XMPP, "thud.org", REACHABLE, UNREACHABLE },
1022       { PLAINTEXT_OK,
1023         { "moose@weasel-juice.org", "something", PLAIN, NOTLS },
1024         { NULL, 0 } } },
1025 
1026     { "/connector/problem/xmpp/error/bind-conflict",
1027       NOISY,
1028       { S_WOCKY_XMPP_STREAM_ERROR, WOCKY_XMPP_STREAM_ERROR_CONFLICT, -1 },
1029       { { TLS, NULL },
1030         { SERVER_PROBLEM_NO_PROBLEM,
1031           { OK, BIND_PROBLEM_CLASH, OK, OK, OK } },
1032         { "moose", "something" },
1033         PORT_XMPP },
1034       { "weasel-juice.org", PORT_XMPP, "thud.org", REACHABLE, UNREACHABLE },
1035       { PLAINTEXT_OK,
1036         { "moose@weasel-juice.org", "something", PLAIN, NOTLS },
1037         { NULL, 0 } } },
1038 
1039     { "/connector/problem/xmpp/error/session-fail",
1040       NOISY,
1041       { S_WOCKY_XMPP_STREAM_ERROR,
1042         WOCKY_XMPP_STREAM_ERROR_RESOURCE_CONSTRAINT, -1 },
1043       { { TLS, NULL },
1044         { SERVER_PROBLEM_NO_PROBLEM,
1045           { OK, OK, SESSION_PROBLEM_NO_SESSION, OK, OK } },
1046         { "moose", "something" },
1047         PORT_XMPP },
1048       { "weasel-juice.org", PORT_XMPP, "thud.org", REACHABLE, UNREACHABLE },
1049       { PLAINTEXT_OK,
1050         { "moose@weasel-juice.org", "something", PLAIN, NOTLS },
1051         { NULL, 0 } } },
1052 
1053     { "/connector/problem/xmpp/features",
1054       NOISY,
1055       { S_WOCKY_CONNECTOR_ERROR, WOCKY_CONNECTOR_ERROR_BAD_FEATURES, -1 },
1056       { { TLS, NULL },
1057         { SERVER_PROBLEM_NO_PROBLEM,
1058           { XMPP_PROBLEM_FEATURES, OK, OK, OK, OK } },
1059         { "moose", "something" },
1060         PORT_XMPP },
1061       { "weasel-juice.org", PORT_XMPP, "thud.org", REACHABLE, UNREACHABLE },
1062       { PLAINTEXT_OK,
1063         { "moose@weasel-juice.org", "something", PLAIN, NOTLS },
1064         { NULL, 0 } } },
1065 
1066     /* WOCKY_CONNECTOR_ERROR_BIND_UNAVAILABLE */
1067     { "/connector/problem/xmpp/no-bind",
1068       NOISY,
1069       { S_WOCKY_CONNECTOR_ERROR, WOCKY_CONNECTOR_ERROR_BIND_UNAVAILABLE, -1 },
1070       { { TLS, NULL },
1071         { SERVER_PROBLEM_NO_PROBLEM,
1072           { XMPP_PROBLEM_CANNOT_BIND, OK, OK, OK, OK } },
1073         { "moose", "something" },
1074         PORT_XMPP },
1075       { "weasel-juice.org", PORT_XMPP, "thud.org", REACHABLE, UNREACHABLE },
1076       { PLAINTEXT_OK,
1077         { "moose@weasel-juice.org", "something", PLAIN, NOTLS },
1078         { NULL, 0 } } },
1079 
1080     /* WOCKY_CONNECTOR_ERROR_BIND_INVALID      */
1081     { "/connector/problem/xmpp/bind/invalid",
1082       NOISY,
1083       { S_WOCKY_CONNECTOR_ERROR, WOCKY_CONNECTOR_ERROR_BIND_INVALID, -1 },
1084       { { TLS, NULL },
1085         { SERVER_PROBLEM_NO_PROBLEM,
1086           { OK, BIND_PROBLEM_INVALID, OK, OK, OK } },
1087         { "moose", "something" },
1088         PORT_XMPP },
1089       { "weasel-juice.org", PORT_XMPP, "thud.org", REACHABLE, UNREACHABLE },
1090       { PLAINTEXT_OK,
1091         { "moose@weasel-juice.org", "something", PLAIN, NOTLS },
1092         { NULL, 0 } } },
1093 
1094     /* WOCKY_CONNECTOR_ERROR_BIND_DENIED     */
1095     { "/connector/problem/xmpp/bind/denied",
1096       NOISY,
1097       { S_WOCKY_CONNECTOR_ERROR, WOCKY_CONNECTOR_ERROR_BIND_DENIED, -1 },
1098       { { TLS, NULL },
1099         { SERVER_PROBLEM_NO_PROBLEM,
1100           { OK, BIND_PROBLEM_DENIED, OK, OK, OK } },
1101         { "moose", "something" },
1102         PORT_XMPP },
1103       { "weasel-juice.org", PORT_XMPP, "thud.org", REACHABLE, UNREACHABLE },
1104       { PLAINTEXT_OK,
1105         { "moose@weasel-juice.org", "something", PLAIN, NOTLS },
1106         { NULL, 0 } } },
1107 
1108     /* WOCKY_CONNECTOR_ERROR_BIND_CONFLICT      */
1109     { "/connector/problem/xmpp/bind/conflict",
1110       NOISY,
1111       { S_WOCKY_CONNECTOR_ERROR, WOCKY_CONNECTOR_ERROR_BIND_CONFLICT, -1 },
1112       { { TLS, NULL },
1113         { SERVER_PROBLEM_NO_PROBLEM,
1114           { OK, BIND_PROBLEM_CONFLICT, OK, OK, OK } },
1115         { "moose", "something" },
1116         PORT_XMPP },
1117       { "weasel-juice.org", PORT_XMPP, "thud.org", REACHABLE, UNREACHABLE },
1118       { PLAINTEXT_OK,
1119         { "moose@weasel-juice.org", "something", PLAIN, NOTLS },
1120         { NULL, 0 } } },
1121 
1122     /* WOCKY_CONNECTOR_ERROR_BIND_REJECTED    */
1123     { "/connector/problem/xmpp/bind/rejected",
1124       NOISY,
1125       { S_WOCKY_CONNECTOR_ERROR, WOCKY_CONNECTOR_ERROR_BIND_REJECTED, -1 },
1126       { { TLS, NULL },
1127         { SERVER_PROBLEM_NO_PROBLEM,
1128           { OK, BIND_PROBLEM_REJECTED, OK, OK, OK } },
1129         { "moose", "something" },
1130         PORT_XMPP },
1131       { "weasel-juice.org", PORT_XMPP, "thud.org", REACHABLE, UNREACHABLE },
1132       { PLAINTEXT_OK,
1133         { "moose@weasel-juice.org", "something", PLAIN, NOTLS },
1134         { NULL, 0 } } },
1135 
1136     /* WOCKY_CONNECTOR_ERROR_BIND_FAILED    */
1137     { "/connector/problem/xmpp/bind/failed",
1138       NOISY,
1139       { S_WOCKY_CONNECTOR_ERROR, WOCKY_CONNECTOR_ERROR_BIND_FAILED, -1 },
1140       { { TLS, NULL },
1141         { SERVER_PROBLEM_NO_PROBLEM,
1142           { OK, BIND_PROBLEM_FAILED, OK, OK, OK } },
1143         { "moose", "something" },
1144         PORT_XMPP },
1145       { "weasel-juice.org", PORT_XMPP, "thud.org", REACHABLE, UNREACHABLE },
1146       { PLAINTEXT_OK,
1147         { "moose@weasel-juice.org", "something", PLAIN, NOTLS },
1148         { NULL, 0 } } },
1149 
1150     { "/connector/problem/xmpp/bind/nonsense",
1151       NOISY,
1152       { S_WOCKY_CONNECTOR_ERROR, WOCKY_CONNECTOR_ERROR_BIND_FAILED, -1 },
1153       { { TLS, NULL },
1154         { SERVER_PROBLEM_NO_PROBLEM,
1155           { OK, BIND_PROBLEM_NONSENSE, OK, OK, OK } },
1156         { "moose", "something" },
1157         PORT_XMPP },
1158       { "weasel-juice.org", PORT_XMPP, "thud.org", REACHABLE, UNREACHABLE },
1159       { PLAINTEXT_OK,
1160         { "moose@weasel-juice.org", "something", PLAIN, NOTLS },
1161         { NULL, 0 } } },
1162 
1163     { "/connector/problem/xmpp/bind/no-jid",
1164       NOISY,
1165       { S_NO_ERROR, 0, 0, "DIGEST-MD5" },
1166       { { TLS, NULL },
1167         { SERVER_PROBLEM_NO_PROBLEM,
1168           { OK, BIND_PROBLEM_NO_JID, OK, OK, OK } },
1169         { "moose", "something" },
1170         PORT_XMPP },
1171       { "weasel-juice.org", PORT_XMPP, "thud.org", REACHABLE, UNREACHABLE },
1172       { PLAINTEXT_OK,
1173         { "moose@weasel-juice.org", "something", PLAIN, NOTLS },
1174         { NULL, 0 } } },
1175 
1176     { "/connector/problem/xmpp/session/none",
1177       NOISY,
1178       { S_NO_ERROR, 0, 0, "DIGEST-MD5" },
1179       { { TLS, NULL },
1180         { SERVER_PROBLEM_NO_PROBLEM,
1181           { XMPP_PROBLEM_NO_SESSION, OK, OK, OK, OK } },
1182         { "moose", "something" },
1183         PORT_XMPP },
1184       { "weasel-juice.org", PORT_XMPP, "thud.org", REACHABLE, UNREACHABLE },
1185       { PLAINTEXT_OK,
1186         { "moose@weasel-juice.org", "something", PLAIN, NOTLS },
1187         { NULL, 0 } } },
1188 
1189     /* WOCKY_CONNECTOR_ERROR_SESSION_FAILED   */
1190     { "/connector/problem/xmpp/session/failed",
1191       NOISY,
1192       { S_WOCKY_CONNECTOR_ERROR, WOCKY_CONNECTOR_ERROR_SESSION_FAILED, -1 },
1193       { { TLS, NULL },
1194         { SERVER_PROBLEM_NO_PROBLEM,
1195           { OK, OK, SESSION_PROBLEM_FAILED, OK, OK } },
1196         { "moose", "something" },
1197         PORT_XMPP },
1198       { "weasel-juice.org", PORT_XMPP, "thud.org", REACHABLE, UNREACHABLE },
1199       { PLAINTEXT_OK,
1200         { "moose@weasel-juice.org", "something", PLAIN, NOTLS },
1201         { NULL, 0 } } },
1202 
1203     /* WOCKY_CONNECTOR_ERROR_SESSION_DENIED   */
1204     { "/connector/problem/xmpp/session/denied",
1205       NOISY,
1206       { S_WOCKY_CONNECTOR_ERROR, WOCKY_CONNECTOR_ERROR_SESSION_DENIED, -1 },
1207       { { TLS, NULL },
1208         { SERVER_PROBLEM_NO_PROBLEM,
1209           { OK, OK, SESSION_PROBLEM_DENIED, OK, OK } },
1210         { "moose", "something" },
1211         PORT_XMPP },
1212       { "weasel-juice.org", PORT_XMPP, "thud.org", REACHABLE, UNREACHABLE },
1213       { PLAINTEXT_OK,
1214         { "moose@weasel-juice.org", "something", PLAIN, NOTLS },
1215         { NULL, 0 } } },
1216 
1217     /* WOCKY_CONNECTOR_ERROR_SESSION_CONFLICT */
1218     { "/connector/problem/xmpp/session/conflict",
1219       NOISY,
1220       { S_WOCKY_CONNECTOR_ERROR, WOCKY_CONNECTOR_ERROR_SESSION_CONFLICT, -1 },
1221       { { TLS, NULL },
1222         { SERVER_PROBLEM_NO_PROBLEM,
1223           { OK, OK, SESSION_PROBLEM_CONFLICT, OK, OK } },
1224         { "moose", "something" },
1225         PORT_XMPP },
1226       { "weasel-juice.org", PORT_XMPP, "thud.org", REACHABLE, UNREACHABLE },
1227       { PLAINTEXT_OK,
1228         { "moose@weasel-juice.org", "something", PLAIN, NOTLS },
1229         { NULL, 0 } } },
1230 
1231     /* WOCKY_CONNECTOR_ERROR_SESSION_REJECTED */
1232     { "/connector/problem/xmpp/session/rejected",
1233       NOISY,
1234       { S_WOCKY_CONNECTOR_ERROR, WOCKY_CONNECTOR_ERROR_SESSION_REJECTED, -1 },
1235       { { TLS, NULL },
1236         { SERVER_PROBLEM_NO_PROBLEM,
1237           { OK, OK, SESSION_PROBLEM_REJECTED, OK, OK } },
1238         { "moose", "something" },
1239         PORT_XMPP },
1240       { "weasel-juice.org", PORT_XMPP, "thud.org", REACHABLE, UNREACHABLE },
1241       { PLAINTEXT_OK,
1242         { "moose@weasel-juice.org", "something", PLAIN, NOTLS },
1243         { NULL, 0 } } },
1244 
1245     { "/connector/problem/xmpp/session/nonsense",
1246       NOISY,
1247       { S_WOCKY_CONNECTOR_ERROR, WOCKY_CONNECTOR_ERROR_SESSION_FAILED, -1 },
1248       { { TLS, NULL },
1249         { SERVER_PROBLEM_NO_PROBLEM,
1250           { OK, OK, SESSION_PROBLEM_NONSENSE, OK, OK } },
1251         { "moose", "something" },
1252         PORT_XMPP },
1253       { "weasel-juice.org", PORT_XMPP, "thud.org", REACHABLE, UNREACHABLE },
1254       { PLAINTEXT_OK,
1255         { "moose@weasel-juice.org", "something", PLAIN, NOTLS },
1256         { NULL, 0 } } },
1257 
1258     { "/connector/econnreset/server-start",
1259       NOISY,
1260       { S_ANY_ERROR, 0 },
1261       { { TLS, NULL },
1262         { SERVER_PROBLEM_NO_PROBLEM,
1263           { OK, OK, OK, SERVER_DEATH_SERVER_START, OK } },
1264         { "moose", "something" },
1265         PORT_XMPP },
1266       { "weasel-juice.org", PORT_XMPP, "thud.org", REACHABLE, UNREACHABLE },
1267       { PLAINTEXT_OK,
1268         { "moose@weasel-juice.org", "something", PLAIN, NOTLS },
1269         { NULL, 0 } } },
1270 
1271     { "/connector/econnreset/client-open",
1272       NOISY,
1273       { S_ANY_ERROR, 0 },
1274       { { TLS, NULL },
1275         { SERVER_PROBLEM_NO_PROBLEM,
1276           { OK, OK, OK, SERVER_DEATH_CLIENT_OPEN, OK } },
1277         { "moose", "something" },
1278         PORT_XMPP },
1279       { "weasel-juice.org", PORT_XMPP, "thud.org", REACHABLE, UNREACHABLE },
1280       { PLAINTEXT_OK,
1281         { "moose@weasel-juice.org", "something", PLAIN, NOTLS },
1282         { NULL, 0 } } },
1283 
1284     { "/connector/econnreset/server-open",
1285       NOISY,
1286       { S_ANY_ERROR, 0 },
1287       { { TLS, NULL },
1288         { SERVER_PROBLEM_NO_PROBLEM,
1289           { OK, OK, OK, SERVER_DEATH_SERVER_OPEN, OK } },
1290         { "moose", "something" },
1291         PORT_XMPP },
1292       { "weasel-juice.org", PORT_XMPP, "thud.org", REACHABLE, UNREACHABLE },
1293       { PLAINTEXT_OK,
1294         { "moose@weasel-juice.org", "something", PLAIN, NOTLS },
1295         { NULL, 0 } } },
1296 
1297     { "/connector/econnreset/features",
1298       NOISY,
1299       { S_ANY_ERROR, 0 },
1300       { { TLS, NULL },
1301         { SERVER_PROBLEM_NO_PROBLEM,
1302           { OK, OK, OK, SERVER_DEATH_FEATURES, OK } },
1303         { "moose", "something" },
1304         PORT_XMPP },
1305       { "weasel-juice.org", PORT_XMPP, "thud.org", REACHABLE, UNREACHABLE },
1306       { PLAINTEXT_OK,
1307         { "moose@weasel-juice.org", "something", PLAIN, NOTLS },
1308         { NULL, 0 } } },
1309 
1310     { "/connector/econnreset/tls-negotiate",
1311       QUIET,
1312       { S_ANY_ERROR, 0 },
1313       { { TLS, NULL },
1314         { SERVER_PROBLEM_NO_PROBLEM,
1315           { OK, OK, OK, SERVER_DEATH_TLS_NEG, OK } },
1316         { "moose", "something" },
1317         PORT_XMPP },
1318       { "weasel-juice.org", PORT_XMPP, "thud.org", REACHABLE, UNREACHABLE },
1319       { PLAINTEXT_OK,
1320         { "moose@weasel-juice.org", "something", PLAIN, NOTLS },
1321         { NULL, 0 } } },
1322     /* ******************************************************************** */
1323     /* quirks                                                               */
1324     { "/connector/google/domain-discovery/require",
1325       QUIET,
1326       { S_NO_ERROR, 0, 0, "DIGEST-MD5" },
1327       { { TLS, NULL },
1328         { SERVER_PROBLEM_REQUIRE_GOOGLE_JDD, CONNECTOR_OK },
1329         { "moose", "something" },
1330         PORT_XMPP },
1331       { "weasel-juice.org", PORT_XMPP, "thud.org", REACHABLE, UNREACHABLE },
1332       { PLAINTEXT_OK,
1333         { "moose@weasel-juice.org", "something", PLAIN, NOTLS },
1334         { NULL, 0 } } },
1335 
1336     { "/connector/google/domain-discovery/dislike",
1337       QUIET,
1338       { S_WOCKY_AUTH_ERROR, WOCKY_AUTH_ERROR_FAILURE, -1 },
1339       { { TLS, NULL },
1340         { SERVER_PROBLEM_DISLIKE_GOOGLE_JDD, CONNECTOR_OK },
1341         { "moose", "something" },
1342         PORT_XMPP },
1343       { "weasel-juice.org", PORT_XMPP, "thud.org", REACHABLE, UNREACHABLE },
1344       { PLAINTEXT_OK,
1345         { "moose@weasel-juice.org", "something", PLAIN, NOTLS },
1346         { NULL, 0 } } },
1347 
1348     /* ******************************************************************** */
1349     /* XEP 0077                                                             */
1350     { "/connector/xep77/register/ok",
1351       NOISY,
1352       { S_NO_ERROR, },
1353       { { TLS, NULL },
1354         { SERVER_PROBLEM_NO_PROBLEM, CONNECTOR_OK },
1355         { "moose", "something" },
1356         PORT_XMPP },
1357       { NULL, 0, "weasel-juice.org", REACHABLE, NULL },
1358       { PLAINTEXT_OK,
1359         { "moose@weasel-juice.org", "something", PLAIN, NOTLS },
1360         { NULL, 0 },
1361         OP_REGISTER } },
1362 
1363     { "/connector/xep77/register/no-args",
1364       NOISY,
1365       { S_WOCKY_CONNECTOR_ERROR,
1366         WOCKY_CONNECTOR_ERROR_REGISTRATION_EMPTY, -1 },
1367       { { TLS, NULL },
1368         { SERVER_PROBLEM_NO_PROBLEM,
1369           { OK, OK, OK, OK, OK, XEP77_PROBLEM_NO_ARGS } },
1370         { "moose", "something" },
1371         PORT_XMPP },
1372       { NULL, 0, "weasel-juice.org", REACHABLE, NULL },
1373       { PLAINTEXT_OK,
1374         { "moose@weasel-juice.org", "something", PLAIN, NOTLS },
1375         { NULL, 0 },
1376         OP_REGISTER } },
1377 
1378     { "/connector/xep77/register/email-missing",
1379       NOISY,
1380       { S_WOCKY_CONNECTOR_ERROR,
1381         WOCKY_CONNECTOR_ERROR_REGISTRATION_REJECTED, -1 },
1382       { { TLS, NULL },
1383         { SERVER_PROBLEM_NO_PROBLEM,
1384           { OK, OK, OK, OK, OK, XEP77_PROBLEM_EMAIL_ARG } },
1385         { "moose", "something" },
1386         PORT_XMPP },
1387       { NULL, 0, "weasel-juice.org", REACHABLE, NULL },
1388       { PLAINTEXT_OK,
1389         { "moose@weasel-juice.org", "something", PLAIN, NOTLS },
1390         { NULL, 0 },
1391         OP_REGISTER } },
1392 
1393     { "/connector/xep77/register/unknown-arg",
1394       NOISY,
1395       { S_WOCKY_CONNECTOR_ERROR,
1396         WOCKY_CONNECTOR_ERROR_REGISTRATION_UNSUPPORTED, -1 },
1397       { { TLS, NULL },
1398         { SERVER_PROBLEM_NO_PROBLEM,
1399           { OK, OK, OK, OK, OK, XEP77_PROBLEM_STRANGE_ARG } },
1400         { "moose", "something" },
1401         PORT_XMPP },
1402       { NULL, 0, "weasel-juice.org", REACHABLE, NULL },
1403       { PLAINTEXT_OK,
1404         { "moose@weasel-juice.org", "something", PLAIN, NOTLS },
1405         { NULL, 0 },
1406         OP_REGISTER } },
1407 
1408     { "/connector/xep77/register/unknown+email-args",
1409       NOISY,
1410       { S_ANY_ERROR, },
1411       { { TLS, NULL },
1412         { SERVER_PROBLEM_NO_PROBLEM,
1413           { OK, OK, OK, OK, OK,
1414             XEP77_PROBLEM_STRANGE_ARG|XEP77_PROBLEM_EMAIL_ARG } },
1415         { "moose", "something" },
1416         PORT_XMPP },
1417       { NULL, 0, "weasel-juice.org", REACHABLE, NULL },
1418       { PLAINTEXT_OK,
1419         { "moose@weasel-juice.org", "something", PLAIN, NOTLS },
1420         { NULL, 0 },
1421         OP_REGISTER } },
1422 
1423     { "/connector/xep77/register/email-arg-ok",
1424       NOISY,
1425       { S_NO_ERROR, 0, 0, "DIGEST-MD5" },
1426       { { TLS, NULL },
1427         { SERVER_PROBLEM_NO_PROBLEM,
1428           { OK, OK, OK, OK, OK, XEP77_PROBLEM_EMAIL_ARG } },
1429         { "moose", "something" },
1430         PORT_XMPP },
1431       { NULL, 0, "weasel-juice.org", REACHABLE, NULL },
1432       { PLAINTEXT_OK,
1433         { "moose@weasel-juice.org", "something", PLAIN, NOTLS },
1434         { NULL, 0 },
1435         OP_REGISTER,
1436         (test_setup)_set_connector_email_prop } },
1437 
1438     { "/connector/xep77/register/email-arg-ok/unknown-arg",
1439       NOISY,
1440       { S_WOCKY_CONNECTOR_ERROR,
1441         WOCKY_CONNECTOR_ERROR_REGISTRATION_UNSUPPORTED, -1 },
1442       { { TLS, NULL },
1443         { SERVER_PROBLEM_NO_PROBLEM,
1444           { OK, OK, OK, OK, OK,
1445             XEP77_PROBLEM_EMAIL_ARG|XEP77_PROBLEM_STRANGE_ARG } },
1446         { "moose", "something" },
1447         PORT_XMPP },
1448       { NULL, 0, "weasel-juice.org", REACHABLE, NULL },
1449       { PLAINTEXT_OK,
1450         { "moose@weasel-juice.org", "something", PLAIN, NOTLS },
1451         { NULL, 0 },
1452         OP_REGISTER,
1453         (test_setup)_set_connector_email_prop } },
1454 
1455     { "/connector/xep77/register/fail/conflict",
1456       NOISY,
1457       { S_WOCKY_CONNECTOR_ERROR,
1458         WOCKY_CONNECTOR_ERROR_REGISTRATION_CONFLICT, -1 },
1459       { { TLS, NULL },
1460         { SERVER_PROBLEM_NO_PROBLEM,
1461           { OK, OK, OK, OK, OK, XEP77_PROBLEM_FAIL_CONFLICT } },
1462         { "moose", "something" },
1463         PORT_XMPP },
1464       { NULL, 0, "weasel-juice.org", REACHABLE, NULL },
1465       { PLAINTEXT_OK,
1466         { "moose@weasel-juice.org", "something", PLAIN, NOTLS },
1467         { NULL, 0 },
1468         OP_REGISTER } },
1469 
1470     { "/connector/xep77/register/fail/other",
1471       NOISY,
1472       { S_WOCKY_CONNECTOR_ERROR,
1473         WOCKY_CONNECTOR_ERROR_REGISTRATION_REJECTED, -1 },
1474       { { TLS, NULL },
1475         { SERVER_PROBLEM_NO_PROBLEM,
1476           { OK, OK, OK, OK, OK, XEP77_PROBLEM_FAIL_REJECTED } },
1477         { "moose", "something" },
1478         PORT_XMPP },
1479       { NULL, 0, "weasel-juice.org", REACHABLE, NULL },
1480       { PLAINTEXT_OK,
1481         { "moose@weasel-juice.org", "something", PLAIN, NOTLS },
1482         { NULL, 0 },
1483         OP_REGISTER } },
1484 
1485     { "/connector/xep77/register/nonsense",
1486       NOISY,
1487       { S_WOCKY_CONNECTOR_ERROR,
1488         WOCKY_CONNECTOR_ERROR_REGISTRATION_FAILED, -1 },
1489       { { TLS, NULL },
1490         { SERVER_PROBLEM_NO_PROBLEM,
1491           { OK, OK, OK, OK, OK, XEP77_PROBLEM_QUERY_NONSENSE } },
1492         { "moose", "something" },
1493         PORT_XMPP },
1494       { NULL, 0, "weasel-juice.org", REACHABLE, NULL },
1495       { PLAINTEXT_OK,
1496         { "moose@weasel-juice.org", "something", PLAIN, NOTLS },
1497         { NULL, 0 },
1498         OP_REGISTER } },
1499 
1500     { "/connector/xep77/register/already/get",
1501       NOISY,
1502       { S_NO_ERROR, 0 , 0, "DIGEST-MD5" },
1503       { { TLS, NULL },
1504         { SERVER_PROBLEM_NO_PROBLEM,
1505           { OK, OK, OK, OK, OK, XEP77_PROBLEM_QUERY_ALREADY } },
1506         { "moose", "something" },
1507         PORT_XMPP },
1508       { NULL, 0, "weasel-juice.org", REACHABLE, NULL },
1509       { PLAINTEXT_OK,
1510         { "moose@weasel-juice.org", "something", PLAIN, NOTLS },
1511         { NULL, 0 },
1512         OP_REGISTER } },
1513 
1514     { "/connector/xep77/register/already/set",
1515       NOISY,
1516       { S_NO_ERROR, 0, 0, "DIGEST-MD5" },
1517       { { TLS, NULL },
1518         { SERVER_PROBLEM_NO_PROBLEM,
1519           { OK, OK, OK, OK, OK, XEP77_PROBLEM_ALREADY } },
1520         { "moose", "something" },
1521         PORT_XMPP },
1522       { NULL, 0, "weasel-juice.org", REACHABLE, NULL },
1523       { PLAINTEXT_OK,
1524         { "moose@weasel-juice.org", "something", PLAIN, NOTLS },
1525         { NULL, 0 },
1526         OP_REGISTER } },
1527 
1528     { "/connector/xep77/register/not-available",
1529       NOISY,
1530       { S_WOCKY_CONNECTOR_ERROR,
1531         WOCKY_CONNECTOR_ERROR_REGISTRATION_UNAVAILABLE, -1 },
1532       { { TLS, NULL },
1533         { SERVER_PROBLEM_NO_PROBLEM,
1534           { OK, OK, OK, OK, OK, XEP77_PROBLEM_NOT_AVAILABLE } },
1535         { "moose", "something" },
1536         PORT_XMPP },
1537       { NULL, 0, "weasel-juice.org", REACHABLE, NULL },
1538       { PLAINTEXT_OK,
1539         { "moose@weasel-juice.org", "something", PLAIN, NOTLS },
1540         { NULL, 0 },
1541         OP_REGISTER } },
1542     /* ******************************************************************** */
1543     { "/connector/xep77/cancel/ok",
1544       NOISY,
1545       { S_NO_ERROR, },
1546       { { TLS, NULL },
1547         { SERVER_PROBLEM_NO_PROBLEM, CONNECTOR_OK },
1548         { "moose", "something" },
1549         PORT_XMPP },
1550       { NULL, 0, "weasel-juice.org", REACHABLE, NULL },
1551       { PLAINTEXT_OK,
1552         { "moose@weasel-juice.org", "something", PLAIN, NOTLS },
1553         { NULL, 0 },
1554         OP_CANCEL } },
1555 
1556     { "/connector/xep77/cancel/denied",
1557       NOISY,
1558       { S_WOCKY_CONNECTOR_ERROR, WOCKY_CONNECTOR_ERROR_UNREGISTER_DENIED, -1 },
1559       { { TLS, NULL },
1560         { SERVER_PROBLEM_NO_PROBLEM,
1561           { OK, OK, OK, OK, OK, XEP77_PROBLEM_CANCEL_FAILED } },
1562         { "moose", "something" },
1563         PORT_XMPP },
1564       { NULL, 0, "weasel-juice.org", REACHABLE, NULL },
1565       { PLAINTEXT_OK,
1566         { "moose@weasel-juice.org", "something", PLAIN, NOTLS },
1567         { NULL, 0 },
1568         OP_CANCEL } },
1569 
1570     { "/connector/xep77/cancel/disabled",
1571       NOISY,
1572       { S_WOCKY_CONNECTOR_ERROR, WOCKY_CONNECTOR_ERROR_UNREGISTER_DENIED, -1 },
1573       { { TLS, NULL },
1574         { SERVER_PROBLEM_NO_PROBLEM,
1575           { OK, OK, OK, OK, OK, XEP77_PROBLEM_CANCEL_DISABLED } },
1576         { "moose", "something" },
1577         PORT_XMPP },
1578       { NULL, 0, "weasel-juice.org", REACHABLE, NULL },
1579       { PLAINTEXT_OK,
1580         { "moose@weasel-juice.org", "something", PLAIN, NOTLS },
1581         { NULL, 0 },
1582         OP_CANCEL } },
1583 
1584     { "/connector/xep77/cancel/rejected",
1585       NOISY,
1586       { S_WOCKY_CONNECTOR_ERROR, WOCKY_CONNECTOR_ERROR_UNREGISTER_FAILED, -1 },
1587       { { TLS, NULL },
1588         { SERVER_PROBLEM_NO_PROBLEM,
1589           { OK, OK, OK, OK, OK, XEP77_PROBLEM_CANCEL_REJECTED } },
1590         { "moose", "something" },
1591         PORT_XMPP },
1592       { NULL, 0, "weasel-juice.org", REACHABLE, NULL },
1593       { PLAINTEXT_OK,
1594         { "moose@weasel-juice.org", "something", PLAIN, NOTLS },
1595         { NULL, 0 },
1596         OP_CANCEL } },
1597 
1598     { "/connector/xep77/cancel/stream-closed",
1599       NOISY,
1600       { S_NO_ERROR, },
1601       { { TLS, NULL },
1602         { SERVER_PROBLEM_NO_PROBLEM,
1603           { OK, OK, OK, OK, OK, XEP77_PROBLEM_CANCEL_STREAM } },
1604         { "moose", "something" },
1605         PORT_XMPP },
1606       { NULL, 0, "weasel-juice.org", REACHABLE, NULL },
1607       { PLAINTEXT_OK,
1608         { "moose@weasel-juice.org", "something", PLAIN, NOTLS },
1609         { NULL, 0 },
1610         OP_CANCEL } },
1611 
1612     /* ******************************************************************** */
1613     /* old school jabber tests (pre XMPP 1.0)                               */
1614     { "/connector/jabber/no-ssl/auth/digest",
1615       NOISY,
1616       { S_NO_ERROR, },
1617       { { TLS, NULL },
1618         { SERVER_PROBLEM_NO_PROBLEM,
1619           { XMPP_PROBLEM_OLD_SERVER, OK, OK, OK, OK } },
1620         { "moose", "something" },
1621         PORT_XMPP },
1622       { NULL, 0, "weasel-juice.org", REACHABLE, NULL },
1623       { PLAINTEXT_OK,
1624         { "moose@weasel-juice.org", "something", PLAIN, NOTLS },
1625         { NULL, 0, OLD_JABBER } } },
1626 
1627     { "/connector/jabber/no-ssl/auth/reject",
1628       NOISY,
1629       { S_WOCKY_AUTH_ERROR, WOCKY_AUTH_ERROR_NOT_AUTHORIZED, -1 },
1630       { { TLS, NULL },
1631         { SERVER_PROBLEM_NO_PROBLEM,
1632           { XMPP_PROBLEM_OLD_SERVER, OK, OK, OK, OK } },
1633         { "moose", "blerg" },
1634         PORT_XMPP },
1635       { NULL, 0, "weasel-juice.org", REACHABLE, NULL },
1636       { PLAINTEXT_OK,
1637         { "moose@weasel-juice.org", "something", PLAIN, NOTLS },
1638         { NULL, 0, OLD_JABBER } } },
1639 
1640     { "/connector/jabber/no-ssl/auth/unavailable",
1641       NOISY,
1642       { S_WOCKY_AUTH_ERROR, WOCKY_AUTH_ERROR_NOT_SUPPORTED, -1 },
1643       { { TLS, NULL },
1644         { SERVER_PROBLEM_NO_PROBLEM,
1645           { XMPP_PROBLEM_OLD_SERVER, OK, OK, OK, JABBER_PROBLEM_AUTH_NIH } },
1646         { "moose", "blerg" },
1647         PORT_XMPP },
1648       { NULL, 0, "weasel-juice.org", REACHABLE, NULL },
1649       { PLAINTEXT_OK,
1650         { "moose@weasel-juice.org", "something", PLAIN, NOTLS },
1651         { NULL, 0, OLD_JABBER } } },
1652 
1653     { "/connector/jabber/no-ssl/auth/bind-error",
1654       NOISY,
1655       { S_WOCKY_AUTH_ERROR, WOCKY_AUTH_ERROR_RESOURCE_CONFLICT, -1 },
1656       { { TLS, NULL },
1657         { SERVER_PROBLEM_NO_PROBLEM,
1658           { XMPP_PROBLEM_OLD_SERVER, OK, OK, OK, JABBER_PROBLEM_AUTH_BIND } },
1659         { "moose", "something" },
1660         PORT_XMPP },
1661       { NULL, 0, "weasel-juice.org", REACHABLE, NULL },
1662       { PLAINTEXT_OK,
1663         { "moose@weasel-juice.org", "something", PLAIN, NOTLS },
1664         { NULL, 0, OLD_JABBER } } },
1665 
1666     { "/connector/jabber/no-ssl/auth/incomplete",
1667       NOISY,
1668       { S_WOCKY_AUTH_ERROR, WOCKY_AUTH_ERROR_NO_CREDENTIALS, -1 },
1669       { { TLS, NULL },
1670         { SERVER_PROBLEM_NO_PROBLEM,
1671           { XMPP_PROBLEM_OLD_SERVER, OK, OK, OK,
1672             JABBER_PROBLEM_AUTH_PARTIAL } },
1673         { "moose", "something" },
1674         PORT_XMPP },
1675       { NULL, 0, "weasel-juice.org", REACHABLE, NULL },
1676       { PLAINTEXT_OK,
1677         { "moose@weasel-juice.org", "something", PLAIN, NOTLS },
1678         { NULL, 0, OLD_JABBER } } },
1679 
1680     { "/connector/jabber/no-ssl/auth/failure",
1681       NOISY,
1682       { S_WOCKY_AUTH_ERROR, WOCKY_AUTH_ERROR_FAILURE, -1 },
1683       { { TLS, NULL },
1684         { SERVER_PROBLEM_NO_PROBLEM,
1685           { XMPP_PROBLEM_OLD_SERVER, OK, OK, OK, JABBER_PROBLEM_AUTH_FAILED } },
1686         { "moose", "something" },
1687         PORT_XMPP },
1688       { NULL, 0, "weasel-juice.org", REACHABLE, NULL },
1689       { PLAINTEXT_OK,
1690         { "moose@weasel-juice.org", "something", PLAIN, NOTLS },
1691         { NULL, 0, OLD_JABBER } } },
1692 
1693     { "/connector/jabber/no-ssl/auth/bizarre",
1694       NOISY,
1695       { S_WOCKY_AUTH_ERROR, WOCKY_AUTH_ERROR_INVALID_REPLY, -1 },
1696       { { TLS, NULL },
1697         { SERVER_PROBLEM_NO_PROBLEM,
1698           { XMPP_PROBLEM_OLD_SERVER, OK, OK, OK,
1699             JABBER_PROBLEM_AUTH_STRANGE } },
1700         { "moose", "something" },
1701         PORT_XMPP },
1702       { NULL, 0, "weasel-juice.org", REACHABLE, NULL },
1703       { PLAINTEXT_OK,
1704         { "moose@weasel-juice.org", "something", PLAIN, NOTLS },
1705         { NULL, 0, OLD_JABBER } } },
1706 
1707     { "/connector/jabber/no-ssl/auth/nonsense",
1708       NOISY,
1709       { S_WOCKY_AUTH_ERROR, WOCKY_AUTH_ERROR_INVALID_REPLY, -1 },
1710       { { TLS, NULL },
1711         { SERVER_PROBLEM_NO_PROBLEM,
1712           { XMPP_PROBLEM_OLD_SERVER, OK, OK, OK,
1713             JABBER_PROBLEM_AUTH_NONSENSE } },
1714         { "moose", "something" },
1715         PORT_XMPP },
1716       { NULL, 0, "weasel-juice.org", REACHABLE, NULL },
1717       { PLAINTEXT_OK,
1718         { "moose@weasel-juice.org", "something", PLAIN, NOTLS },
1719         { NULL, 0, OLD_JABBER } } },
1720 
1721     { "/connector/jabber/no-ssl/auth/no-mechs",
1722       NOISY,
1723       { S_WOCKY_AUTH_ERROR, WOCKY_AUTH_ERROR_NO_SUPPORTED_MECHANISMS, -1 },
1724       { { TLS, "none" },
1725         { SERVER_PROBLEM_NO_PROBLEM,
1726           { XMPP_PROBLEM_OLD_SERVER, OK, OK, OK, OK } },
1727         { "moose", "something" },
1728         PORT_XMPP },
1729       { NULL, 0, "weasel-juice.org", REACHABLE, NULL },
1730       { PLAINTEXT_OK,
1731         { "moose@weasel-juice.org", "something", PLAIN, NOTLS },
1732         { NULL, 0, OLD_JABBER } } },
1733 
1734     { "/connector/jabber/no-ssl/auth/plain",
1735       NOISY,
1736       { S_NO_ERROR, },
1737       { { TLS, "password" },
1738         { SERVER_PROBLEM_NO_PROBLEM,
1739           { XMPP_PROBLEM_OLD_SERVER, OK, OK, OK, OK } },
1740         { "moose", "something" },
1741         PORT_XMPP },
1742       { NULL, 0, "weasel-juice.org", REACHABLE, NULL },
1743       { PLAINTEXT_OK,
1744         { "moose@weasel-juice.org", "something", PLAIN, NOTLS },
1745         { NULL, 0, OLD_JABBER } } },
1746 
1747     { "/connector/jabber/no-ssl/auth/plain/rejected",
1748       NOISY,
1749       { S_WOCKY_AUTH_ERROR, WOCKY_AUTH_ERROR_NOT_AUTHORIZED, -1 },
1750       { { TLS, "password" },
1751         { SERVER_PROBLEM_NO_PROBLEM,
1752           { XMPP_PROBLEM_OLD_SERVER, OK, OK, OK, JABBER_PROBLEM_AUTH_REJECT } },
1753         { "moose", "something" },
1754         PORT_XMPP },
1755       { NULL, 0, "weasel-juice.org", REACHABLE, NULL },
1756       { PLAINTEXT_OK,
1757         { "moose@weasel-juice.org", "something", PLAIN, NOTLS },
1758         { NULL, 0, OLD_JABBER } } },
1759 
1760     { "/connector/jabber/no-ssl/auth/digest/rejected",
1761       NOISY,
1762       { S_WOCKY_AUTH_ERROR, WOCKY_AUTH_ERROR_NOT_AUTHORIZED, -1 },
1763       { { TLS, "digest" },
1764         { SERVER_PROBLEM_NO_PROBLEM,
1765           { XMPP_PROBLEM_OLD_SERVER, OK, OK, OK, JABBER_PROBLEM_AUTH_REJECT } },
1766         { "moose", "something" },
1767         PORT_XMPP },
1768       { NULL, 0, "weasel-juice.org", REACHABLE, NULL },
1769       { PLAINTEXT_OK,
1770         { "moose@weasel-juice.org", "something", PLAIN, NOTLS },
1771         { NULL, 0, OLD_JABBER } } },
1772 
1773     { "/connector/jabber/no-ssl/auth/old+sasl",
1774       NOISY,
1775       { S_NO_ERROR, 0, 0, "DIGEST-MD5" },
1776       { { TLS, NULL },
1777         { SERVER_PROBLEM_NO_PROBLEM,
1778           { XMPP_PROBLEM_OLD_AUTH_FEATURE, OK, OK, OK, OK } },
1779         { "moose", "something" },
1780         PORT_XMPP },
1781       { NULL, 0, "weasel-juice.org", REACHABLE, NULL },
1782       { PLAINTEXT_OK,
1783         { "moose@weasel-juice.org", "something", PLAIN, NOTLS },
1784         { NULL, 0, OLD_JABBER } } },
1785 
1786     { "/connector/jabber/no-ssl/auth/old-sasl",
1787       NOISY,
1788       { S_NO_ERROR, },
1789       { { TLS, NULL },
1790         { SERVER_PROBLEM_NO_SASL,
1791           { XMPP_PROBLEM_OLD_AUTH_FEATURE, OK, OK, OK, OK } },
1792         { "moose", "something" },
1793         PORT_XMPP },
1794       { NULL, 0, "weasel-juice.org", REACHABLE, NULL },
1795       { PLAINTEXT_OK,
1796         { "moose@weasel-juice.org", "something", PLAIN, NOTLS },
1797         { NULL, 0, OLD_JABBER } } },
1798 
1799     /* ******************************************************************** */
1800     /* old SSL                                                              */
1801     { "/connector/jabber/ssl/auth/digest",
1802       NOISY,
1803       { S_NO_ERROR, },
1804       { { TLS, NULL },
1805         { SERVER_PROBLEM_NO_PROBLEM,
1806           { XMPP_PROBLEM_OLD_SERVER|XMPP_PROBLEM_OLD_SSL, OK, OK, OK, OK } },
1807         { "moose", "something" },
1808         PORT_XMPP },
1809       { NULL, 0, "weasel-juice.org", REACHABLE, NULL },
1810       { PLAINTEXT_OK,
1811         { "moose@weasel-juice.org", "something", PLAIN, NOTLS },
1812         { NULL, 0, OLD_JABBER, OLD_SSL } } },
1813 
1814     { "/connector/jabber/ssl/auth/reject",
1815       NOISY,
1816       { S_WOCKY_AUTH_ERROR, WOCKY_AUTH_ERROR_NOT_AUTHORIZED, -1 },
1817       { { TLS, NULL },
1818         { SERVER_PROBLEM_NO_PROBLEM,
1819           { XMPP_PROBLEM_OLD_SERVER|XMPP_PROBLEM_OLD_SSL, OK, OK, OK, OK } },
1820         { "moose", "blerg" },
1821         PORT_XMPP },
1822       { NULL, 0, "weasel-juice.org", REACHABLE, NULL },
1823       { PLAINTEXT_OK,
1824         { "moose@weasel-juice.org", "something", PLAIN, NOTLS },
1825         { NULL, 0, OLD_JABBER, OLD_SSL } } },
1826 
1827     { "/connector/jabber/ssl/auth/unavailable",
1828       NOISY,
1829       { S_WOCKY_AUTH_ERROR, WOCKY_AUTH_ERROR_NOT_SUPPORTED, -1 },
1830       { { TLS, NULL },
1831         { SERVER_PROBLEM_NO_PROBLEM,
1832           { XMPP_PROBLEM_OLD_SERVER|XMPP_PROBLEM_OLD_SSL, OK, OK, OK,
1833               JABBER_PROBLEM_AUTH_NIH } },
1834         { "moose", "blerg" },
1835         PORT_XMPP },
1836       { NULL, 0, "weasel-juice.org", REACHABLE, NULL },
1837       { PLAINTEXT_OK,
1838         { "moose@weasel-juice.org", "something", PLAIN, NOTLS },
1839         { NULL, 0, OLD_JABBER, OLD_SSL } } },
1840 
1841     { "/connector/jabber/ssl/auth/bind-error",
1842       NOISY,
1843       { S_WOCKY_AUTH_ERROR, WOCKY_AUTH_ERROR_RESOURCE_CONFLICT, -1 },
1844       { { TLS, NULL },
1845         { SERVER_PROBLEM_NO_PROBLEM,
1846           { XMPP_PROBLEM_OLD_SERVER|XMPP_PROBLEM_OLD_SSL, OK, OK, OK,
1847               JABBER_PROBLEM_AUTH_BIND } },
1848         { "moose", "something" },
1849         PORT_XMPP },
1850       { NULL, 0, "weasel-juice.org", REACHABLE, NULL },
1851       { PLAINTEXT_OK,
1852         { "moose@weasel-juice.org", "something", PLAIN, NOTLS },
1853         { NULL, 0, OLD_JABBER, OLD_SSL } } },
1854 
1855     { "/connector/jabber/ssl/auth/incomplete",
1856       NOISY,
1857       { S_WOCKY_AUTH_ERROR, WOCKY_AUTH_ERROR_NO_CREDENTIALS, -1 },
1858       { { TLS, NULL },
1859         { SERVER_PROBLEM_NO_PROBLEM,
1860           { XMPP_PROBLEM_OLD_SERVER|XMPP_PROBLEM_OLD_SSL, OK, OK, OK,
1861             JABBER_PROBLEM_AUTH_PARTIAL } },
1862         { "moose", "something" },
1863         PORT_XMPP },
1864       { NULL, 0, "weasel-juice.org", REACHABLE, NULL },
1865       { PLAINTEXT_OK,
1866         { "moose@weasel-juice.org", "something", PLAIN, NOTLS },
1867         { NULL, 0, OLD_JABBER, OLD_SSL } } },
1868 
1869     { "/connector/jabber/ssl/auth/failure",
1870       NOISY,
1871       { S_WOCKY_AUTH_ERROR, WOCKY_AUTH_ERROR_FAILURE, -1 },
1872       { { TLS, NULL },
1873         { SERVER_PROBLEM_NO_PROBLEM,
1874           { XMPP_PROBLEM_OLD_SERVER|XMPP_PROBLEM_OLD_SSL, OK, OK, OK,
1875               JABBER_PROBLEM_AUTH_FAILED } },
1876         { "moose", "something" },
1877         PORT_XMPP },
1878       { NULL, 0, "weasel-juice.org", REACHABLE, NULL },
1879       { PLAINTEXT_OK,
1880         { "moose@weasel-juice.org", "something", PLAIN, NOTLS },
1881         { NULL, 0, OLD_JABBER, OLD_SSL } } },
1882 
1883     { "/connector/jabber/ssl/auth/bizarre",
1884       NOISY,
1885       { S_WOCKY_AUTH_ERROR, WOCKY_AUTH_ERROR_INVALID_REPLY, -1 },
1886       { { TLS, NULL },
1887         { SERVER_PROBLEM_NO_PROBLEM,
1888           { XMPP_PROBLEM_OLD_SERVER|XMPP_PROBLEM_OLD_SSL, OK, OK, OK,
1889             JABBER_PROBLEM_AUTH_STRANGE } },
1890         { "moose", "something" },
1891         PORT_XMPP },
1892       { NULL, 0, "weasel-juice.org", REACHABLE, NULL },
1893       { PLAINTEXT_OK,
1894         { "moose@weasel-juice.org", "something", PLAIN, NOTLS },
1895         { NULL, 0, OLD_JABBER, OLD_SSL } } },
1896 
1897     { "/connector/jabber/ssl/auth/nonsense",
1898       NOISY,
1899       { S_WOCKY_AUTH_ERROR, WOCKY_AUTH_ERROR_INVALID_REPLY, -1 },
1900       { { TLS, NULL },
1901         { SERVER_PROBLEM_NO_PROBLEM,
1902           { XMPP_PROBLEM_OLD_SERVER|XMPP_PROBLEM_OLD_SSL, OK, OK, OK,
1903             JABBER_PROBLEM_AUTH_NONSENSE } },
1904         { "moose", "something" },
1905         PORT_XMPP },
1906       { NULL, 0, "weasel-juice.org", REACHABLE, NULL },
1907       { PLAINTEXT_OK,
1908         { "moose@weasel-juice.org", "something", PLAIN, NOTLS },
1909         { NULL, 0, OLD_JABBER, OLD_SSL } } },
1910 
1911     { "/connector/jabber/ssl/auth/no-mechs",
1912       NOISY,
1913       { S_WOCKY_AUTH_ERROR, WOCKY_AUTH_ERROR_NO_SUPPORTED_MECHANISMS, -1 },
1914       { { TLS, "none" },
1915         { SERVER_PROBLEM_NO_PROBLEM,
1916           { XMPP_PROBLEM_OLD_SERVER|XMPP_PROBLEM_OLD_SSL, OK, OK, OK, OK } },
1917         { "moose", "something" },
1918         PORT_XMPP },
1919       { NULL, 0, "weasel-juice.org", REACHABLE, NULL },
1920       { PLAINTEXT_OK,
1921         { "moose@weasel-juice.org", "something", PLAIN, NOTLS },
1922         { NULL, 0, OLD_JABBER, OLD_SSL } } },
1923 
1924     { "/connector/jabber/ssl/auth/plain",
1925       NOISY,
1926       { S_NO_ERROR, },
1927       { { TLS, "password" },
1928         { SERVER_PROBLEM_NO_PROBLEM,
1929           { XMPP_PROBLEM_OLD_SERVER|XMPP_PROBLEM_OLD_SSL, OK, OK, OK, OK } },
1930         { "moose", "something" },
1931         PORT_XMPP },
1932       { NULL, 0, "weasel-juice.org", REACHABLE, NULL },
1933       { PLAINTEXT_OK,
1934         { "moose@weasel-juice.org", "something", PLAIN, NOTLS },
1935         { NULL, 0, OLD_JABBER, OLD_SSL } } },
1936 
1937     { "/connector/jabber/ssl/auth/plain/rejected",
1938       NOISY,
1939       { S_WOCKY_AUTH_ERROR, WOCKY_AUTH_ERROR_NOT_AUTHORIZED, -1 },
1940       { { TLS, "password" },
1941         { SERVER_PROBLEM_NO_PROBLEM,
1942           { XMPP_PROBLEM_OLD_SERVER|XMPP_PROBLEM_OLD_SSL, OK, OK, OK,
1943             JABBER_PROBLEM_AUTH_REJECT } },
1944         { "moose", "something" },
1945         PORT_XMPP },
1946       { NULL, 0, "weasel-juice.org", REACHABLE, NULL },
1947       { PLAINTEXT_OK,
1948         { "moose@weasel-juice.org", "something", PLAIN, NOTLS },
1949         { NULL, 0, OLD_JABBER, OLD_SSL } } },
1950 
1951     { "/connector/jabber/ssl/auth/digest/rejected",
1952       NOISY,
1953       { S_WOCKY_AUTH_ERROR, WOCKY_AUTH_ERROR_NOT_AUTHORIZED, -1 },
1954       { { TLS, "digest" },
1955         { SERVER_PROBLEM_NO_PROBLEM,
1956           { XMPP_PROBLEM_OLD_SERVER|XMPP_PROBLEM_OLD_SSL, OK, OK, OK,
1957             JABBER_PROBLEM_AUTH_REJECT } },
1958         { "moose", "something" },
1959         PORT_XMPP },
1960       { NULL, 0, "weasel-juice.org", REACHABLE, NULL },
1961       { PLAINTEXT_OK,
1962         { "moose@weasel-juice.org", "something", PLAIN, NOTLS },
1963         { NULL, 0, OLD_JABBER, OLD_SSL } } },
1964 
1965     { "/connector/jabber/ssl/auth/old+sasl",
1966       NOISY,
1967       { S_NO_ERROR, 0, 0, "DIGEST-MD5" },
1968       { { TLS, NULL },
1969           { SERVER_PROBLEM_NO_PROBLEM,
1970             { XMPP_PROBLEM_OLD_AUTH_FEATURE|XMPP_PROBLEM_OLD_SSL,
1971               OK, OK, OK, OK } },
1972         { "moose", "something" },
1973         PORT_XMPP },
1974       { NULL, 0, "weasel-juice.org", REACHABLE, NULL },
1975       { PLAINTEXT_OK,
1976         { "moose@weasel-juice.org", "something", PLAIN, NOTLS },
1977         { NULL, 0, OLD_JABBER, OLD_SSL } } },
1978 
1979     { "/connector/jabber/ssl/auth/old-sasl",
1980       NOISY,
1981       { S_NO_ERROR, },
1982       { { TLS, NULL },
1983         { SERVER_PROBLEM_NO_SASL,
1984           { XMPP_PROBLEM_OLD_AUTH_FEATURE|XMPP_PROBLEM_OLD_SSL,
1985             OK, OK, OK, OK } },
1986         { "moose", "something" },
1987         PORT_XMPP },
1988       { NULL, 0, "weasel-juice.org", REACHABLE, NULL },
1989       { PLAINTEXT_OK,
1990         { "moose@weasel-juice.org", "something", PLAIN, NOTLS },
1991         { NULL, 0, OLD_JABBER, OLD_SSL } } },
1992 
1993     /* ******************************************************************* */
1994     /* duplicate earlier blocks of tests, but with old SSL                 */
1995     { "/connector+ssl/auth/secure/no-tlsplain/notls/nodigest",
1996       NOISY,
1997       { S_WOCKY_AUTH_ERROR, WOCKY_AUTH_ERROR_NO_SUPPORTED_MECHANISMS, -1 },
1998       { { NOTLS, "PLAIN" },
1999         { SERVER_PROBLEM_NO_PROBLEM, { XMPP_PROBLEM_OLD_SSL, OK, OK, OK, OK } },
2000         { "moose", "something" },
2001         PORT_XMPP },
2002       { "weasel-juice.org", PORT_XMPP, "thud.org", REACHABLE, UNREACHABLE },
2003       { PLAINTEXT_OK,
2004         { "moose@weasel-juice.org", "something", DIGEST, TLS },
2005         { NULL, 0, OLD_JABBER, OLD_SSL } } },
2006 
2007     { "/connector+ssl/auth/secure/no-tlsplain/notls/digest",
2008       NOISY,
2009       { S_NO_ERROR, 0, 0, "DIGEST-MD5" },
2010       { { NOTLS, NULL },
2011         { SERVER_PROBLEM_NO_PROBLEM, { XMPP_PROBLEM_OLD_SSL, OK, OK, OK, OK } },
2012         { "moose", "something" },
2013         PORT_XMPP },
2014       { "weasel-juice.org", PORT_XMPP, "thud.org", REACHABLE, UNREACHABLE },
2015       { PLAINTEXT_OK,
2016         { "moose@weasel-juice.org", "something", DIGEST, TLS },
2017         { NULL, 0, XMPP_V1, OLD_SSL } } },
2018 
2019     { "/connector+ssl/auth/insecure/no-tlsplain/notls/nodigest",
2020       NOISY,
2021       { S_NO_ERROR, 0, 0, "PLAIN" },
2022       { { NOTLS, "PLAIN" },
2023         { SERVER_PROBLEM_NO_PROBLEM, { XMPP_PROBLEM_OLD_SSL, OK, OK, OK, OK } },
2024         { "moose", "something" },
2025         PORT_XMPP },
2026       { "weasel-juice.org", PORT_XMPP, "thud.org", REACHABLE, UNREACHABLE },
2027       { PLAINTEXT_OK,
2028         { "moose@weasel-juice.org", "something", PLAIN, NOTLS },
2029         { NULL, 0, XMPP_V1, OLD_SSL } } },
2030 
2031     { "/connector+ssl/auth/insecure/no-tlsplain/notls/digest",
2032       NOISY,
2033       { S_NO_ERROR, 0, 0, "DIGEST-MD5" },
2034       { { NOTLS, NULL },
2035         { SERVER_PROBLEM_NO_PROBLEM, { XMPP_PROBLEM_OLD_SSL, OK, OK, OK, OK } },
2036         { "moose", "something" },
2037         PORT_XMPP },
2038       { "weasel-juice.org", PORT_XMPP, "thud.org", REACHABLE, UNREACHABLE },
2039       { PLAINTEXT_OK,
2040         { "moose@weasel-juice.org", "something", PLAIN, NOTLS },
2041         { NULL, 0, XMPP_V1, OLD_SSL } } },
2042 
2043     /* **************************************************************** *
2044      * this will be a mix of failures and sucesses depending on whether *
2045      * we allow plain auth or not                                       */
2046     { "/connector+ssl/auth/secure/no-tlsplain/tls/plain",
2047       NOISY,
2048       { S_WOCKY_AUTH_ERROR, WOCKY_AUTH_ERROR_NO_SUPPORTED_MECHANISMS, -1 },
2049       { { TLS, "PLAIN" },
2050         { SERVER_PROBLEM_INVALID_PASSWORD,
2051           { XMPP_PROBLEM_OLD_SSL, OK, OK, OK, OK } },
2052         { "moose", "something" },
2053         PORT_XMPP },
2054       { "weasel-juice.org", PORT_XMPP, "thud.org", REACHABLE, UNREACHABLE },
2055       { PLAINTEXT_OK,
2056         { "moose@weasel-juice.org", "something", DIGEST, TLS },
2057         { NULL, 0, XMPP_V1, OLD_SSL } } },
2058 
2059     { "/connector+ssl/auth/secure/tlsplain/tls/plain",
2060       NOISY,
2061       { S_NO_ERROR, 0, 0, "PLAIN" },
2062       { { TLS, "PLAIN" },
2063         { SERVER_PROBLEM_NO_PROBLEM,
2064           { XMPP_PROBLEM_OLD_SSL, OK, OK, OK, OK } },
2065         { "moose", "something" },
2066         PORT_XMPP },
2067       { "weasel-juice.org", PORT_XMPP, "thud.org", REACHABLE, UNREACHABLE },
2068       { PLAINTEXT_OK,
2069         { "moose@weasel-juice.org", "something", PLAIN, TLS },
2070         { NULL, 0, XMPP_V1, OLD_SSL } } },
2071 
2072     { "/connector+ssl/auth/insecure/no-tlsplain/tls/plain",
2073       NOISY,
2074       { S_NO_ERROR, 0, 0, "PLAIN" },
2075       { { TLS, "PLAIN" },
2076         { SERVER_PROBLEM_NO_PROBLEM,
2077           { XMPP_PROBLEM_OLD_SSL, OK, OK, OK, OK } },
2078         { "moose", "something" },
2079         PORT_XMPP },
2080       { "weasel-juice.org", PORT_XMPP, "thud.org", REACHABLE, UNREACHABLE },
2081       { PLAINTEXT_OK,
2082         { "moose@weasel-juice.org", "something", DIGEST, NOTLS },
2083         { NULL, 0, XMPP_V1, OLD_SSL } } },
2084 
2085     { "/connector+ssl/auth/insecure/tlsplain/tls/plain",
2086       NOISY,
2087       { S_NO_ERROR, 0, 0, "PLAIN" },
2088       { { TLS, "PLAIN" },
2089         { SERVER_PROBLEM_NO_PROBLEM,
2090           { XMPP_PROBLEM_OLD_SSL, OK, OK, OK, OK } },
2091         { "moose", "something" },
2092         PORT_XMPP },
2093       { "weasel-juice.org", PORT_XMPP, "thud.org", REACHABLE, UNREACHABLE },
2094       { PLAINTEXT_OK,
2095         { "moose@weasel-juice.org", "something", PLAIN, NOTLS },
2096         { NULL, 0, XMPP_V1, OLD_SSL } } },
2097 
2098     { "/connector+ssl/tls+auth/secure/no-tlsplain/tls/plain",
2099       NOISY,
2100       { S_WOCKY_AUTH_ERROR, WOCKY_AUTH_ERROR_NO_SUPPORTED_MECHANISMS, -1 },
2101       { { TLS, "PLAIN" },
2102         { SERVER_PROBLEM_NO_PROBLEM,
2103           { XMPP_PROBLEM_OLD_SSL, OK, OK, OK, OK } },
2104         { "moose", "something" },
2105         PORT_XMPP },
2106       { "weasel-juice.org", PORT_XMPP, "thud.org", REACHABLE, UNREACHABLE },
2107       { PLAINTEXT_OK,
2108         { "moose@weasel-juice.org", "something", DIGEST, TLS },
2109         { NULL, 0, XMPP_V1, OLD_SSL } } },
2110 
2111     { "/connector+ssl/tls+auth/secure/tlsplain/tls/plain",
2112       NOISY,
2113       { S_NO_ERROR, 0, 0, "PLAIN" },
2114       { { TLS, "PLAIN" },
2115         { SERVER_PROBLEM_NO_PROBLEM,
2116           { XMPP_PROBLEM_OLD_SSL, OK, OK, OK, OK } },
2117         { "moose", "something" },
2118         PORT_XMPP },
2119       { "weasel-juice.org", PORT_XMPP, "thud.org", REACHABLE, UNREACHABLE },
2120       { PLAINTEXT_OK,
2121         { "moose@weasel-juice.org", "something", PLAIN, TLS },
2122         { NULL, 0, XMPP_V1, OLD_SSL } } },
2123 
2124     { "/connector+ssl/tls+auth/insecure/no-tlsplain/tls/plain",
2125       NOISY,
2126       { S_NO_ERROR, 0, 0, "PLAIN" },
2127       { { TLS, "PLAIN" },
2128         { SERVER_PROBLEM_NO_PROBLEM,
2129           { XMPP_PROBLEM_OLD_SSL, OK, OK, OK, OK } },
2130         { "moose", "something" },
2131         PORT_XMPP },
2132       { "weasel-juice.org", PORT_XMPP, "thud.org", REACHABLE, UNREACHABLE },
2133       { PLAINTEXT_OK,
2134         { "moose@weasel-juice.org", "something", DIGEST, NOTLS },
2135         { NULL, 0, XMPP_V1, OLD_SSL } } },
2136 
2137     { "/connector+ssl/tls+auth/insecure/tlsplain/tls/plain",
2138       NOISY,
2139       { S_NO_ERROR, 0, 0, "PLAIN" },
2140       { { TLS, "PLAIN" },
2141         { SERVER_PROBLEM_NO_PROBLEM, { XMPP_PROBLEM_OLD_SSL, OK, OK, OK, OK } },
2142         { "moose", "something" },
2143         PORT_XMPP },
2144       { "weasel-juice.org", PORT_XMPP, "thud.org", REACHABLE, UNREACHABLE },
2145       { PLAINTEXT_OK,
2146         { "moose@weasel-juice.org", "something", PLAIN, NOTLS },
2147         { NULL, 0, XMPP_V1, OLD_SSL } } },
2148 
2149     /* **************************************************************** *
2150      * these should all be digest auth successes                        */
2151     { "/connector+ssl/auth/secure/no-tlsplain/tls/digest",
2152       NOISY,
2153       { S_NO_ERROR, 0, 0, "DIGEST-MD5" },
2154       { { TLS, NULL },
2155         { SERVER_PROBLEM_NO_PROBLEM, { XMPP_PROBLEM_OLD_SSL, OK, OK, OK, OK } },
2156         { "moose", "something" },
2157         PORT_XMPP },
2158       { "weasel-juice.org", PORT_XMPP, "thud.org", REACHABLE, UNREACHABLE },
2159       { PLAINTEXT_OK,
2160         { "moose@weasel-juice.org", "something", DIGEST, TLS },
2161         { NULL, 0, XMPP_V1, OLD_SSL } } },
2162 
2163     { "/connector+ssl/auth/secure/tlsplain/tls/digest",
2164       NOISY,
2165       { S_NO_ERROR, 0, 0, "DIGEST-MD5" },
2166       { { TLS, NULL },
2167         { SERVER_PROBLEM_NO_PROBLEM, { XMPP_PROBLEM_OLD_SSL, OK, OK, OK, OK } },
2168         { "moose", "something" },
2169         PORT_XMPP },
2170       { "weasel-juice.org", PORT_XMPP, "thud.org", REACHABLE, UNREACHABLE },
2171       { PLAINTEXT_OK,
2172         { "moose@weasel-juice.org", "something", PLAIN, TLS },
2173         { NULL, 0, XMPP_V1, OLD_SSL } } },
2174 
2175     { "/connector+ssl/auth/insecure/no-tlsplain/tls/digest",
2176       NOISY,
2177       { S_NO_ERROR, 0, 0, "DIGEST-MD5" },
2178       { { TLS, NULL },
2179         { SERVER_PROBLEM_NO_PROBLEM, { XMPP_PROBLEM_OLD_SSL, OK, OK, OK, OK } },
2180         { "moose", "something" },
2181         PORT_XMPP },
2182       { "weasel-juice.org", PORT_XMPP, "thud.org", REACHABLE, UNREACHABLE },
2183       { PLAINTEXT_OK,
2184         { "moose@weasel-juice.org", "something", DIGEST, NOTLS },
2185         { NULL, 0, XMPP_V1, OLD_SSL } } },
2186 
2187     { "/connector+ssl/auth/insecure/tlsplain/tls/digest",
2188       NOISY,
2189       { S_NO_ERROR, 0, 0, "DIGEST-MD5" },
2190       { { TLS, NULL },
2191         { SERVER_PROBLEM_NO_PROBLEM, { XMPP_PROBLEM_OLD_SSL, OK, OK, OK, OK } },
2192         { "moose", "something" },
2193         PORT_XMPP },
2194       { "weasel-juice.org", PORT_XMPP, "thud.org", REACHABLE, UNREACHABLE },
2195       { PLAINTEXT_OK,
2196           { "moose@weasel-juice.org", "something", PLAIN, NOTLS },
2197         { NULL, 0, XMPP_V1, OLD_SSL } } },
2198 
2199     { "/connector+ssl/tls+auth/secure/no-tlsplain/tls/digest",
2200       NOISY,
2201       { S_NO_ERROR, 0, 0, "DIGEST-MD5" },
2202       { { TLS, NULL },
2203         { SERVER_PROBLEM_NO_PROBLEM, { XMPP_PROBLEM_OLD_SSL, OK, OK, OK, OK } },
2204         { "moose", "something" },
2205         PORT_XMPP },
2206       { "weasel-juice.org", PORT_XMPP, "thud.org", REACHABLE, UNREACHABLE },
2207       { PLAINTEXT_OK,
2208         { "moose@weasel-juice.org", "something", DIGEST, TLS },
2209         { NULL, 0, XMPP_V1, OLD_SSL } } },
2210 
2211     { "/connector+ssl/tls+auth/secure/tlsplain/tls/digest",
2212       NOISY,
2213       { S_NO_ERROR, 0, 0, "DIGEST-MD5" },
2214       { { TLS, NULL },
2215         { SERVER_PROBLEM_NO_PROBLEM, { XMPP_PROBLEM_OLD_SSL, OK, OK, OK, OK } },
2216         { "moose", "something" },
2217         PORT_XMPP },
2218       { "weasel-juice.org", PORT_XMPP, "thud.org", REACHABLE, UNREACHABLE },
2219       { PLAINTEXT_OK,
2220         { "moose@weasel-juice.org", "something", PLAIN, TLS },
2221         { NULL, 0, XMPP_V1, OLD_SSL } } },
2222 
2223     { "/connector+ssl/tls+auth/insecure/no-tlsplain/tls/digest",
2224       NOISY,
2225       { S_NO_ERROR, 0, 0, "DIGEST-MD5" },
2226       { { TLS, NULL },
2227         { SERVER_PROBLEM_NO_PROBLEM, { XMPP_PROBLEM_OLD_SSL, OK, OK, OK, OK } },
2228         { "moose", "something" },
2229         PORT_XMPP },
2230       { "weasel-juice.org", PORT_XMPP, "thud.org", REACHABLE, UNREACHABLE },
2231       { PLAINTEXT_OK,
2232         { "moose@weasel-juice.org", "something", DIGEST, NOTLS },
2233         { NULL, 0, XMPP_V1, OLD_SSL } } },
2234 
2235     { "/connector+ssl/tls+auth/insecure/tlsplain/tls/digest",
2236       NOISY,
2237       { S_NO_ERROR, 0, 0, "DIGEST-MD5" },
2238       { { TLS, NULL },
2239         { SERVER_PROBLEM_NO_PROBLEM, { XMPP_PROBLEM_OLD_SSL, OK, OK, OK, OK } },
2240         { "moose", "something" },
2241         PORT_XMPP },
2242       { "weasel-juice.org", PORT_XMPP, "thud.org", REACHABLE, UNREACHABLE },
2243       { PLAINTEXT_OK,
2244         { "moose@weasel-juice.org", "something", PLAIN, NOTLS },
2245         { NULL, 0, XMPP_V1, OLD_SSL } } },
2246 
2247     /* ***************************************************************** *
2248      * SASL problems                                                     */
2249     { "/connector+ssl/problem/sasl/bad-pass",
2250       NOISY,
2251       { S_WOCKY_AUTH_ERROR, WOCKY_AUTH_ERROR_FAILURE, -1 },
2252       { { TLS, NULL },
2253         { SERVER_PROBLEM_INVALID_PASSWORD,
2254           { XMPP_PROBLEM_OLD_SSL, OK, OK, OK, OK } },
2255         { "foo", "bar" },
2256         PORT_XMPP },
2257       { "weasel-juice.org", PORT_XMPP, "thud.org", REACHABLE, UNREACHABLE },
2258       { PLAINTEXT_OK,
2259         { "foo@weasel-juice.org", "notbar", PLAIN, NOTLS },
2260         { NULL, 0, XMPP_V1, OLD_SSL } } },
2261 
2262     { "/connector+ssl/problem/sasl/bad-user",
2263       NOISY,
2264       { S_WOCKY_AUTH_ERROR, WOCKY_AUTH_ERROR_FAILURE, -1 },
2265       { { TLS, NULL },
2266         { SERVER_PROBLEM_INVALID_USERNAME,
2267           { XMPP_PROBLEM_OLD_SSL, OK, OK, OK, OK } },
2268         { "moose", "something" },
2269         PORT_XMPP },
2270       { "weasel-juice.org", PORT_XMPP, "thud.org", REACHABLE, UNREACHABLE },
2271       { PLAINTEXT_OK,
2272         { "caribou@weasel-juice.org", "something", PLAIN, NOTLS },
2273         { NULL, 0, XMPP_V1, OLD_SSL } } },
2274 
2275     { "/connector+ssl/problem/sasl/no-sasl",
2276       NOISY,
2277       { S_WOCKY_AUTH_ERROR, WOCKY_AUTH_ERROR_NOT_SUPPORTED, -1 },
2278       { { TLS, NULL },
2279         { SERVER_PROBLEM_NO_SASL, { XMPP_PROBLEM_OLD_SSL, OK, OK, OK, OK } },
2280         { "moose", "something" },
2281         PORT_XMPP },
2282       { "weasel-juice.org", PORT_XMPP, "thud.org", REACHABLE, UNREACHABLE },
2283       { PLAINTEXT_OK,
2284         { "moose@weasel-juice.org", "something", PLAIN, NOTLS },
2285         { NULL, 0, XMPP_V1, OLD_SSL } } },
2286 
2287     { "/connector+ssl/problem/sas/no-mechanisms",
2288       NOISY,
2289       { S_WOCKY_AUTH_ERROR, WOCKY_AUTH_ERROR_NOT_SUPPORTED, -1 },
2290       { { TLS, NULL },
2291         { SERVER_PROBLEM_NO_MECHANISMS,
2292           { XMPP_PROBLEM_OLD_SSL, OK, OK, OK, OK } },
2293         { "moose", "something" },
2294         PORT_XMPP },
2295       { "weasel-juice.org", PORT_XMPP, "thud.org", REACHABLE, UNREACHABLE },
2296       { PLAINTEXT_OK,
2297         { "moose@weasel-juice.org", "something", PLAIN, NOTLS },
2298         { NULL, 0, XMPP_V1, OLD_SSL } } },
2299 
2300     { "/connector+ssl/problem/sasl/bad-mechanism",
2301       NOISY,
2302       { S_WOCKY_AUTH_ERROR, WOCKY_AUTH_ERROR_NO_SUPPORTED_MECHANISMS, -1 },
2303       { { TLS, "omg-poniez" },
2304         { SERVER_PROBLEM_NO_PROBLEM, { XMPP_PROBLEM_OLD_SSL, OK, OK, OK, OK } },
2305         { "moose", "something" },
2306         PORT_XMPP },
2307       { "weasel-juice.org", PORT_XMPP, "thud.org", REACHABLE, UNREACHABLE },
2308       { PLAINTEXT_OK,
2309         { "moose@weasel-juice.org", "something", PLAIN, NOTLS },
2310         { NULL, 0, XMPP_V1, OLD_SSL } } },
2311 
2312     { "/connector+ssl/problem/xmpp/version/0.x",
2313       NOISY,
2314       { S_WOCKY_CONNECTOR_ERROR,
2315         WOCKY_CONNECTOR_ERROR_NON_XMPP_V1_SERVER, -1 },
2316       { { TLS, NULL, "0.9" },
2317         { SERVER_PROBLEM_NO_PROBLEM, { XMPP_PROBLEM_OLD_SSL, OK, OK, OK, OK } },
2318         { "moose", "something" },
2319         PORT_XMPP },
2320       { "weasel-juice.org", PORT_XMPP, "thud.org", REACHABLE, UNREACHABLE },
2321       { PLAINTEXT_OK,
2322         { "moose@weasel-juice.org", "something", PLAIN, NOTLS },
2323         { NULL, 0, XMPP_V1, OLD_SSL } } },
2324 
2325     /* we actually tolerate > 1.0 versions */
2326     { "/connector+ssl/problem/xmpp/version/1.x",
2327       NOISY,
2328       { S_NO_ERROR, 0, 0, "DIGEST-MD5" },
2329       { { TLS, NULL, "1.1" },
2330         { SERVER_PROBLEM_NO_PROBLEM, { XMPP_PROBLEM_OLD_SSL, OK, OK, OK, OK } },
2331         { "moose", "something" },
2332         PORT_XMPP },
2333       { "weasel-juice.org", PORT_XMPP, "thud.org", REACHABLE, UNREACHABLE },
2334       { PLAINTEXT_OK,
2335         { "moose@weasel-juice.org", "something", PLAIN, NOTLS },
2336         { NULL, 0, XMPP_V1, OLD_SSL } } },
2337 
2338     { "/connector+ssl/problem/xmpp/error/host-unknown",
2339       NOISY,
2340       { S_WOCKY_XMPP_STREAM_ERROR, WOCKY_XMPP_STREAM_ERROR_HOST_UNKNOWN, -1 },
2341       { { TLS, NULL },
2342         { SERVER_PROBLEM_NO_PROBLEM,
2343           { XMPP_PROBLEM_OTHER_HOST|XMPP_PROBLEM_OLD_SSL, OK, OK, OK, OK } },
2344         { "moose", "something" },
2345         PORT_XMPP },
2346       { "weasel-juice.org", PORT_XMPP, "thud.org", REACHABLE, UNREACHABLE },
2347       { PLAINTEXT_OK,
2348         { "moose@weasel-juice.org", "something", PLAIN, NOTLS },
2349         { NULL, 0, XMPP_V1, OLD_SSL } } },
2350 
2351     { "/connector+ssl/problem/xmpp/error/bind-conflict",
2352       NOISY,
2353       { S_WOCKY_XMPP_STREAM_ERROR, WOCKY_XMPP_STREAM_ERROR_CONFLICT, -1 },
2354       { { TLS, NULL },
2355         { SERVER_PROBLEM_NO_PROBLEM,
2356           { XMPP_PROBLEM_OLD_SSL, BIND_PROBLEM_CLASH, OK, OK, OK } },
2357         { "moose", "something" },
2358         PORT_XMPP },
2359       { "weasel-juice.org", PORT_XMPP, "thud.org", REACHABLE, UNREACHABLE },
2360       { PLAINTEXT_OK,
2361         { "moose@weasel-juice.org", "something", PLAIN, NOTLS },
2362         { NULL, 0, XMPP_V1, OLD_SSL } } },
2363 
2364     { "/connector+ssl/problem/xmpp/error/session-fail",
2365       NOISY,
2366       { S_WOCKY_XMPP_STREAM_ERROR,
2367         WOCKY_XMPP_STREAM_ERROR_RESOURCE_CONSTRAINT, -1 },
2368       { { TLS, NULL },
2369         { SERVER_PROBLEM_NO_PROBLEM,
2370           { XMPP_PROBLEM_OLD_SSL, OK, SESSION_PROBLEM_NO_SESSION, OK, OK } },
2371         { "moose", "something" },
2372         PORT_XMPP },
2373       { "weasel-juice.org", PORT_XMPP, "thud.org", REACHABLE, UNREACHABLE },
2374       { PLAINTEXT_OK,
2375         { "moose@weasel-juice.org", "something", PLAIN, NOTLS },
2376         { NULL, 0, XMPP_V1, OLD_SSL } } },
2377 
2378     { "/connector+ssl/problem/xmpp/features",
2379       NOISY,
2380       { S_WOCKY_CONNECTOR_ERROR, WOCKY_CONNECTOR_ERROR_BAD_FEATURES, -1 },
2381       { { TLS, NULL },
2382         { SERVER_PROBLEM_NO_PROBLEM,
2383           { XMPP_PROBLEM_FEATURES|XMPP_PROBLEM_OLD_SSL, OK, OK, OK, OK } },
2384         { "moose", "something" },
2385         PORT_XMPP },
2386       { "weasel-juice.org", PORT_XMPP, "thud.org", REACHABLE, UNREACHABLE },
2387       { PLAINTEXT_OK,
2388         { "moose@weasel-juice.org", "something", PLAIN, NOTLS },
2389         { NULL, 0, XMPP_V1, OLD_SSL } } },
2390 
2391     /* WOCKY_CONNECTOR_ERROR_BIND_UNAVAILABLE */
2392     { "/connector+ssl/problem/xmpp/no-bind",
2393       NOISY,
2394       { S_WOCKY_CONNECTOR_ERROR, WOCKY_CONNECTOR_ERROR_BIND_UNAVAILABLE, -1 },
2395       { { TLS, NULL },
2396         { SERVER_PROBLEM_NO_PROBLEM,
2397           { XMPP_PROBLEM_CANNOT_BIND|XMPP_PROBLEM_OLD_SSL, OK, OK, OK, OK } },
2398         { "moose", "something" },
2399         PORT_XMPP },
2400       { "weasel-juice.org", PORT_XMPP, "thud.org", REACHABLE, UNREACHABLE },
2401       { PLAINTEXT_OK,
2402         { "moose@weasel-juice.org", "something", PLAIN, NOTLS },
2403         { NULL, 0, XMPP_V1, OLD_SSL } } },
2404 
2405     /* WOCKY_CONNECTOR_ERROR_BIND_INVALID      */
2406     { "/connector+ssl/problem/xmpp/bind/invalid",
2407       NOISY,
2408       { S_WOCKY_CONNECTOR_ERROR, WOCKY_CONNECTOR_ERROR_BIND_INVALID, -1 },
2409       { { TLS, NULL },
2410         { SERVER_PROBLEM_NO_PROBLEM,
2411             { XMPP_PROBLEM_OLD_SSL, BIND_PROBLEM_INVALID, OK, OK, OK } },
2412         { "moose", "something" },
2413         PORT_XMPP },
2414       { "weasel-juice.org", PORT_XMPP, "thud.org", REACHABLE, UNREACHABLE },
2415       { PLAINTEXT_OK,
2416         { "moose@weasel-juice.org", "something", PLAIN, NOTLS },
2417         { NULL, 0, XMPP_V1, OLD_SSL } } },
2418 
2419     /* WOCKY_CONNECTOR_ERROR_BIND_DENIED     */
2420     { "/connector+ssl/problem/xmpp/bind/denied",
2421       NOISY,
2422       { S_WOCKY_CONNECTOR_ERROR, WOCKY_CONNECTOR_ERROR_BIND_DENIED, -1 },
2423       { { TLS, NULL },
2424         { SERVER_PROBLEM_NO_PROBLEM,
2425           { XMPP_PROBLEM_OLD_SSL, BIND_PROBLEM_DENIED, OK, OK, OK } },
2426         { "moose", "something" },
2427         PORT_XMPP },
2428       { "weasel-juice.org", PORT_XMPP, "thud.org", REACHABLE, UNREACHABLE },
2429       { PLAINTEXT_OK,
2430         { "moose@weasel-juice.org", "something", PLAIN, NOTLS },
2431         { NULL, 0, XMPP_V1, OLD_SSL } } },
2432 
2433     /* WOCKY_CONNECTOR_ERROR_BIND_CONFLICT      */
2434     { "/connector+ssl/problem/xmpp/bind/conflict",
2435       NOISY,
2436       { S_WOCKY_CONNECTOR_ERROR, WOCKY_CONNECTOR_ERROR_BIND_CONFLICT, -1 },
2437       { { TLS, NULL },
2438         { SERVER_PROBLEM_NO_PROBLEM,
2439           { XMPP_PROBLEM_OLD_SSL, BIND_PROBLEM_CONFLICT, OK, OK, OK } },
2440         { "moose", "something" },
2441         PORT_XMPP },
2442       { "weasel-juice.org", PORT_XMPP, "thud.org", REACHABLE, UNREACHABLE },
2443       { PLAINTEXT_OK,
2444         { "moose@weasel-juice.org", "something", PLAIN, NOTLS },
2445         { NULL, 0, XMPP_V1, OLD_SSL } } },
2446 
2447     /* WOCKY_CONNECTOR_ERROR_BIND_REJECTED    */
2448     { "/connector+ssl/problem/xmpp/bind/rejected",
2449       NOISY,
2450       { S_WOCKY_CONNECTOR_ERROR, WOCKY_CONNECTOR_ERROR_BIND_REJECTED, -1 },
2451       { { TLS, NULL },
2452         { SERVER_PROBLEM_NO_PROBLEM,
2453           { XMPP_PROBLEM_OLD_SSL, BIND_PROBLEM_REJECTED, OK, OK, OK } },
2454         { "moose", "something" },
2455         PORT_XMPP },
2456       { "weasel-juice.org", PORT_XMPP, "thud.org", REACHABLE, UNREACHABLE },
2457       { PLAINTEXT_OK,
2458         { "moose@weasel-juice.org", "something", PLAIN, NOTLS },
2459         { NULL, 0, XMPP_V1, OLD_SSL } } },
2460 
2461     /* WOCKY_CONNECTOR_ERROR_BIND_FAILED    */
2462     { "/connector+ssl/problem/xmpp/bind/failed",
2463       NOISY,
2464       { S_WOCKY_CONNECTOR_ERROR, WOCKY_CONNECTOR_ERROR_BIND_FAILED, -1 },
2465       { { TLS, NULL },
2466         { SERVER_PROBLEM_NO_PROBLEM,
2467           { XMPP_PROBLEM_OLD_SSL, BIND_PROBLEM_FAILED, OK, OK, OK } },
2468         { "moose", "something" },
2469         PORT_XMPP },
2470       { "weasel-juice.org", PORT_XMPP, "thud.org", REACHABLE, UNREACHABLE },
2471       { PLAINTEXT_OK,
2472         { "moose@weasel-juice.org", "something", PLAIN, NOTLS },
2473         { NULL, 0, XMPP_V1, OLD_SSL } } },
2474 
2475     { "/connector+ssl/problem/xmpp/bind/nonsense",
2476       NOISY,
2477       { S_WOCKY_CONNECTOR_ERROR, WOCKY_CONNECTOR_ERROR_BIND_FAILED, -1 },
2478       { { TLS, NULL },
2479         { SERVER_PROBLEM_NO_PROBLEM,
2480           { XMPP_PROBLEM_OLD_SSL, BIND_PROBLEM_NONSENSE, OK, OK, OK } },
2481         { "moose", "something" },
2482         PORT_XMPP },
2483       { "weasel-juice.org", PORT_XMPP, "thud.org", REACHABLE, UNREACHABLE },
2484       { PLAINTEXT_OK,
2485         { "moose@weasel-juice.org", "something", PLAIN, NOTLS },
2486         { NULL, 0, XMPP_V1, OLD_SSL } } },
2487 
2488     { "/connector+ssl/problem/xmpp/bind/no-jid",
2489       NOISY,
2490       { S_NO_ERROR, 0, 0, "DIGEST-MD5" },
2491       { { TLS, NULL },
2492         { SERVER_PROBLEM_NO_PROBLEM,
2493           { XMPP_PROBLEM_OLD_SSL, BIND_PROBLEM_NO_JID, OK, OK, OK } },
2494         { "moose", "something" },
2495         PORT_XMPP },
2496       { "weasel-juice.org", PORT_XMPP, "thud.org", REACHABLE, UNREACHABLE },
2497       { PLAINTEXT_OK,
2498         { "moose@weasel-juice.org", "something", PLAIN, NOTLS },
2499         { NULL, 0, XMPP_V1, OLD_SSL } } },
2500 
2501     { "/connector+ssl/problem/xmpp/session/none",
2502       NOISY,
2503       { S_NO_ERROR, 0, 0, "DIGEST-MD5" },
2504       { { TLS, NULL },
2505         { SERVER_PROBLEM_NO_PROBLEM,
2506           { XMPP_PROBLEM_NO_SESSION|XMPP_PROBLEM_OLD_SSL, OK, OK, OK, OK } },
2507         { "moose", "something" },
2508         PORT_XMPP },
2509       { "weasel-juice.org", PORT_XMPP, "thud.org", REACHABLE, UNREACHABLE },
2510       { PLAINTEXT_OK,
2511         { "moose@weasel-juice.org", "something", PLAIN, NOTLS },
2512         { NULL, 0, XMPP_V1, OLD_SSL } } },
2513 
2514     /* WOCKY_CONNECTOR_ERROR_SESSION_FAILED   */
2515     { "/connector+ssl/problem/xmpp/session/failed",
2516       NOISY,
2517       { S_WOCKY_CONNECTOR_ERROR, WOCKY_CONNECTOR_ERROR_SESSION_FAILED, -1 },
2518       { { TLS, NULL },
2519         { SERVER_PROBLEM_NO_PROBLEM,
2520           { XMPP_PROBLEM_OLD_SSL, OK, SESSION_PROBLEM_FAILED, OK, OK } },
2521         { "moose", "something" },
2522         PORT_XMPP },
2523       { "weasel-juice.org", PORT_XMPP, "thud.org", REACHABLE, UNREACHABLE },
2524       { PLAINTEXT_OK,
2525         { "moose@weasel-juice.org", "something", PLAIN, NOTLS },
2526         { NULL, 0, XMPP_V1, OLD_SSL } } },
2527 
2528     /* WOCKY_CONNECTOR_ERROR_SESSION_DENIED   */
2529     { "/connector+ssl/problem/xmpp/session/denied",
2530       NOISY,
2531       { S_WOCKY_CONNECTOR_ERROR, WOCKY_CONNECTOR_ERROR_SESSION_DENIED, -1 },
2532       { { TLS, NULL },
2533         { SERVER_PROBLEM_NO_PROBLEM,
2534           { XMPP_PROBLEM_OLD_SSL, OK, SESSION_PROBLEM_DENIED, OK, OK } },
2535         { "moose", "something" },
2536         PORT_XMPP },
2537       { "weasel-juice.org", PORT_XMPP, "thud.org", REACHABLE, UNREACHABLE },
2538       { PLAINTEXT_OK,
2539         { "moose@weasel-juice.org", "something", PLAIN, NOTLS },
2540         { NULL, 0, XMPP_V1, OLD_SSL } } },
2541 
2542     /* WOCKY_CONNECTOR_ERROR_SESSION_CONFLICT */
2543     { "/connector+ssl/problem/xmpp/session/conflict",
2544       NOISY,
2545       { S_WOCKY_CONNECTOR_ERROR, WOCKY_CONNECTOR_ERROR_SESSION_CONFLICT, -1 },
2546       { { TLS, NULL },
2547         { SERVER_PROBLEM_NO_PROBLEM,
2548           { XMPP_PROBLEM_OLD_SSL, OK, SESSION_PROBLEM_CONFLICT, OK, OK } },
2549         { "moose", "something" },
2550         PORT_XMPP },
2551       { "weasel-juice.org", PORT_XMPP, "thud.org", REACHABLE, UNREACHABLE },
2552       { PLAINTEXT_OK,
2553         { "moose@weasel-juice.org", "something", PLAIN, NOTLS },
2554         { NULL, 0, XMPP_V1, OLD_SSL } } },
2555 
2556     /* WOCKY_CONNECTOR_ERROR_SESSION_REJECTED */
2557     { "/connector+ssl/problem/xmpp/session/rejected",
2558       NOISY,
2559       { S_WOCKY_CONNECTOR_ERROR, WOCKY_CONNECTOR_ERROR_SESSION_REJECTED, -1 },
2560       { { TLS, NULL },
2561         { SERVER_PROBLEM_NO_PROBLEM,
2562           { XMPP_PROBLEM_OLD_SSL, OK, SESSION_PROBLEM_REJECTED, OK, OK } },
2563         { "moose", "something" },
2564         PORT_XMPP },
2565       { "weasel-juice.org", PORT_XMPP, "thud.org", REACHABLE, UNREACHABLE },
2566       { PLAINTEXT_OK,
2567         { "moose@weasel-juice.org", "something", PLAIN, NOTLS },
2568         { NULL, 0, XMPP_V1, OLD_SSL } } },
2569 
2570     { "/connector+ssl/problem/xmpp/session/nonsense",
2571       NOISY,
2572       { S_WOCKY_CONNECTOR_ERROR, WOCKY_CONNECTOR_ERROR_SESSION_FAILED, -1 },
2573       { { TLS, NULL },
2574         { SERVER_PROBLEM_NO_PROBLEM,
2575           { XMPP_PROBLEM_OLD_SSL, OK, SESSION_PROBLEM_NONSENSE, OK, OK } },
2576         { "moose", "something" },
2577         PORT_XMPP },
2578       { "weasel-juice.org", PORT_XMPP, "thud.org", REACHABLE, UNREACHABLE },
2579       { PLAINTEXT_OK,
2580         { "moose@weasel-juice.org", "something", PLAIN, NOTLS },
2581         { NULL, 0, XMPP_V1, OLD_SSL } } },
2582 
2583     { "/connector+ssl/econnreset/server-start",
2584       NOISY,
2585       { S_ANY_ERROR, 0 },
2586       { { TLS, NULL },
2587         { SERVER_PROBLEM_NO_PROBLEM,
2588           { XMPP_PROBLEM_OLD_SSL, OK, OK, SERVER_DEATH_SERVER_START, OK } },
2589         { "moose", "something" },
2590         PORT_XMPP },
2591       { "weasel-juice.org", PORT_XMPP, "thud.org", REACHABLE, UNREACHABLE },
2592       { PLAINTEXT_OK,
2593         { "moose@weasel-juice.org", "something", PLAIN, NOTLS },
2594         { NULL, 0, XMPP_V1, OLD_SSL } } },
2595 
2596     { "/connector+ssl/econnreset/client-open",
2597       NOISY,
2598       { S_ANY_ERROR, 0 },
2599       { { TLS, NULL },
2600         { SERVER_PROBLEM_NO_PROBLEM,
2601           { XMPP_PROBLEM_OLD_SSL, OK, OK, SERVER_DEATH_CLIENT_OPEN, OK } },
2602         { "moose", "something" },
2603         PORT_XMPP },
2604       { "weasel-juice.org", PORT_XMPP, "thud.org", REACHABLE, UNREACHABLE },
2605       { PLAINTEXT_OK,
2606         { "moose@weasel-juice.org", "something", PLAIN, NOTLS },
2607         { NULL, 0, XMPP_V1, OLD_SSL } } },
2608 
2609     { "/connector+ssl/econnreset/server-open",
2610       NOISY,
2611       { S_ANY_ERROR, 0 },
2612       { { TLS, NULL },
2613         { SERVER_PROBLEM_NO_PROBLEM,
2614           { XMPP_PROBLEM_OLD_SSL, OK, OK, SERVER_DEATH_SERVER_OPEN, OK } },
2615         { "moose", "something" },
2616         PORT_XMPP },
2617       { "weasel-juice.org", PORT_XMPP, "thud.org", REACHABLE, UNREACHABLE },
2618       { PLAINTEXT_OK,
2619         { "moose@weasel-juice.org", "something", PLAIN, NOTLS },
2620         { NULL, 0, XMPP_V1, OLD_SSL } } },
2621 
2622     { "/connector+ssl/econnreset/features",
2623       NOISY,
2624       { S_ANY_ERROR, 0 },
2625       { { TLS, NULL },
2626         { SERVER_PROBLEM_NO_PROBLEM,
2627           { XMPP_PROBLEM_OLD_SSL, OK, OK, SERVER_DEATH_FEATURES, OK } },
2628         { "moose", "something" },
2629         PORT_XMPP },
2630       { "weasel-juice.org", PORT_XMPP, "thud.org", REACHABLE, UNREACHABLE },
2631       { PLAINTEXT_OK,
2632         { "moose@weasel-juice.org", "something", PLAIN, NOTLS },
2633         { NULL, 0, XMPP_V1, OLD_SSL } } },
2634 
2635     { "/connector+ssl/econnreset/ssl-negotiate",
2636       QUIET,
2637       { S_ANY_ERROR, 0 },
2638       { { TLS, NULL },
2639         { SERVER_PROBLEM_NO_PROBLEM,
2640           { XMPP_PROBLEM_OLD_SSL, OK, OK, SERVER_DEATH_TLS_NEG, OK } },
2641         { "moose", "something" },
2642         PORT_XMPP },
2643       { "weasel-juice.org", PORT_XMPP, "thud.org", REACHABLE, UNREACHABLE },
2644       { PLAINTEXT_OK,
2645         { "moose@weasel-juice.org", "something", PLAIN, NOTLS },
2646         { NULL, 0, XMPP_V1, OLD_SSL } } },
2647 
2648     /* ********************************************************************* */
2649     /* certificate verification tests                                        */
2650     { "/connector/cert-verification/tls/nohost/ok",
2651       QUIET,
2652       { S_NO_ERROR, },
2653       { { TLS, NULL },
2654         { SERVER_PROBLEM_NO_PROBLEM, CONNECTOR_OK },
2655         { "moose", "something" },
2656         PORT_XMPP },
2657         { "weasel-juice.org", PORT_XMPP, "thud.org", REACHABLE, UNREACHABLE },
2658         { PLAINTEXT_OK,
2659           { "moose@weasel-juice.org", "something", PLAIN, TLS },
2660           { NULL, 0, XMPP_V1 } } },
2661 
2662     { "/connector/multica-verification/tls/nohost/ok",
2663       QUIET,
2664       { S_NO_ERROR, },
2665       { { TLS, NULL },
2666         { SERVER_PROBLEM_NO_PROBLEM, CONNECTOR_OK },
2667         { "moose", "something" },
2668         PORT_XMPP },
2669         { "weasel-juice.org", PORT_XMPP, "thud.org", REACHABLE, UNREACHABLE },
2670         { PLAINTEXT_OK,
2671           { "moose@weasel-juice.org", "something", PLAIN, TLS },
2672           { NULL, 0, XMPP_V1, STARTTLS, CERT_CHECK_STRICT, TLS_CA_DIR } } },
2673 
2674     { "/connector/cert-verification/tls/host/ok",
2675       QUIET,
2676       { S_NO_ERROR, },
2677       { { TLS, NULL },
2678         { SERVER_PROBLEM_NO_PROBLEM, CONNECTOR_OK },
2679         { "moose", "something" },
2680         PORT_XMPP },
2681         { NULL, 0, "thud.org", REACHABLE, NULL },
2682         { PLAINTEXT_OK,
2683           { "moose@weasel-juice.org", "something", PLAIN, TLS },
2684           { "thud.org", 0, XMPP_V1 } } },
2685 
2686     { "/connector/cert-verification/tls/nohost/fail/name-mismatch",
2687       QUIET,
2688       { S_WOCKY_TLS_CERT_ERROR, WOCKY_TLS_CERT_NAME_MISMATCH, -1 },
2689       { { TLS, NULL },
2690         { SERVER_PROBLEM_NO_PROBLEM, CONNECTOR_OK },
2691         { "moose", "something" },
2692         PORT_XMPP },
2693         { "tomato-juice.org", PORT_XMPP, "thud.org", REACHABLE, UNREACHABLE },
2694         { PLAINTEXT_OK,
2695           { "moose@tomato-juice.org", "something", PLAIN, TLS },
2696           { NULL, 0, XMPP_V1 } } },
2697 
2698     { "/connector/cert-verification/tls/host/fail/name-mismatch",
2699       QUIET,
2700       { S_WOCKY_TLS_CERT_ERROR, WOCKY_TLS_CERT_NAME_MISMATCH, -1 },
2701       { { TLS, NULL },
2702         { SERVER_PROBLEM_NO_PROBLEM, CONNECTOR_OK },
2703         { "moose", "something" },
2704         PORT_XMPP },
2705         { NULL, 0, "tomato-juice.org", REACHABLE, NULL },
2706         { PLAINTEXT_OK,
2707           { "moose@tomato-juice.org", "something", PLAIN, TLS },
2708           { "tomato-juice.org", 0, XMPP_V1 } } },
2709 
2710     { "/connector/cert-verification/tls/expired/fail",
2711       QUIET,
2712       { S_WOCKY_TLS_CERT_ERROR, WOCKY_TLS_CERT_EXPIRED, -1 },
2713       { { TLS, NULL },
2714         { SERVER_PROBLEM_NO_PROBLEM, CONNECTOR_OK },
2715         { "moose", "something" },
2716         PORT_XMPP, CERT_EXPIRED },
2717         { "weasel-juice.org", PORT_XMPP, "thud.org", REACHABLE, UNREACHABLE },
2718         { PLAINTEXT_OK,
2719           { "moose@weasel-juice.org", "something", PLAIN, TLS },
2720           { NULL, 0, XMPP_V1 } } },
2721 
2722     { "/connector/cert-verification/tls/inactive/fail",
2723       QUIET,
2724       { S_WOCKY_TLS_CERT_ERROR, WOCKY_TLS_CERT_NOT_ACTIVE, -1 },
2725       { { TLS, NULL },
2726         { SERVER_PROBLEM_NO_PROBLEM, CONNECTOR_OK },
2727         { "moose", "something" },
2728         PORT_XMPP, CERT_NOT_YET },
2729         { "weasel-juice.org", PORT_XMPP, "thud.org", REACHABLE, UNREACHABLE },
2730         { PLAINTEXT_OK,
2731           { "moose@weasel-juice.org", "something", PLAIN, TLS },
2732           { NULL, 0, XMPP_V1 } } },
2733 
2734     { "/connector/cert-verification/tls/selfsigned/fail",
2735       QUIET,
2736       { S_WOCKY_TLS_CERT_ERROR, WOCKY_TLS_CERT_INVALID, -1 },
2737       { { TLS, NULL },
2738         { SERVER_PROBLEM_NO_PROBLEM, CONNECTOR_OK },
2739         { "moose", "something" },
2740         PORT_XMPP, CERT_SELFSIGN },
2741         { "weasel-juice.org", PORT_XMPP, "thud.org", REACHABLE, UNREACHABLE },
2742         { PLAINTEXT_OK,
2743           { "moose@weasel-juice.org", "something", PLAIN, TLS },
2744           { NULL, 0, XMPP_V1 } } },
2745 
2746     { "/connector/cert-verification/tls/unknown/fail",
2747       QUIET,
2748       { S_WOCKY_TLS_CERT_ERROR, WOCKY_TLS_CERT_SIGNER_UNKNOWN, -1 },
2749       { { TLS, NULL },
2750         { SERVER_PROBLEM_NO_PROBLEM, CONNECTOR_OK },
2751         { "moose", "something" },
2752         PORT_XMPP, CERT_UNKNOWN },
2753         { "weasel-juice.org", PORT_XMPP, "thud.org", REACHABLE, UNREACHABLE },
2754         { PLAINTEXT_OK,
2755           { "moose@weasel-juice.org", "something", PLAIN, TLS },
2756           { NULL, 0, XMPP_V1 } } },
2757 
2758     /* This is a combination of the above test
2759      * (/connector/cert-verification/tls/unknown/fail) and
2760      * /connector/cert-verification/tls/host/fail/name-mismatch. It checks that
2761      * Wocky considers a hostname mismatch more erroneous than the certificate
2762      * being broken.
2763      */
2764     { "/connector/cert-verification/tls/host/fail/name-mismatch-and-unknown",
2765       QUIET,
2766       { S_WOCKY_TLS_CERT_ERROR, WOCKY_TLS_CERT_NAME_MISMATCH, -1 },
2767       { { TLS, NULL },
2768         { SERVER_PROBLEM_NO_PROBLEM, CONNECTOR_OK },
2769         { "moose", "something" },
2770         PORT_XMPP, CERT_UNKNOWN },
2771         { "tomato-juice.org", PORT_XMPP, "thud.org", REACHABLE, UNREACHABLE },
2772         { PLAINTEXT_OK,
2773           { "moose@tomato-juice.org", "something", PLAIN, TLS },
2774           { NULL, 0, XMPP_V1 } } },
2775 
2776     { "/connector/cert-verification/tls/wildcard/ok",
2777       QUIET,
2778       { S_NO_ERROR },
2779       { { TLS, NULL },
2780         { SERVER_PROBLEM_NO_PROBLEM, CONNECTOR_OK },
2781         { "moose", "something" },
2782         PORT_XMPP, CERT_WILDCARD },
2783         { "foo.weasel-juice.org", PORT_XMPP, "thud.org", REACHABLE, UNREACHABLE },
2784         { TLS_REQUIRED,
2785           { "moose@foo.weasel-juice.org", "something", PLAIN, TLS },
2786           { NULL, 0, XMPP_V1, STARTTLS, CERT_CHECK_STRICT, TLS_CA_DIR } } },
2787 
2788     { "/connector/cert-verification/tls/wildcard/level-mismatch/fail",
2789       QUIET,
2790       { S_WOCKY_TLS_CERT_ERROR, WOCKY_TLS_CERT_NAME_MISMATCH, -1 },
2791       { { TLS, NULL },
2792         { SERVER_PROBLEM_NO_PROBLEM, CONNECTOR_OK },
2793         { "moose", "something" },
2794         PORT_XMPP, CERT_WILDCARD },
2795         { "weasel-juice.org", PORT_XMPP, "thud.org", REACHABLE, UNREACHABLE },
2796         { PLAINTEXT_OK,
2797           { "moose@weasel-juice.org", "something", PLAIN, TLS },
2798           { NULL, 0, XMPP_V1, STARTTLS, CERT_CHECK_STRICT, TLS_CA_DIR } } },
2799 
2800     { "/connector/cert-verification/tls/wildcard/glob-mismatch/fail",
2801       QUIET,
2802       { S_WOCKY_TLS_CERT_ERROR, WOCKY_TLS_CERT_NAME_MISMATCH, -1 },
2803       { { TLS, NULL },
2804         { SERVER_PROBLEM_NO_PROBLEM, CONNECTOR_OK },
2805         { "moose", "something" },
2806         PORT_XMPP, CERT_WILDCARD },
2807         { "foo.diesel-juice.org", PORT_XMPP, "thud.org", REACHABLE, UNREACHABLE },
2808         { TLS_REQUIRED,
2809           { "moose@foo.diesel-juice.org", "something", PLAIN, TLS },
2810           { NULL, 0, XMPP_V1, STARTTLS, CERT_CHECK_STRICT, TLS_CA_DIR } } },
2811 
2812     { "/connector/cert-verification/tls/bad-wildcard/fail",
2813       QUIET,
2814       { S_WOCKY_TLS_CERT_ERROR, WOCKY_TLS_CERT_NAME_MISMATCH, -1 },
2815       { { TLS, NULL },
2816         { SERVER_PROBLEM_NO_PROBLEM, CONNECTOR_OK },
2817         { "moose", "something" },
2818         PORT_XMPP, CERT_BADWILD },
2819         { "weasel-juice.org", PORT_XMPP, "thud.org", REACHABLE, UNREACHABLE },
2820         { TLS_REQUIRED,
2821           { "moose@weasel-juice.org", "something", PLAIN, TLS },
2822           { NULL, 0, XMPP_V1, STARTTLS, CERT_CHECK_STRICT, TLS_CA_DIR } } },
2823 
2824     { "/connector/cert-verification/tls/revoked/fail",
2825       QUIET,
2826       { S_WOCKY_TLS_CERT_ERROR, WOCKY_TLS_CERT_REVOKED, -1 },
2827       { { TLS, NULL },
2828         { SERVER_PROBLEM_NO_PROBLEM, CONNECTOR_OK },
2829         { "moose", "something" },
2830         PORT_XMPP, CERT_REVOKED },
2831         { "weasel-juice.org", PORT_XMPP, "thud.org", REACHABLE, UNREACHABLE },
2832         { TLS_REQUIRED,
2833           { "moose@weasel-juice.org", "something", PLAIN, TLS },
2834           { NULL, 0, XMPP_V1, STARTTLS, CERT_CHECK_STRICT, TLS_CA_DIR } } },
2835 
2836     { "/connector/cert-verification/tls/revoked/lenient/fail",
2837       QUIET,
2838       { S_WOCKY_TLS_CERT_ERROR, WOCKY_TLS_CERT_REVOKED, -1 },
2839       { { TLS, NULL },
2840         { SERVER_PROBLEM_NO_PROBLEM, CONNECTOR_OK },
2841         { "moose", "something" },
2842         PORT_XMPP, CERT_REVOKED },
2843         { "weasel-juice.org", PORT_XMPP, "thud.org", REACHABLE, UNREACHABLE },
2844         { TLS_REQUIRED,
2845           { "moose@weasel-juice.org", "something", PLAIN, TLS },
2846           { NULL, 0, XMPP_V1, STARTTLS, CERT_CHECK_LENIENT, TLS_CA_DIR } } },
2847 
2848     /* ********************************************************************* */
2849     /* as above but with legacy ssl                                          */
2850     { "/connector/cert-verification/ssl/nohost/ok",
2851       QUIET,
2852       { S_NO_ERROR, },
2853       { { TLS, NULL },
2854         { SERVER_PROBLEM_NO_PROBLEM, { XMPP_PROBLEM_OLD_SSL, OK, OK, OK, OK } },
2855         { "moose", "something" },
2856         PORT_XMPP },
2857         { "weasel-juice.org", PORT_XMPP, "thud.org", REACHABLE, UNREACHABLE },
2858         { PLAINTEXT_OK,
2859           { "moose@weasel-juice.org", "something", PLAIN, TLS },
2860           { NULL, 0, XMPP_V1, OLD_SSL } } },
2861 
2862     { "/connector/cert-verification/ssl/host/ok",
2863       QUIET,
2864       { S_NO_ERROR, },
2865       { { TLS, NULL },
2866         { SERVER_PROBLEM_NO_PROBLEM, { XMPP_PROBLEM_OLD_SSL, OK, OK, OK, OK } },
2867         { "moose", "something" },
2868         PORT_XMPP },
2869         { NULL, 0, "weasel-juice.org", REACHABLE, NULL },
2870         { PLAINTEXT_OK,
2871           { "moose@thud.org", "something", PLAIN, TLS },
2872           { "weasel-juice.org", PORT_XMPP, XMPP_V1, OLD_SSL } } },
2873 
2874     { "/connector/cert-verification/ssl/nohost/fail/name-mismatch",
2875       QUIET,
2876       { S_WOCKY_TLS_CERT_ERROR, WOCKY_TLS_CERT_NAME_MISMATCH, -1 },
2877       { { TLS, NULL },
2878         { SERVER_PROBLEM_NO_PROBLEM, { XMPP_PROBLEM_OLD_SSL, OK, OK, OK, OK } },
2879         { "moose", "something" },
2880         PORT_XMPP },
2881         { "tomato-juice.org", PORT_XMPP, "thud.org", REACHABLE, UNREACHABLE },
2882         { PLAINTEXT_OK,
2883           { "moose@tomato-juice.org", "something", PLAIN, TLS },
2884           { NULL, 0, XMPP_V1, OLD_SSL } } },
2885 
2886     { "/connector/cert-verification/ssl/host/fail/name-mismatch",
2887       QUIET,
2888       { S_WOCKY_TLS_CERT_ERROR, WOCKY_TLS_CERT_NAME_MISMATCH, -1 },
2889       { { TLS, NULL },
2890         { SERVER_PROBLEM_NO_PROBLEM, { XMPP_PROBLEM_OLD_SSL, OK, OK, OK, OK } },
2891         { "moose", "something" },
2892         PORT_XMPP },
2893         { NULL, 0, "tomato-juice.org", REACHABLE, NULL },
2894         { PLAINTEXT_OK,
2895           { "moose@tomato-juice.org", "something", PLAIN, TLS },
2896           { "tomato-juice.org", 0, XMPP_V1, OLD_SSL } } },
2897 
2898     { "/connector/cert-verification/ssl/expired/fail",
2899       QUIET,
2900       { S_WOCKY_TLS_CERT_ERROR, WOCKY_TLS_CERT_EXPIRED, -1 },
2901       { { TLS, NULL },
2902         { SERVER_PROBLEM_NO_PROBLEM, { XMPP_PROBLEM_OLD_SSL, OK, OK, OK, OK } },
2903         { "moose", "something" },
2904         PORT_XMPP, CERT_EXPIRED },
2905         { "weasel-juice.org", PORT_XMPP, "thud.org", REACHABLE, UNREACHABLE },
2906         { PLAINTEXT_OK,
2907           { "moose@weasel-juice.org", "something", PLAIN, TLS },
2908           { NULL, 0, XMPP_V1, OLD_SSL } } },
2909 
2910     { "/connector/cert-verification/ssl/inactive/fail",
2911       QUIET,
2912       { S_WOCKY_TLS_CERT_ERROR, WOCKY_TLS_CERT_NOT_ACTIVE, -1 },
2913       { { TLS, NULL },
2914         { SERVER_PROBLEM_NO_PROBLEM, { XMPP_PROBLEM_OLD_SSL, OK, OK, OK, OK } },
2915         { "moose", "something" },
2916         PORT_XMPP, CERT_NOT_YET },
2917         { "weasel-juice.org", PORT_XMPP, "thud.org", REACHABLE, UNREACHABLE },
2918         { PLAINTEXT_OK,
2919           { "moose@weasel-juice.org", "something", PLAIN, TLS },
2920           { NULL, 0, XMPP_V1, OLD_SSL } } },
2921 
2922     { "/connector/cert-verification/ssl/selfsigned/fail",
2923       QUIET,
2924       { S_WOCKY_TLS_CERT_ERROR, WOCKY_TLS_CERT_INVALID, -1 },
2925       { { TLS, NULL },
2926         { SERVER_PROBLEM_NO_PROBLEM, { XMPP_PROBLEM_OLD_SSL, OK, OK, OK, OK } },
2927         { "moose", "something" },
2928         PORT_XMPP, CERT_SELFSIGN },
2929         { "weasel-juice.org", PORT_XMPP, "thud.org", REACHABLE, UNREACHABLE },
2930         { PLAINTEXT_OK,
2931           { "moose@weasel-juice.org", "something", PLAIN, TLS },
2932           { NULL, 0, XMPP_V1, OLD_SSL } } },
2933 
2934     { "/connector/cert-verification/ssl/unknown/fail",
2935       QUIET,
2936       { S_WOCKY_TLS_CERT_ERROR, WOCKY_TLS_CERT_SIGNER_UNKNOWN, -1 },
2937       { { TLS, NULL },
2938         { SERVER_PROBLEM_NO_PROBLEM, { XMPP_PROBLEM_OLD_SSL, OK, OK, OK, OK } },
2939         { "moose", "something" },
2940         PORT_XMPP, CERT_UNKNOWN },
2941         { "weasel-juice.org", PORT_XMPP, "thud.org", REACHABLE, UNREACHABLE },
2942         { PLAINTEXT_OK,
2943           { "moose@weasel-juice.org", "something", PLAIN, TLS },
2944           { NULL, 0, XMPP_V1, OLD_SSL } } },
2945 
2946     { "/connector/cert-verification/ssl/wildcard/ok",
2947       QUIET,
2948       { S_NO_ERROR },
2949       { { TLS, NULL },
2950         { SERVER_PROBLEM_NO_PROBLEM, { XMPP_PROBLEM_OLD_SSL, OK, OK, OK, OK } },
2951         { "moose", "something" },
2952         PORT_XMPP, CERT_WILDCARD },
2953         { "foo.weasel-juice.org", PORT_XMPP, "thud.org", REACHABLE, UNREACHABLE },
2954         { TLS_REQUIRED,
2955           { "moose@foo.weasel-juice.org", "something", PLAIN, TLS },
2956           { NULL, 0, XMPP_V1, OLD_SSL, CERT_CHECK_STRICT, TLS_CA_DIR } } },
2957 
2958     { "/connector/cert-verification/ssl/wildcard/level-mismatch/fail",
2959       QUIET,
2960       { S_WOCKY_TLS_CERT_ERROR, WOCKY_TLS_CERT_NAME_MISMATCH, -1 },
2961       { { TLS, NULL },
2962         { SERVER_PROBLEM_NO_PROBLEM, { XMPP_PROBLEM_OLD_SSL, OK, OK, OK, OK } },
2963         { "moose", "something" },
2964         PORT_XMPP, CERT_WILDCARD },
2965         { "weasel-juice.org", PORT_XMPP, "thud.org", REACHABLE, UNREACHABLE },
2966         { PLAINTEXT_OK,
2967           { "moose@weasel-juice.org", "something", PLAIN, TLS },
2968           { NULL, 0, XMPP_V1, OLD_SSL, CERT_CHECK_STRICT, TLS_CA_DIR } } },
2969 
2970     { "/connector/cert-verification/ssl/wildcard/glob-mismatch/fail",
2971       QUIET,
2972       { S_WOCKY_TLS_CERT_ERROR, WOCKY_TLS_CERT_NAME_MISMATCH, -1 },
2973       { { TLS, NULL },
2974         { SERVER_PROBLEM_NO_PROBLEM, { XMPP_PROBLEM_OLD_SSL, OK, OK, OK, OK } },
2975         { "moose", "something" },
2976         PORT_XMPP, CERT_WILDCARD },
2977         { "foo.diesel-juice.org", PORT_XMPP, "thud.org", REACHABLE, UNREACHABLE },
2978         { TLS_REQUIRED,
2979           { "moose@foo.diesel-juice.org", "something", PLAIN, TLS },
2980           { NULL, 0, XMPP_V1, OLD_SSL, CERT_CHECK_STRICT, TLS_CA_DIR } } },
2981 
2982     { "/connector/cert-verification/ssl/bad-wildcard/fail",
2983       QUIET,
2984       { S_WOCKY_TLS_CERT_ERROR, WOCKY_TLS_CERT_NAME_MISMATCH, -1 },
2985       { { TLS, NULL },
2986         { SERVER_PROBLEM_NO_PROBLEM, { XMPP_PROBLEM_OLD_SSL, OK, OK, OK, OK } },
2987         { "moose", "something" },
2988         PORT_XMPP, CERT_BADWILD },
2989         { "weasel-juice.org", PORT_XMPP, "thud.org", REACHABLE, UNREACHABLE },
2990         { TLS_REQUIRED,
2991           { "moose@weasel-juice.org", "something", PLAIN, TLS },
2992           { NULL, 0, XMPP_V1, OLD_SSL, CERT_CHECK_STRICT, TLS_CA_DIR } } },
2993 
2994     { "/connector/cert-verification/ssl/revoked/fail",
2995       QUIET,
2996       { S_WOCKY_TLS_CERT_ERROR, WOCKY_TLS_CERT_REVOKED, -1 },
2997       { { TLS, NULL },
2998         { SERVER_PROBLEM_NO_PROBLEM, { XMPP_PROBLEM_OLD_SSL, OK, OK, OK, OK } },
2999         { "moose", "something" },
3000         PORT_XMPP, CERT_REVOKED },
3001         { "weasel-juice.org", PORT_XMPP, "thud.org", REACHABLE, UNREACHABLE },
3002         { TLS_REQUIRED,
3003           { "moose@weasel-juice.org", "something", PLAIN, TLS },
3004           { NULL, 0, XMPP_V1, OLD_SSL, CERT_CHECK_STRICT, TLS_CA_DIR } } },
3005 
3006     { "/connector/cert-verification/ssl/revoked/lenient/fail",
3007       QUIET,
3008       { S_WOCKY_TLS_CERT_ERROR, WOCKY_TLS_CERT_REVOKED, -1 },
3009       { { TLS, NULL },
3010         { SERVER_PROBLEM_NO_PROBLEM, { XMPP_PROBLEM_OLD_SSL, OK, OK, OK, OK } },
3011         { "moose", "something" },
3012         PORT_XMPP, CERT_REVOKED },
3013         { "weasel-juice.org", PORT_XMPP, "thud.org", REACHABLE, UNREACHABLE },
3014         { TLS_REQUIRED,
3015           { "moose@weasel-juice.org", "something", PLAIN, TLS },
3016           { NULL, 0, XMPP_V1, OLD_SSL, CERT_CHECK_LENIENT, TLS_CA_DIR } } },
3017 
3018     /* ********************************************************************* */
3019     /* certificate non-verification tests                                    */
3020     { "/connector/cert-nonverification/tls/nohost/ok",
3021       QUIET,
3022       { S_NO_ERROR, },
3023       { { TLS, NULL },
3024         { SERVER_PROBLEM_NO_PROBLEM, CONNECTOR_OK },
3025         { "moose", "something" },
3026         PORT_XMPP },
3027         { "weasel-juice.org", PORT_XMPP, "thud.org", REACHABLE, UNREACHABLE },
3028         { PLAINTEXT_OK,
3029           { "moose@weasel-juice.org", "something", PLAIN, TLS },
3030           { NULL, 0, XMPP_V1 } } },
3031 
3032     { "/connector/cert-nonverification/tls/host/ok",
3033       QUIET,
3034       { S_NO_ERROR, },
3035       { { TLS, NULL },
3036         { SERVER_PROBLEM_NO_PROBLEM, CONNECTOR_OK },
3037         { "moose", "something" },
3038         PORT_XMPP },
3039         { NULL, 0, "thud.org", REACHABLE, NULL },
3040         { PLAINTEXT_OK,
3041           { "moose@weasel-juice.org", "something", PLAIN, TLS },
3042           { "thud.org", 0, XMPP_V1, STARTTLS, CERT_CHECK_LENIENT } } },
3043 
3044     { "/connector/cert-nonverification/tls/nohost/ok/name-mismatch",
3045       QUIET,
3046       { S_NO_ERROR, },
3047       { { TLS, NULL },
3048         { SERVER_PROBLEM_NO_PROBLEM, CONNECTOR_OK },
3049         { "moose", "something" },
3050         PORT_XMPP },
3051         { "tomato-juice.org", PORT_XMPP, "thud.org", REACHABLE, UNREACHABLE },
3052         { PLAINTEXT_OK,
3053           { "moose@tomato-juice.org", "something", PLAIN, TLS },
3054           { NULL, 0, XMPP_V1, STARTTLS, CERT_CHECK_LENIENT } } },
3055 
3056     { "/connector/cert-nonverification/tls/host/ok/name-mismatch",
3057       QUIET,
3058       { S_NO_ERROR, },
3059       { { TLS, NULL },
3060         { SERVER_PROBLEM_NO_PROBLEM, CONNECTOR_OK },
3061         { "moose", "something" },
3062         PORT_XMPP },
3063         { NULL, 0, "tomato-juice.org", REACHABLE, NULL },
3064         { PLAINTEXT_OK,
3065           { "moose@tomato-juice.org", "something", PLAIN, TLS },
3066           { "tomato-juice.org", 0, XMPP_V1, STARTTLS, CERT_CHECK_LENIENT } } },
3067 
3068     { "/connector/cert-nonverification/tls/expired/ok",
3069       QUIET,
3070       { S_NO_ERROR, },
3071       { { TLS, NULL },
3072         { SERVER_PROBLEM_NO_PROBLEM, CONNECTOR_OK },
3073         { "moose", "something" },
3074         PORT_XMPP, CERT_EXPIRED },
3075         { "weasel-juice.org", PORT_XMPP, "thud.org", REACHABLE, UNREACHABLE },
3076         { PLAINTEXT_OK,
3077           { "moose@weasel-juice.org", "something", PLAIN, TLS },
3078           { NULL, 0, XMPP_V1, STARTTLS, CERT_CHECK_LENIENT } } },
3079 
3080     { "/connector/cert-nonverification/tls/inactive/ok",
3081       QUIET,
3082       { S_NO_ERROR, },
3083       { { TLS, NULL },
3084         { SERVER_PROBLEM_NO_PROBLEM, CONNECTOR_OK },
3085         { "moose", "something" },
3086         PORT_XMPP, CERT_NOT_YET },
3087         { "weasel-juice.org", PORT_XMPP, "thud.org", REACHABLE, UNREACHABLE },
3088         { PLAINTEXT_OK,
3089           { "moose@weasel-juice.org", "something", PLAIN, TLS },
3090           { NULL, 0, XMPP_V1, STARTTLS, CERT_CHECK_LENIENT } } },
3091 
3092     { "/connector/cert-nonverification/tls/selfsigned/ok",
3093       QUIET,
3094       { S_NO_ERROR, },
3095       { { TLS, NULL },
3096         { SERVER_PROBLEM_NO_PROBLEM, CONNECTOR_OK },
3097         { "moose", "something" },
3098         PORT_XMPP, CERT_SELFSIGN },
3099         { "weasel-juice.org", PORT_XMPP, "thud.org", REACHABLE, UNREACHABLE },
3100         { PLAINTEXT_OK,
3101           { "moose@weasel-juice.org", "something", PLAIN, TLS },
3102           { NULL, 0, XMPP_V1, STARTTLS, CERT_CHECK_LENIENT } } },
3103 
3104     { "/connector/cert-nonverification/tls/unknown/ok",
3105       QUIET,
3106       { S_NO_ERROR, },
3107       { { TLS, NULL },
3108         { SERVER_PROBLEM_NO_PROBLEM, CONNECTOR_OK },
3109         { "moose", "something" },
3110         PORT_XMPP, CERT_UNKNOWN },
3111         { "weasel-juice.org", PORT_XMPP, "thud.org", REACHABLE, UNREACHABLE },
3112         { PLAINTEXT_OK,
3113           { "moose@weasel-juice.org", "something", PLAIN, TLS },
3114           { NULL, 0, XMPP_V1, STARTTLS, CERT_CHECK_LENIENT } } },
3115 
3116     /* ********************************************************************* */
3117     /* as above but with legacy ssl                                          */
3118     { "/connector/cert-nonverification/ssl/nohost/ok",
3119       QUIET,
3120       { S_NO_ERROR, },
3121       { { TLS, NULL },
3122         { SERVER_PROBLEM_NO_PROBLEM, { XMPP_PROBLEM_OLD_SSL, OK, OK, OK, OK } },
3123         { "moose", "something" },
3124         PORT_XMPP },
3125         { "weasel-juice.org", PORT_XMPP, "thud.org", REACHABLE, UNREACHABLE },
3126         { PLAINTEXT_OK,
3127           { "moose@weasel-juice.org", "something", PLAIN, TLS },
3128           { NULL, 0, XMPP_V1, OLD_SSL, CERT_CHECK_LENIENT } } },
3129 
3130     { "/connector/cert-nonverification/ssl/host/ok",
3131       QUIET,
3132       { S_NO_ERROR, },
3133       { { TLS, NULL },
3134         { SERVER_PROBLEM_NO_PROBLEM, { XMPP_PROBLEM_OLD_SSL, OK, OK, OK, OK } },
3135         { "moose", "something" },
3136         PORT_XMPP },
3137         { NULL, 0, "weasel-juice.org", REACHABLE, NULL },
3138         { PLAINTEXT_OK,
3139           { "moose@thud.org", "something", PLAIN, TLS },
3140           { "weasel-juice.org", PORT_XMPP, XMPP_V1, OLD_SSL, CERT_CHECK_LENIENT } } },
3141 
3142     { "/connector/cert-nonverification/ssl/nohost/ok/name-mismatch",
3143       QUIET,
3144       { S_NO_ERROR, },
3145       { { TLS, NULL },
3146         { SERVER_PROBLEM_NO_PROBLEM, { XMPP_PROBLEM_OLD_SSL, OK, OK, OK, OK } },
3147         { "moose", "something" },
3148         PORT_XMPP },
3149         { "tomato-juice.org", PORT_XMPP, "thud.org", REACHABLE, UNREACHABLE },
3150         { PLAINTEXT_OK,
3151           { "moose@tomato-juice.org", "something", PLAIN, TLS },
3152           { NULL, 0, XMPP_V1, OLD_SSL, CERT_CHECK_LENIENT } } },
3153 
3154     { "/connector/cert-nonverification/ssl/host/ok/name-mismatch",
3155       QUIET,
3156       { S_NO_ERROR, },
3157       { { TLS, NULL },
3158         { SERVER_PROBLEM_NO_PROBLEM, { XMPP_PROBLEM_OLD_SSL, OK, OK, OK, OK } },
3159         { "moose", "something" },
3160         PORT_XMPP },
3161         { NULL, 0, "tomato-juice.org", REACHABLE, NULL },
3162         { PLAINTEXT_OK,
3163           { "moose@tomato-juice.org", "something", PLAIN, TLS },
3164           { "tomato-juice.org", 0, XMPP_V1, OLD_SSL, CERT_CHECK_LENIENT } } },
3165 
3166     { "/connector/cert-nonverification/ssl/expired/ok",
3167       QUIET,
3168       { S_NO_ERROR, },
3169       { { TLS, NULL },
3170         { SERVER_PROBLEM_NO_PROBLEM, { XMPP_PROBLEM_OLD_SSL, OK, OK, OK, OK } },
3171         { "moose", "something" },
3172         PORT_XMPP, CERT_EXPIRED },
3173         { "weasel-juice.org", PORT_XMPP, "thud.org", REACHABLE, UNREACHABLE },
3174         { PLAINTEXT_OK,
3175           { "moose@weasel-juice.org", "something", PLAIN, TLS },
3176           { NULL, 0, XMPP_V1, OLD_SSL, CERT_CHECK_LENIENT } } },
3177 
3178     { "/connector/cert-nonverification/ssl/inactive/ok",
3179       QUIET,
3180       { S_NO_ERROR, },
3181       { { TLS, NULL },
3182         { SERVER_PROBLEM_NO_PROBLEM, { XMPP_PROBLEM_OLD_SSL, OK, OK, OK, OK } },
3183         { "moose", "something" },
3184         PORT_XMPP, CERT_NOT_YET },
3185         { "weasel-juice.org", PORT_XMPP, "thud.org", REACHABLE, UNREACHABLE },
3186         { PLAINTEXT_OK,
3187           { "moose@weasel-juice.org", "something", PLAIN, TLS },
3188           { NULL, 0, XMPP_V1, OLD_SSL, CERT_CHECK_LENIENT } } },
3189 
3190     { "/connector/cert-nonverification/ssl/selfsigned/ok",
3191       QUIET,
3192       { S_NO_ERROR, },
3193       { { TLS, NULL },
3194         { SERVER_PROBLEM_NO_PROBLEM, { XMPP_PROBLEM_OLD_SSL, OK, OK, OK, OK } },
3195         { "moose", "something" },
3196         PORT_XMPP, CERT_SELFSIGN },
3197         { "weasel-juice.org", PORT_XMPP, "thud.org", REACHABLE, UNREACHABLE },
3198         { PLAINTEXT_OK,
3199           { "moose@weasel-juice.org", "something", PLAIN, TLS },
3200           { NULL, 0, XMPP_V1, OLD_SSL, CERT_CHECK_LENIENT } } },
3201 
3202     { "/connector/cert-nonverification/ssl/unknown/ok",
3203       QUIET,
3204       { S_NO_ERROR, },
3205       { { TLS, NULL },
3206         { SERVER_PROBLEM_NO_PROBLEM, { XMPP_PROBLEM_OLD_SSL, OK, OK, OK, OK } },
3207         { "moose", "something" },
3208         PORT_XMPP, CERT_UNKNOWN },
3209         { "weasel-juice.org", PORT_XMPP, "thud.org", REACHABLE, UNREACHABLE },
3210         { PLAINTEXT_OK,
3211           { "moose@weasel-juice.org", "something", PLAIN, TLS },
3212           { NULL, 0, XMPP_V1, OLD_SSL, CERT_CHECK_LENIENT } } },
3213 
3214     /* we are done, cap the list: */
3215     { NULL }
3216   };
3217 
3218 /* ************************************************************************* */
3219 #define STRING_OK(x) (((x) != NULL) && (*x != '\0'))
3220 
3221 static void
setup_dummy_dns_entries(const test_t * test)3222 setup_dummy_dns_entries (const test_t *test)
3223 {
3224   TestResolver *tr = TEST_RESOLVER (kludged);
3225   guint port = test->dns.port ? test->dns.port : PORT_XMPP;
3226   const char *domain = test->dns.srv;
3227   const char *host = test->dns.host;
3228   const char *addr = test->dns.addr;
3229   const char *s_ip = test->dns.srvhost;
3230 
3231   test_resolver_reset (tr);
3232 
3233   if (STRING_OK (domain) && STRING_OK (host))
3234     test_resolver_add_SRV (tr, "xmpp-client", "tcp", domain, host, port);
3235 
3236   if (STRING_OK (domain) && STRING_OK (s_ip))
3237     test_resolver_add_A (tr, domain, s_ip);
3238 
3239   if (STRING_OK (host) && STRING_OK (addr))
3240     test_resolver_add_A (tr, host, addr);
3241 
3242   test_resolver_add_A (tr, INVISIBLE_HOST, UNREACHABLE);
3243   test_resolver_add_A (tr, VISIBLE_HOST, REACHABLE);
3244 }
3245 
3246 /* ************************************************************************* */
3247 /* Dummy XMPP server */
3248 static void start_dummy_xmpp_server (ServerParameters *srv);
3249 
3250 static gboolean
client_connected(GIOChannel * channel,GIOCondition cond,gpointer data)3251 client_connected (GIOChannel *channel,
3252     GIOCondition cond,
3253     gpointer data)
3254 {
3255   ServerParameters *srv = data;
3256   struct sockaddr_in client;
3257   socklen_t clen = sizeof (client);
3258   int ssock = g_io_channel_unix_get_fd (channel);
3259   int csock = accept (ssock, (struct sockaddr *) &client, &clen);
3260   GSocket *gsock = g_socket_new_from_fd (csock, NULL);
3261   ConnectorProblem *cproblem = &srv->problem.conn;
3262 
3263   GSocketConnection *gconn;
3264 
3265   if (csock < 0)
3266     {
3267       perror ("accept() failed");
3268       g_warning ("accept() failed on socket that should have been ready.");
3269       return TRUE;
3270     }
3271 
3272   if (!srv->features.tls)
3273       cproblem->xmpp |= XMPP_PROBLEM_NO_TLS;
3274 
3275   gconn = g_object_new (G_TYPE_SOCKET_CONNECTION, "socket", gsock, NULL);
3276   g_object_unref (gsock);
3277 
3278   srv->server = test_connector_server_new (G_IO_STREAM (gconn),
3279       srv->features.auth_mech,
3280       srv->auth.user,
3281       srv->auth.pass,
3282       srv->features.version,
3283       cproblem,
3284       srv->problem.sasl,
3285       srv->cert);
3286   g_object_unref (gconn);
3287 
3288   /* Recursively start extra servers */
3289   if (srv->extra_server != NULL)
3290     {
3291       test_connector_server_set_other_host (srv->server, REACHABLE,
3292           srv->extra_server->port);
3293       start_dummy_xmpp_server (srv->extra_server);
3294     }
3295 
3296   test_connector_server_start (srv->server);
3297 
3298   srv->watch = 0;
3299   return FALSE;
3300 }
3301 
3302 static void
start_dummy_xmpp_server(ServerParameters * srv)3303 start_dummy_xmpp_server (ServerParameters *srv)
3304 {
3305   int ssock;
3306   int reuse = 1;
3307   struct sockaddr_in server;
3308   int res = -1;
3309   guint port = srv->port;
3310 
3311   if (port == 0)
3312     return;
3313 
3314   memset (&server, 0, sizeof (server));
3315 
3316   server.sin_family = AF_INET;
3317 
3318   /* mingw doesn't support aton or pton so using more portable inet_addr */
3319   server.sin_addr.s_addr = inet_addr ((const char * ) REACHABLE);
3320   server.sin_port = htons (port);
3321   ssock = socket (AF_INET, SOCK_STREAM, IPPROTO_TCP);
3322   setsockopt (ssock, SOL_SOCKET, SO_REUSEADDR, (const char *) &reuse, sizeof (reuse));
3323 #ifdef G_OS_UNIX
3324   setsockopt (ssock, IPPROTO_TCP, TCP_NODELAY, (const char *) &reuse, sizeof (reuse));
3325 #endif
3326 
3327   res = bind (ssock, (struct sockaddr *) &server, sizeof (server));
3328 
3329   if (res != 0)
3330     {
3331       int code = errno;
3332       char *err = g_strdup_printf ("bind to " REACHABLE ":%d failed", port);
3333       perror (err);
3334       g_free (err);
3335       exit (code);
3336     }
3337 
3338   res = listen (ssock, 1024);
3339   if (res != 0)
3340     {
3341       int code = errno;
3342       char *err = g_strdup_printf ("listen on " REACHABLE ":%d failed", port);
3343       perror (err);
3344       g_free (err);
3345       exit (code);
3346     }
3347 
3348   srv->channel = g_io_channel_unix_new (ssock);
3349   g_io_channel_set_flags (srv->channel, G_IO_FLAG_NONBLOCK, NULL);
3350   srv->watch = g_io_add_watch (srv->channel, G_IO_IN|G_IO_PRI,
3351     client_connected, srv);
3352   g_io_channel_set_close_on_unref (srv->channel, TRUE);
3353   return;
3354 }
3355 /* ************************************************************************* */
3356 static void
test_server_teardown_cb(GObject * source,GAsyncResult * result,gpointer user_data)3357 test_server_teardown_cb (GObject *source,
3358   GAsyncResult *result,
3359   gpointer user_data)
3360 {
3361   GMainLoop *loop = user_data;
3362 
3363   g_assert (test_connector_server_teardown_finish (
3364     TEST_CONNECTOR_SERVER (source), result, NULL));
3365 
3366   g_main_loop_quit (loop);
3367 }
3368 
3369 static gboolean
test_server_idle_quit_loop_cb(GMainLoop * loop)3370 test_server_idle_quit_loop_cb (GMainLoop *loop)
3371 {
3372     g_main_loop_quit (loop);
3373     return G_SOURCE_REMOVE;
3374 }
3375 
3376 static void
test_server_teardown(test_t * test,ServerParameters * srv)3377 test_server_teardown (test_t *test,
3378     ServerParameters *srv)
3379 {
3380   /* Recursively teardown extra servers */
3381   if (srv->extra_server != NULL)
3382     test_server_teardown (test, srv->extra_server);
3383   srv->extra_server = NULL;
3384 
3385   if (srv->server != NULL)
3386     {
3387       GMainLoop *loop = g_main_loop_new (NULL, FALSE);
3388 
3389       if (test->result.used_mech == NULL)
3390         {
3391           test->result.used_mech = g_strdup (
3392             test_connector_server_get_used_mech (srv->server));
3393         }
3394 
3395       /* let the server dispatch any pending events before
3396        * forcing it to tear down */
3397       g_idle_add ((GSourceFunc) test_server_idle_quit_loop_cb, loop);
3398       g_main_loop_run (loop);
3399 
3400       /* Run until server is down */
3401       test_connector_server_teardown (srv->server,
3402         test_server_teardown_cb, loop);
3403       g_main_loop_run (loop);
3404 
3405       g_clear_object (&srv->server);
3406     }
3407 
3408   if (srv->watch != 0)
3409     g_source_remove (srv->watch);
3410   srv->watch = 0;
3411 
3412   if (srv->channel != NULL)
3413     g_io_channel_unref (srv->channel);
3414   srv->channel = NULL;
3415 }
3416 
3417 static void
test_done(GObject * source,GAsyncResult * res,gpointer data)3418 test_done (GObject *source,
3419     GAsyncResult *res,
3420     gpointer data)
3421 {
3422   test_t *test = data;
3423   WockyConnector *wcon = WOCKY_CONNECTOR (source);
3424   WockyXmppConnection *conn = NULL;
3425 
3426   error = NULL;
3427 
3428   switch (test->client.op)
3429     {
3430       case OP_CONNECT:
3431         conn = wocky_connector_connect_finish (wcon, res,
3432             &test->result.jid, &test->result.sid, &error);
3433         test->ok = (conn != NULL);
3434         break;
3435       case OP_REGISTER:
3436         conn = wocky_connector_register_finish (wcon, res,
3437             &test->result.jid, &test->result.sid, &error);
3438         test->ok = (conn != NULL);
3439         break;
3440       case OP_CANCEL:
3441         test->ok = wocky_connector_unregister_finish (wcon, res, &error);
3442         break;
3443     }
3444 
3445   if (conn != NULL)
3446     test->result.xmpp = g_object_ref (conn);
3447 
3448   test_server_teardown (test, &test->server_parameters);
3449 
3450   g_main_loop_quit (mainloop);
3451 }
3452 
3453 typedef void (*test_func) (gconstpointer);
3454 
3455 #ifdef G_OS_UNIX
3456 static void
connection_established_cb(WockyConnector * connector,GSocketConnection * conn,gpointer user_data)3457 connection_established_cb (WockyConnector *connector,
3458     GSocketConnection *conn,
3459     gpointer user_data)
3460 {
3461   GSocket *sock = g_socket_connection_get_socket (conn);
3462   gint fd, flag = 1;
3463 
3464   fd = g_socket_get_fd (sock);
3465   setsockopt (fd, IPPROTO_TCP, TCP_NODELAY,
3466       (const char *) &flag, sizeof (flag));
3467 }
3468 #endif
3469 
3470 static gboolean
start_test(gpointer data)3471 start_test (gpointer data)
3472 {
3473   test_t *test = data;
3474 
3475   if (test->client.setup != NULL)
3476     (test->client.setup) (test);
3477 
3478   switch (test->client.op)
3479     {
3480       case OP_CONNECT:
3481         wocky_connector_connect_async (test->connector, NULL,
3482             test_done, data);
3483         break;
3484       case OP_REGISTER:
3485         wocky_connector_register_async (test->connector, NULL,
3486             test_done, data);
3487         break;
3488       case OP_CANCEL:
3489         wocky_connector_unregister_async (test->connector, NULL,
3490             test_done, data);
3491         break;
3492     }
3493   return FALSE;
3494 }
3495 
3496 static void
run_test(gpointer data)3497 run_test (gpointer data)
3498 {
3499   WockyConnector *wcon = NULL;
3500   WockyTLSHandler *handler;
3501   test_t *test = data;
3502   struct stat dummy;
3503   gchar *base;
3504   char *path;
3505   const gchar *ca;
3506 
3507   /* clean up any leftover messes from previous tests     */
3508   /* unlink the sasl db tmpfile, it will cause a deadlock */
3509   base = g_get_current_dir ();
3510   path = g_strdup_printf ("%s/__db.%s", base, SASL_DB_NAME);
3511   g_free (base);
3512   g_assert ((g_stat (path, &dummy) != 0) || (g_unlink (path) == 0));
3513   g_free (path);
3514   /* end of cleanup block */
3515 
3516   start_dummy_xmpp_server (&test->server_parameters);
3517   setup_dummy_dns_entries (test);
3518 
3519   ca = test->client.options.ca ? test->client.options.ca : TLS_CA_CRT_FILE;
3520 
3521   /* insecure tls cert/etc not yet implemented */
3522   handler = wocky_tls_handler_new (test->client.options.lax_ssl);
3523 
3524   wcon = g_object_new ( WOCKY_TYPE_CONNECTOR,
3525       "jid"                     , test->client.auth.jid,
3526       "password"                , test->client.auth.pass,
3527       "xmpp-server"             , test->client.options.host,
3528       "xmpp-port"               , test->client.options.port,
3529       "tls-required"            , test->client.require_tls,
3530       "encrypted-plain-auth-ok" , !test->client.auth.secure,
3531       /* this refers to PLAINTEXT vs CRYPT, not PLAIN vs DIGEST */
3532       "plaintext-auth-allowed"  , !test->client.auth.tls,
3533       "legacy"                  , test->client.options.jabber,
3534       "old-ssl"                 , test->client.options.ssl,
3535       "tls-handler"             , handler,
3536       NULL);
3537 
3538   /* Make sure we only use the test CAs, not system-wide ones. */
3539   wocky_tls_handler_forget_cas (handler);
3540   g_assert (wocky_tls_handler_get_cas (handler) == NULL);
3541 
3542   /* check if the cert paths are valid */
3543   g_assert (g_file_test (TLS_CA_CRT_FILE, G_FILE_TEST_EXISTS));
3544 
3545   wocky_tls_handler_add_ca (handler, ca);
3546 
3547   /* not having a CRL can expose a bug in the openssl error handling
3548    * (basically we get 'CRL not fetched' instead of 'Expired'):
3549    * The bug has been fixed, but we can keep checking for it by
3550    * dropping the CRLs when the test is for an expired cert */
3551   if (test->server_parameters.cert != CERT_EXPIRED)
3552     wocky_tls_handler_add_crl (handler, TLS_CRL_DIR);
3553 
3554   g_object_unref (handler);
3555 
3556   test->connector = wcon;
3557   g_idle_add (start_test, test);
3558 
3559 #ifdef G_OS_UNIX
3560   /* set TCP_NODELAY as soon as possible */
3561   g_signal_connect (test->connector, "connection-established",
3562       G_CALLBACK (connection_established_cb), NULL);
3563 #endif
3564 
3565   g_main_loop_run (mainloop);
3566 
3567   if (test->result.domain == S_NO_ERROR)
3568     {
3569       if (error != NULL)
3570         fprintf (stderr, "Error: %s.%d: %s\n",
3571             g_quark_to_string (error->domain),
3572             error->code,
3573             error->message);
3574       g_assert_no_error (error);
3575 
3576       if (test->client.op == OP_CANCEL)
3577         {
3578           g_assert (test->ok == TRUE);
3579           g_assert (test->result.xmpp == NULL);
3580         }
3581       else
3582         {
3583           g_assert (test->result.xmpp != NULL);
3584 
3585           /* make sure we selected the right auth mechanism */
3586           if (test->result.mech != NULL)
3587             {
3588               g_assert_cmpstr (test->result.mech, ==,
3589                   test->result.used_mech);
3590             }
3591 
3592           /* we got a JID back, I hope */
3593           g_assert (test->result.jid != NULL);
3594           g_assert (*test->result.jid != '\0');
3595           g_free (test->result.jid);
3596 
3597           /* we got a SID back, I hope */
3598           g_assert (test->result.sid != NULL);
3599           g_assert (*test->result.sid != '\0');
3600           g_free (test->result.sid);
3601         }
3602 
3603       /* property get/set functionality */
3604       if (!strcmp (test->desc, CONNECTOR_INTERNALS_TEST))
3605         {
3606           int i;
3607           gchar *identity, *session_id, *resource;
3608           WockyConnector *tmp =
3609             wocky_connector_new ("foo@bar.org", "abc", "xyz", NULL, NULL);
3610           WockyStanza *feat = NULL;
3611           gboolean jabber;
3612           gboolean oldssl;
3613           XmppProblem xproblem = test->server_parameters.problem.conn.xmpp;
3614           const gchar *prop = NULL;
3615           const gchar *str_prop[] = { "jid", "password",
3616                                       "xmpp-server", "email", NULL };
3617           const gchar *str_vals[] = { "abc", "PASSWORD",
3618                                       "xmpp.server", "e@org", NULL };
3619           const gchar *boolprop[] = { "plaintext-auth-allowed",
3620                                       "encrypted-plain-auth-ok",
3621                                       "tls-required",
3622                                       NULL };
3623 
3624           g_object_get (wcon, "identity", &identity, "features", &feat, NULL);
3625           g_assert (identity != NULL);
3626           g_assert (*identity != '\0');
3627           g_assert (feat != NULL);
3628           g_assert (G_OBJECT_TYPE (feat) == WOCKY_TYPE_STANZA);
3629           g_free (identity);
3630           g_object_unref (feat);
3631           identity = NULL;
3632 
3633           g_object_get (wcon, "session-id", &session_id, NULL);
3634           g_assert (session_id != NULL);
3635           g_assert (*session_id != '\0');
3636           g_free (session_id);
3637 
3638           g_object_get (wcon, "resource", &resource, NULL);
3639           /* TODO: really? :resource gets updated to contain the actual
3640            * post-bind resource, but perhaps :resource should be updated too?
3641            */
3642           g_assert_cmpstr (resource, ==, NULL);
3643           g_free (resource);
3644 
3645           g_object_get (wcon, "legacy", &jabber, "old-ssl", &oldssl, NULL);
3646           g_assert (jabber == (gboolean)(xproblem & XMPP_PROBLEM_OLD_SERVER));
3647           g_assert (oldssl == (gboolean)(xproblem & XMPP_PROBLEM_OLD_SSL));
3648 
3649           for (i = 0, prop = str_prop[0]; prop; prop = str_prop[++i])
3650             {
3651               gchar *val = NULL;
3652               g_object_set (tmp, prop, str_vals[i], NULL);
3653               g_object_get (tmp, prop, &val, NULL);
3654               g_assert (!strcmp (val, str_vals[i]));
3655               g_assert (val != str_vals[i]);
3656               g_free (val);
3657             }
3658 
3659           for (i = 0, prop = boolprop[0]; prop; prop = boolprop[++i])
3660             {
3661               gboolean val;
3662               g_object_set (tmp, prop, TRUE, NULL);
3663               g_object_get (tmp, prop, &val, NULL);
3664               g_assert (val);
3665               g_object_set (tmp, prop, FALSE, NULL);
3666               g_object_get (tmp, prop, &val, NULL);
3667               g_assert (!val);
3668             }
3669 
3670           g_object_set (tmp, "xmpp-port", 31415, NULL);
3671           g_object_get (tmp, "xmpp-port", &i, NULL);
3672           g_assert (i == 31415);
3673 
3674           g_object_unref (tmp);
3675         }
3676     }
3677   else
3678     {
3679       g_assert (test->result.xmpp == NULL);
3680 
3681       if (test->result.domain != S_ANY_ERROR)
3682         {
3683           /* We want the error to match either of result.code or
3684            * result.fallback_code, but don't care which.
3685            * The expected error domain is the same for either code.
3686            */
3687           if (error->code == test->result.fallback_code)
3688             g_assert_error (error, map_static_domain (test->result.domain),
3689               test->result.fallback_code);
3690           else
3691             g_assert_error (error, map_static_domain (test->result.domain),
3692               test->result.code);
3693         }
3694     }
3695 
3696   if (wcon != NULL)
3697     g_object_unref (wcon);
3698 
3699   if (error != NULL)
3700     g_error_free (error);
3701 
3702   if (test->result.xmpp != NULL)
3703     g_object_unref (test->result.xmpp);
3704 
3705   g_free (test->result.used_mech);
3706   error = NULL;
3707 }
3708 
3709 int
main(int argc,char ** argv)3710 main (int argc,
3711     char **argv)
3712 {
3713   int i;
3714   gchar *base;
3715   gchar *path = NULL;
3716   struct stat dummy;
3717   int result;
3718 
3719   test_init (argc, argv);
3720 
3721   /* hook up the fake DNS resolver that lets us divert A and SRV queries *
3722    * into our local cache before asking the real DNS                     */
3723   original = g_resolver_get_default ();
3724   kludged = g_object_new (TEST_TYPE_RESOLVER, "real-resolver", original, NULL);
3725   g_resolver_set_default (kludged);
3726 
3727   /* unlink the sasl db, we want to test against a fresh one */
3728   base = g_get_current_dir ();
3729   path = g_strdup_printf ("%s/%s", base, SASL_DB_NAME);
3730   g_free (base);
3731   g_assert ((g_stat (path, &dummy) != 0) || (g_unlink (path) == 0));
3732   g_free (path);
3733 
3734   mainloop = g_main_loop_new (NULL, FALSE);
3735 
3736 #ifdef HAVE_LIBSASL2
3737 
3738   for (i = 0; tests[i].desc != NULL; i++)
3739     g_test_add_data_func (tests[i].desc, &tests[i], (test_func)run_test);
3740 
3741 #else
3742 
3743   g_message ("libsasl2 not found: skipping MD5 SASL tests");
3744   for (i = 0; tests[i].desc != NULL; i++)
3745     {
3746       if (!wocky_strdiff (tests[i].result.mech, "DIGEST-MD5"))
3747         continue;
3748       g_test_add_data_func (tests[i].desc, &tests[i], (test_func)run_test);
3749     }
3750 
3751 #endif
3752 
3753   result = g_test_run ();
3754   test_deinit ();
3755   return result;
3756 }
3757