~ubuntu-branches/ubuntu/trusty/syslog-ng/trusty-proposed

« back to all changes in this revision

Viewing changes to lib/gsockaddr.c

  • Committer: Package Import Robot
  • Author(s): Laszlo Boszormenyi (GCS), Gergely Nagy
  • Date: 2011-10-11 14:30:48 UTC
  • mfrom: (1.3.7)
  • Revision ID: package-import@ubuntu.com-20111011143048-r1iljux9xbvj3lwh
Tags: 3.3.1.dfsg-1
* New upstream release with important fixes from upstream git tree with
  non-free manpages removed.
* Drop syslog-ng.conf(5) (closes: #496521).
* syslog-ng(8) is generated, and does not mention -Q anymore
  (closes: #616069).
* Supports CAP_SYSLOG on recent kernels (closes: #630172).
* Does not use g_timeout_add_seconds anymore (closes: #609154).

[ Gergely Nagy <algernon@madhouse-project.org> ]
* Update debian/copyright to DEP-5 format.
* Simplified the logrotate file by merging identical entries.
* Include local configuration files from /etc/syslog-ng/conf.d/ (Closes:
  #609050).
* Update syslog-ng.conf to be fully 3.3 compliant.
* Compress both source and binaries (except the syslog-ng meta
  package) with xz, instead of gzip.
* Use dpkg triggers to restart syslog-ng when appropriate.
* Include DFSG-free manual pages for all binaries.
* Build with Hardening enabled.
* Mention syslog(3) in /etc/default/syslog-ng, instead of
  <linux/kernel.h> (Closes: #608605)
* Support 'status' in the init script.
  Patch from Peter Eisentraut <petere@debian.org> (Closes: #644458)
* Build-Depend on libevtlog-dev (>= 0.2.12-5~) for correct shlibs.
* Use [linux-any] in Build-Depends instead of hardcoded links.
  (Closes: #634715)
* Use $SYSLOGNG_OPTS in the init script when reloading syslog-ng.
  (Closes: #589081)

Show diffs side-by-side

added added

removed removed

Lines of Context:
41
41
 
42
42
/* general GSockAddr functions */
43
43
 
 
44
gsize g_sockaddr_len(GSockAddr *a);
44
45
 
45
46
/**
46
47
 * g_sockaddr_new:
122
123
  return a;
123
124
}
124
125
 
 
126
gsize g_sockaddr_len(GSockAddr *);
125
127
/*+
126
128
 
127
129
  Decrement the reference count of a GSockAddr instance, and free if
143
145
      if (g_atomic_counter_dec_and_test(&a->refcnt))
144
146
        {
145
147
          if (!a->sa_funcs->freefn)
146
 
            g_free(a);
 
148
            g_slice_free1(g_sockaddr_len(a), a);
147
149
          else
148
150
            a->sa_funcs->freefn(a);
149
151
        }
198
200
void
199
201
g_sockaddr_inet_free(GSockAddr *addr)
200
202
{
201
 
  g_free(addr);
 
203
  g_slice_free1(g_sockaddr_len(addr), addr);
202
204
}
203
205
 
204
206
static GSockAddrFuncs inet_sockaddr_funcs = 
235
237
 
236
238
  if (inet_aton(ip, &ina))
237
239
    {
238
 
      addr = g_new0(GSockAddrInet, 1);
 
240
      addr = g_slice_new0(GSockAddrInet);
239
241
  
240
242
      g_atomic_counter_set(&addr->refcnt, 1);
241
243
      addr->flags = 0;
263
265
GSockAddr *
264
266
g_sockaddr_inet_new2(struct sockaddr_in *sin)
265
267
{
266
 
  GSockAddrInet *addr = g_new0(GSockAddrInet, 1);
 
268
  GSockAddrInet *addr = g_slice_new0(GSockAddrInet);
267
269
  
268
270
  g_atomic_counter_set(&addr->refcnt, 1);
269
271
  addr->flags = 0;
342
344
GSockAddr *
343
345
g_sockaddr_inet_range_new(gchar *ip, guint16 min_port, guint16 max_port)
344
346
{
345
 
  GSockAddrInetRange *addr = g_new0(GSockAddrInetRange, 1);
 
347
  GSockAddrInetRange *addr = g_slice_new0(GSockAddrInetRange);
346
348
  
347
349
  g_atomic_counter_set(&addr->refcnt, 1);
348
350
  addr->flags = 0;
405
407
static void
406
408
g_sockaddr_inet6_free(GSockAddr *addr)
407
409
{
408
 
  g_free(addr);
 
410
  g_slice_free1(g_sockaddr_len(addr), addr);
409
411
}
410
412
 
411
413
static GSockAddrFuncs inet6_sockaddr_funcs = 
438
440
GSockAddr *
439
441
g_sockaddr_inet6_new(gchar *ip, guint16 port)
440
442
{
441
 
  GSockAddrInet6 *addr = g_new0(GSockAddrInet6, 1);
 
443
  GSockAddrInet6 *addr = g_slice_new0(GSockAddrInet6);
442
444
  
443
445
  g_atomic_counter_set(&addr->refcnt, 1);
444
446
  addr->flags = 0;
467
469
GSockAddr *
468
470
g_sockaddr_inet6_new2(struct sockaddr_in6 *sin6)
469
471
{
470
 
  GSockAddrInet6 *addr = g_new0(GSockAddrInet6, 1);
 
472
  GSockAddrInet6 *addr = g_slice_new0(GSockAddrInet6);
471
473
  
472
474
  g_atomic_counter_set(&addr->refcnt, 1);
473
475
  addr->flags = 0;
524
526
GSockAddr *
525
527
g_sockaddr_unix_new(const gchar *name)
526
528
{
527
 
  GSockAddrUnix *addr = g_new0(GSockAddrUnix, 1);
 
529
  GSockAddrUnix *addr = g_slice_new0(GSockAddrUnix);
528
530
  
529
531
  g_atomic_counter_set(&addr->refcnt, 1);
530
532
  addr->flags = 0;
560
562
GSockAddr *
561
563
g_sockaddr_unix_new2(struct sockaddr_un *saun, int sunlen)
562
564
{
563
 
  GSockAddrUnix *addr = g_new0(GSockAddrUnix, 1);
 
565
  GSockAddrUnix *addr = g_slice_new0(GSockAddrUnix);
564
566
  
565
567
  g_atomic_counter_set(&addr->refcnt, 1);
566
568
  addr->flags = 0;
628
630
  return text;
629
631
}
630
632
 
 
633
gsize
 
634
g_sockaddr_len(GSockAddr *a)
 
635
{
 
636
  gsize len;
 
637
 
 
638
  if (a->sa_funcs == &inet_sockaddr_funcs)
 
639
    len = sizeof(GSockAddrInet);
 
640
#if ENABLE_IPV6
 
641
  else if (a->sa_funcs == &inet6_sockaddr_funcs)
 
642
    len = sizeof(GSockAddrInet6);
 
643
#endif
 
644
  else if (a->sa_funcs == &inet_range_sockaddr_funcs)
 
645
    len = sizeof(GSockAddrInetRange);
 
646
  else if (a->sa_funcs == &unix_sockaddr_funcs)
 
647
    len = sizeof(GSockAddrUnix);
 
648
  else
 
649
    g_assert_not_reached();
 
650
 
 
651
  return len;
 
652
}
 
653