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().
kgaillot
left a comment
There was a problem hiding this comment.
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
| char name[NAME_MAX]; | ||
| int32_t needs_sock_for_poll; | ||
| gid_t egid; | ||
| uid_t euid; |
There was a problem hiding this comment.
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.
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().