Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix global option inheritance in unix socket sources #896

Merged
merged 2 commits into from Feb 3, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 11 additions & 3 deletions modules/afsocket/afunix-source.c
Expand Up @@ -90,6 +90,15 @@ static gboolean
afunix_sd_init(LogPipe *s)
{
AFUnixSourceDriver *self = (AFUnixSourceDriver *) s;
GlobalConfig *cfg = log_pipe_get_config(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 @@ -121,9 +130,8 @@ 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;
self->create_dirs = cfg->create_dirs;
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);
return self;
Expand Down
4 changes: 2 additions & 2 deletions modules/afsocket/afunix-source.h
Expand Up @@ -33,8 +33,8 @@ typedef struct _AFUnixSourceDriver
AFSocketSourceDriver super;
gchar *filename;
FilePermOptions file_perm_options;
gboolean pass_unix_credentials;
gboolean create_dirs;
gint pass_unix_credentials;
gint create_dirs;
} AFUnixSourceDriver;

AFUnixSourceDriver *afunix_sd_new_stream(gchar *filename, GlobalConfig *cfg);
Expand Down