Skip to content

Commit

Permalink
afsocket: fix pass-unix-credentials() global inheritance
Browse files Browse the repository at this point in the history
The global `pass-unix-credentials` option was not inherited in afunix-source
if the `options{};` block was positioned lower in the
configuration file than the given module declaration.

This commit fixes this issue by moving the "inheritance" assignment from
`afunix_sd_new_instance` to `afunix_sd_init`.

Signed-off-by: László Várady <laszlo.varady@balabit.com>
  • Loading branch information
MrAnno committed Feb 3, 2016
1 parent 7db32ea commit 420e9ce
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 6 additions & 2 deletions modules/afsocket/afunix-source.c
Expand Up @@ -95,6 +95,11 @@ afunix_sd_init(LogPipe *s)
if (self->create_dirs == -1)
self->create_dirs = cfg->create_dirs;

if (self->pass_unix_credentials == -1)
self->pass_unix_credentials = cfg->pass_unix_credentials;

afunix_sd_set_pass_unix_credentials(self, self->pass_unix_credentials);

return afsocket_sd_init_method(s) &&
afunix_sd_apply_perms_to_socket(self);
}
Expand Down Expand Up @@ -125,8 +130,7 @@ afunix_sd_new_instance(TransportMapper *transport_mapper, gchar *filename, Globa
self->filename = g_strdup(filename);
file_perm_options_defaults(&self->file_perm_options);
self->file_perm_options.file_perm = 0666;
self->pass_unix_credentials = cfg->pass_unix_credentials;
afunix_sd_set_pass_unix_credentials(self, self->pass_unix_credentials);
self->pass_unix_credentials = -1;
self->create_dirs = -1;

afunix_sd_adjust_reader_options(self, cfg);
Expand Down
2 changes: 1 addition & 1 deletion modules/afsocket/afunix-source.h
Expand Up @@ -33,7 +33,7 @@ typedef struct _AFUnixSourceDriver
AFSocketSourceDriver super;
gchar *filename;
FilePermOptions file_perm_options;
gboolean pass_unix_credentials;
gint pass_unix_credentials;
gint create_dirs;
} AFUnixSourceDriver;

Expand Down

0 comments on commit 420e9ce

Please sign in to comment.