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

[version_1] Set correct ownership if qb_ipcs_connection_auth_set() has been used #382

Merged
merged 1 commit into from
Feb 12, 2020
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ ALL_LINT_FLAGS = $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(DEB_INCLUDES) \
# ipc_setup.c: (in function qb_ipcc_us_setup_connect)
# ipc_setup.c:479:2: Return value (type int32_t) ignored: qb_ipc_us_ready(...
# ipc_setup.c:494:2: Return value (type int32_t) ignored: qb_ipc_auth_cred...
SPLINT_SUMMARY_EXP = " 2 code warnings"
SPLINT_SUMMARY_EXP = " 3 code warnings"

run_splint.sh: $(top_srcdir)/configure.ac
@echo '$(SPLINT) $(ALL_LINT_FLAGS) \' > $@-t
Expand Down
10 changes: 10 additions & 0 deletions lib/ipc_shm.c
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,8 @@ qb_ipcs_shm_connect(struct qb_ipcs_service *s,
struct qb_ipc_connection_response *r)
{
int32_t res;
char dirname[PATH_MAX];
char *slash;

qb_util_log(LOG_DEBUG, "connecting to client [%d]", c->pid);

Expand All @@ -293,6 +295,14 @@ qb_ipcs_shm_connect(struct qb_ipcs_service *s,
snprintf(r->event, NAME_MAX, "%s-event-%s",
c->description, s->name);

/* Set correct ownership if qb_ipcs_connection_auth_set() has been used */
strlcpy(dirname, c->description, sizeof(dirname));
slash = strrchr(dirname, '/');
if (slash) {
*slash = '\0';
(void)chown(dirname, c->auth.uid, c->auth.gid);
}

res = qb_ipcs_shm_rb_open(c, &c->request,
r->request);
if (res != 0) {
Expand Down