-
Notifications
You must be signed in to change notification settings - Fork 98
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
Conversation
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().
There was a problem hiding this 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; |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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.
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. |
looks good to me |
Thanks for the review! |
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().