~ubuntu-branches/ubuntu/utopic/libinfinity/utopic-proposed

« back to all changes in this revision

Viewing changes to infinoted/infinoted-config-reload.c

  • Committer: Bazaar Package Importer
  • Author(s): Philipp Kern
  • Date: 2011-04-01 10:44:57 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20110401104457-q7927ly61fr51tqs
Tags: 0.5.0-1
* New upstream release.
* Drop patches applied upstream.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* libinfinity - a GObject-based infinote implementation
2
 
 * Copyright (C) 2007, 2008, 2009 Armin Burgmeier <armin@arbur.net>
 
2
 * Copyright (C) 2007-2011 Armin Burgmeier <armin@arbur.net>
3
3
 *
4
4
 * This library is free software; you can redistribute it and/or
5
5
 * modify it under the terms of the GNU Lesser General Public
19
19
 
20
20
#include <infinoted/infinoted-config-reload.h>
21
21
#include <infinoted/infinoted-dh-params.h>
 
22
#include <infinoted/infinoted-pam.h>
 
23
 
22
24
#include <libinfinity/server/infd-filesystem-storage.h>
23
25
#include <libinfinity/inf-config.h>
24
26
 
27
29
static const guint8 INFINOTED_CONFIG_RELOAD_IPV6_ANY_ADDR[16] =
28
30
  { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
29
31
 
 
32
static void
 
33
infinoted_config_reload_update_connection_sasl_context(InfXmlConnection* xml,
 
34
                                                       gpointer userdata)
 
35
{
 
36
  if(!INF_IS_XMPP_CONNECTION(xml))
 
37
    return;
 
38
 
 
39
  inf_xmpp_connection_reset_sasl_authentication(
 
40
    INF_XMPP_CONNECTION(xml),
 
41
    (InfSaslContext*) userdata,
 
42
    userdata ? "PLAIN" : NULL
 
43
  );
 
44
}
 
45
 
30
46
/**
31
47
 * infinoted_config_reload:
32
48
 * @run: A #InfinotedRun.
58
74
  startup = infinoted_startup_new(NULL, NULL, error);
59
75
  if(!startup) return FALSE;
60
76
 
61
 
  /* TODO: need to support creating a gsasl context when reloading the config
62
 
   * when none was created on first startup */
63
 
 
64
77
  /* Acquire DH params if necessary (if security policy changed from
65
78
   * no-tls to one of allow-tls or require-tls). */
66
79
  dh_params = run->dh_params;
229
242
      );
230
243
 
231
244
      g_object_unref(tcp6);
 
245
 
232
246
      infd_server_pool_add_server(run->pool, INFD_XML_SERVER(run->xmpp6));
233
247
 
234
248
#ifdef LIBINFINITY_HAVE_AVAHI
251
265
      );
252
266
 
253
267
      g_object_unref(tcp4);
 
268
 
254
269
      infd_server_pool_add_server(run->pool, INFD_XML_SERVER(run->xmpp4));
255
270
 
256
271
#ifdef LIBINFINITY_HAVE_AVAHI
324
339
  startup->options->daemonize = run->startup->options->daemonize;
325
340
#endif
326
341
 
 
342
  if(run->xmpp4 != NULL)
 
343
  {
 
344
    g_object_set(
 
345
      G_OBJECT(run->xmpp4),
 
346
      "sasl-context",    startup->sasl_context,
 
347
      "sasl-mechanisms", startup->sasl_context ? "PLAIN" : NULL,
 
348
      NULL
 
349
    );
 
350
  }
 
351
 
 
352
  if(run->xmpp6 != NULL)
 
353
  {
 
354
    g_object_set(
 
355
      G_OBJECT(run->xmpp6),
 
356
      "sasl-context",    startup->sasl_context,
 
357
      "sasl-mechanisms", startup->sasl_context ? "PLAIN" : NULL,
 
358
      NULL
 
359
    );
 
360
  }
 
361
 
 
362
  /* Give each connection the new sasl context. This is necessary even if the
 
363
   * connection already had a sasl context since that holds on to the old
 
364
   * startup object. This aborts authentications in progress and otherwise
 
365
   * has no effect, really. */
 
366
  infd_directory_foreach_connection(
 
367
    run->directory,
 
368
    infinoted_config_reload_update_connection_sasl_context,
 
369
    startup->sasl_context
 
370
   );
 
371
 
327
372
  infinoted_startup_free(run->startup);
328
373
  run->startup = startup;
329
374