From 58b7e9474a197233b58c2a400eda375d6308e5a4 Mon Sep 17 00:00:00 2001 From: Tobias Mueller Date: Fri, 3 May 2013 19:29:38 +0200 Subject: dump-certificates: Manually provide server to connect to For some reason some Google enabled domains have their DNS not set up correctly. But also working domains like vrfy.org do not work will with this tool. In order to make it connect to a XMPP server, the servername and the port can now be given as parameters. https://bugs.freedesktop.org/show_bug.cgi?id=64190 --- examples/dump-certificates.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/examples/dump-certificates.c b/examples/dump-certificates.c index eb22fd7..41584a8 100644 --- a/examples/dump-certificates.c +++ b/examples/dump-certificates.c @@ -147,16 +147,26 @@ main (int argc, WockyConnector *connector; WockyTLSHandler *handler; + gchar* server = NULL; + guint port = 5222; + g_type_init (); wocky_init (); - if (argc != 2) + if (!(argc == 2 || argc == 4)) { - g_printerr ("Usage: %s \n", argv[0]); + g_printerr ("Usage: %s [ ]\n", argv[0]); return -1; } jid = argv[1]; + + if (argc == 4) + { + server = argv[2]; + port = atoi(argv[3]); + } + /* This example doesn't use your real password because it does not actually * validate certificates: it just dumps them then declares them valid. */ @@ -165,6 +175,8 @@ main (int argc, mainloop = g_main_loop_new (NULL, FALSE); handler = g_object_new (dump_tls_handler_get_type (), NULL); connector = wocky_connector_new (jid, password, NULL, NULL, handler); + if (argc == 4) + g_object_set (G_OBJECT (connector), "xmpp-server", server, "xmpp-port", port, NULL); wocky_connector_connect_async (connector, NULL, connected_cb, NULL); g_main_loop_run (mainloop); -- cgit v1.2.3