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

F/file perms extract from cfg #984

Merged
merged 6 commits into from
Mar 21, 2016
Merged

F/file perms extract from cfg #984

merged 6 commits into from
Mar 21, 2016

Conversation

bazsi
Copy link
Collaborator

@bazsi bazsi commented Mar 9, 2016

This series extracts a few members from GlobalConfig and uses the FilePermOptions structure instead.

Again a step in decoupling GlobalConfig dependency from various parts of syslog-ng.

Since testing is lacking in the area, I split up the series into really small baby steps that should be possible to validate by reviewing it.

Let's see what travis thinks about it :)

This patch is in preperation of using FilePermOptions to store file/dir
uid/gid/perm triplets, instead of duplicating most of the data struct
within GlobalConfig.

Signed-off-by: Balazs Scheidler <balazs.scheidler@balabit.com>
This patch is still a preparation, reworks the GlobalConfig methods
to work with data within FilePermOptions.

Signed-off-by: Balazs Scheidler <balazs.scheidler@balabit.com>
Instead of using the GlobalConfig specific functions, use the same
rules to parse the file uid/gid/perm triplet.

NOTE: that directory specific rules are not migrated yet, as those were
previously not supported by per-destination settings.

Signed-off-by: Balazs Scheidler <balazs.scheidler@balabit.com>
This patch gets rid off the GlobalConfig specific uid/gid/perm functions
in favour of FilePermOptions.

There were separate rules for file and directory specific uid/gid/perm
settings, but in reality we always used the broader one. So this patch
merges the two.

Signed-off-by: Balazs Scheidler <balazs.scheidler@balabit.com>
@bazsi
Copy link
Collaborator Author

bazsi commented Mar 13, 2016

Travis seems to have acked it, adding the needs-review label. I have some further work queued, which depends on this one, so a review would be appreciated.

@lbudai
Copy link
Collaborator

lbudai commented Mar 17, 2016

Hi,

DONTCHANGE(-2) and dont_touch(-1) are a little bit confusing as in the commit message when you initiate the DONTCHANGE macro, you call it as a "dont-touch" mode...
[ can't we use the DONTCHANGE instead of -1 in dont_touch ? ]

@bazsi
Copy link
Collaborator Author

bazsi commented Mar 17, 2016

Sure, we can, and its better that way.
On Mar 17, 2016 11:44 AM, "Budai Laszlo" notifications@github.com wrote:

Hi,

DONTCHANGE(-2) and dont_touch(-1) are a little bit confusing as in the
commit message when you initiate the DONTCHANGE macro, you call it as a
"dont-touch" mode...
[ can't we use the DONTCHANGE instead of -1 in dont_touch ? ]


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub
#984 (comment)

@@ -45,7 +45,8 @@ void file_perm_options_set_dir_gid(FilePermOptions *s, const gchar *dir_gid);
void file_perm_options_set_dir_perm(FilePermOptions *s, gint dir_perm);

void file_perm_options_defaults(FilePermOptions *self);
void file_perm_options_init(FilePermOptions *self, GlobalConfig *cfg);
void file_perm_options_global_defaults(FilePermOptions *self);
void file_perm_options_init(FilePermOptions *self, FilePermOptions *global_options);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would add a const here for the argument and at some other places as well.

@bkil-syslogng
Copy link
Contributor

If I want to nitpick, I'd generally keep the first line of each commit message at most 72 characters long, otherwise GitHub will break it intrusively. gitk still shows it nicely, but anyway I just wanted to let you know for consideration.

Most projects follow a 50/72 commit message rule, but they generally recommend hard breaking on 72 in any case, so I don't think that 72/72 is an unreasonable rule to follow.

@bkil-syslogng
Copy link
Contributor

Other than the message subject improvement and the recommendation that we should strive to use (struct) constness for new codes, I see no issue with this PR. 👍

@bazsi bazsi force-pushed the f/file-perms-extract-from-cfg branch from 4eb62ce to ac5e4aa Compare March 18, 2016 14:55
Previously the extremal value -2 was used to indicate that we don't want
global values to be inherited, and this extremal value was even
exposed to call sites.

Avoid that by definining specialization functions for this case.

Signed-off-by: Balazs Scheidler <balazs.scheidler@balabit.com>
afunix does not want the global {file,dir}_uid/gid/perm values to
be inherited, but still the *Options convention in syslog-ng dictates that
FilePermOptions should be initialized, otherwise we would be using
an uninitialized object.

This code adds two specialized init cases, one that inherits the global
options file_perm_options_inherit_from() and one that does the initialization
but explicitly doesn't inherit from global options.

afunix calls the latter, whereby all other call-sites use the former.

Signed-off-by: Balazs Scheidler <balazs.scheidler@balabit.com>
@bazsi bazsi force-pushed the f/file-perms-extract-from-cfg branch from ac5e4aa to b86ebd8 Compare March 18, 2016 15:00
@bazsi
Copy link
Collaborator Author

bazsi commented Mar 18, 2016

I think I have now addressed all review comments, clarified commit message, so this should be ready for merging, once travis acks that.

@lbudai
Copy link
Collaborator

lbudai commented Mar 21, 2016

Hi,

thanks!
Sorry for late reaction.

lbudai added a commit that referenced this pull request Mar 21, 2016
@lbudai lbudai merged commit bb1229b into master Mar 21, 2016
@bazsi bazsi deleted the f/file-perms-extract-from-cfg branch August 15, 2017 16:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants