Skip to content

ipc: add qb_ipcc_auth_get() API call#418

Merged
chrissie-c merged 2 commits intoClusterLabs:masterfrom
chrissie-c:ipcc_getauth
Sep 28, 2020
Merged

ipc: add qb_ipcc_auth_get() API call#418
chrissie-c merged 2 commits intoClusterLabs:masterfrom
chrissie-c:ipcc_getauth

Conversation

@chrissie-c
Copy link
Copy Markdown
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
Copy Markdown

@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
char name[NAME_MAX];
int32_t needs_sock_for_poll;
gid_t egid;
uid_t euid;
Copy link
Copy Markdown

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
Copy Markdown

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
Copy Markdown
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
Copy Markdown

looks good to me

@chrissie-c chrissie-c merged commit 680db52 into ClusterLabs:master Sep 28, 2020
@chrissie-c
Copy link
Copy Markdown
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