chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
1f07740
)
sd-bus: port one use of SO_PEERCRED by getpeercred()
author
Lennart Poettering
<lennart@poettering.net>
Sat, 30 Dec 2017 14:20:38 +0000
(15:20 +0100)
committer
Sven Eden
<yamakuzure@gmx.net>
Wed, 30 May 2018 05:49:53 +0000
(07:49 +0200)
src/shared/bus-util.c
patch
|
blob
|
history
diff --git
a/src/shared/bus-util.c
b/src/shared/bus-util.c
index a4e0ec1053490b7330d275d0b66a3aaf998f5d7e..eb953b9bb34eb272e8fae12270622a6f83e6b1d0 100644
(file)
--- a/
src/shared/bus-util.c
+++ b/
src/shared/bus-util.c
@@
-563,8
+563,7
@@
void bus_verify_polkit_async_registry_free(Hashmap *registry) {
#if 0 /// UNNEEDED by elogind
int bus_check_peercred(sd_bus *c) {
struct ucred ucred;
- socklen_t l;
- int fd;
+ int fd, r;
assert(c);
@@
-572,12
+571,9
@@
int bus_check_peercred(sd_bus *c) {
if (fd < 0)
return fd;
- l = sizeof(struct ucred);
- if (getsockopt(fd, SOL_SOCKET, SO_PEERCRED, &ucred, &l) < 0)
- return -errno;
-
- if (l != sizeof(struct ucred))
- return -E2BIG;
+ r = getpeercred(fd, &ucred);
+ if (r < 0)
+ return r;
if (ucred.uid != 0 && ucred.uid != geteuid())
return -EPERM;