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

« back to all changes in this revision

Viewing changes to lib/logprocess.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:
26
26
#include <string.h>
27
27
 
28
28
void
29
 
log_process_rule_init_instance(LogProcessRule *self, const gchar *name)
30
 
{
31
 
  memset(self, 0, sizeof(LogProcessRule));
 
29
log_process_pipe_free_method(LogPipe *s)
 
30
{
 
31
  log_pipe_free_method(s);
 
32
}
 
33
 
 
34
void
 
35
log_process_pipe_init_instance(LogProcessPipe *self)
 
36
{
 
37
  log_pipe_init_instance(&self->super);
 
38
  self->super.free_fn = log_process_pipe_free_method;
 
39
}
 
40
 
 
41
LogProcessRule *
 
42
log_process_rule_new(const gchar *name, GList *head)
 
43
{
 
44
  LogProcessRule *self = g_new0(LogProcessRule, 1);
 
45
 
32
46
  self->ref_cnt = 1;
 
47
  self->head = head;
33
48
  self->name = g_strdup(name);
34
49
 
 
50
  return self;
35
51
}
36
52
 
37
53
void
45
61
{
46
62
  if (--self->ref_cnt == 0)
47
63
    {
48
 
      if (self->free_fn)
49
 
        self->free_fn(self);
 
64
      g_list_foreach(self->head, (GFunc) log_pipe_unref, NULL);
 
65
      g_list_free(self->head);
50
66
      g_free(self->name);
51
67
      g_free(self);
52
68
    }
53
69
}
54
 
 
55
 
static gboolean
56
 
log_process_pipe_init(LogPipe *s)
57
 
{
58
 
  LogProcessPipe *self = (LogProcessPipe *) s;
59
 
 
60
 
  return log_process_rule_init(self->rule, self->super.cfg);
61
 
}
62
 
 
63
 
static gboolean 
64
 
log_process_pipe_deinit(LogPipe *s)
65
 
{
66
 
  LogProcessPipe *self = (LogProcessPipe *) s;
67
 
 
68
 
  log_process_rule_deinit(self->rule, self->super.cfg);
69
 
  return TRUE;
70
 
}
71
 
 
72
 
static void
73
 
log_process_pipe_queue(LogPipe *s, LogMessage *msg, const LogPathOptions *path_options)
74
 
{
75
 
  LogProcessPipe *self = (LogProcessPipe *) s;
76
 
  if (log_process_rule_process(self->rule, msg))
77
 
    {
78
 
      /* forward message */
79
 
      if (s->pipe_next)
80
 
        log_pipe_queue(s->pipe_next, msg, path_options);
81
 
      else
82
 
        log_msg_drop(msg, path_options);
83
 
    }
84
 
  else
85
 
    {
86
 
      if (path_options->matched)
87
 
        (*path_options->matched) = FALSE;
88
 
      log_msg_drop(msg, path_options);
89
 
    }
90
 
}
91
 
 
92
 
static void
93
 
log_process_pipe_free(LogPipe *s)
94
 
{
95
 
  LogProcessPipe *self = (LogProcessPipe *) s;
96
 
  
97
 
  log_process_rule_unref(self->rule);
98
 
  log_pipe_free_method(s);
99
 
}
100
 
 
101
 
LogPipe *
102
 
log_process_pipe_new(LogProcessRule *rule)
103
 
{
104
 
  LogProcessPipe *self = g_new0(LogProcessPipe, 1);
105
 
  
106
 
  log_pipe_init_instance(&self->super);
107
 
  log_process_rule_ref(rule);
108
 
  self->rule = rule;
109
 
  self->super.init = log_process_pipe_init;
110
 
  self->super.deinit = log_process_pipe_deinit;
111
 
  self->super.queue = log_process_pipe_queue;
112
 
  self->super.free_fn = log_process_pipe_free;
113
 
  return &self->super;
114
 
}
115