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

ipc: add qb_ipcc_auth_get() API call #418

Merged
merged 2 commits into from
Sep 28, 2020

Conversation

chrissie-c
Copy link
Contributor

We can't use SO_PEERCRED on the client fd when using socket IPC
becayse it's a DGRAM socket (pacemaker tries this). So provide
an API to get the server credentials that libqb has already
squirreled away for its own purposes.

Also, fix some unused-variable compiler warnings in unix.c
when building on systems withpout posix_fallocate().

We can't use SO_PEERCRED on the client fd when using socket IPC
becayse it's a DGRAM socket (pacemaker tries this). So provide
an API to get the server credentials that libqb has already
squirreled away for its own purposes.

Also, fix some unused-variable compiler warnings in unix.c
when building on systems withpout posix_fallocate().
@chrissie-c chrissie-c changed the title ipc: addd qb_ipcc_auth_get() API call ipc: add qb_ipcc_auth_get() API call Sep 24, 2020
Copy link
Contributor

@kgaillot kgaillot left a comment

Choose a reason for hiding this comment

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

Nice, I think any IPC users will eventually find this handy :)

covscan is complaining but that's probably because Fabio upgraded the covscan version rather than related issues. I can't wait to see what it finds in Pacemaker ;)

lib/ipc_int.h Outdated
@@ -92,6 +92,7 @@ struct qb_ipcc_connection {
char name[NAME_MAX];
int32_t needs_sock_for_poll;
gid_t egid;
uid_t euid;
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd add this to the end of the struct so you don't have to bump the shared library version. Uglier, but library bumps are a hassle

lib/ipcc.c Outdated
}
*pid = c->server_pid;
*uid = c->euid;
*gid = c->egid;
Copy link
Contributor

Choose a reason for hiding this comment

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

For flexibility, I wouldn't require these to be non-NULL but wrap the assignments in if != NULL. That way callers can get just one or two values if that's all they need.

@chrissie-c
Copy link
Contributor Author

Update commit in the CI now. It's still failing covscan but those are stupid errors in the test suite so I'm happy to ignore them (they'll go in the ignore list for next time once it commited).

I have the pacemaker patch to use this APi largely ready to go too.

@kgaillot
Copy link
Contributor

looks good to me

@chrissie-c chrissie-c merged commit 680db52 into ClusterLabs:master Sep 28, 2020
@chrissie-c
Copy link
Contributor Author

Thanks for the review!

@chrissie-c chrissie-c deleted the ipcc_getauth branch September 28, 2020 08:53
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.

2 participants