summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDaniel Mack <daniel@zonque.org>2014-10-07 12:36:09 +0200
committerDaniel Mack <daniel@zonque.org>2014-10-07 12:36:09 +0200
commit55534fb5e4742b0db9ae5e1e0202c53804147697 (patch)
treecb38e7d7db73854d4efcb6c8009b4bcc3e6d8d26 /src
parent8bf13eb1e02b9977ae1cd331ae5dc7305a305a09 (diff)
bus-proxyd: check return values of getpeercred() and getpeersec()
If we can't get the remote peer or security creds, bail out. Spotted by coverity.
Diffstat (limited to 'src')
-rw-r--r--src/bus-proxyd/bus-proxyd.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/bus-proxyd/bus-proxyd.c b/src/bus-proxyd/bus-proxyd.c
index cbec04933c..ce571fa753 100644
--- a/src/bus-proxyd/bus-proxyd.c
+++ b/src/bus-proxyd/bus-proxyd.c
@@ -1146,8 +1146,17 @@ int main(int argc, char *argv[]) {
sd_is_socket(out_fd, AF_UNIX, 0, 0) > 0;
if (is_unix) {
- getpeercred(in_fd, &ucred);
- getpeersec(in_fd, &peersec);
+ r = getpeercred(in_fd, &ucred);
+ if (r < 0) {
+ log_error("Failed to get peer creds: %s", strerror(-r));
+ goto finish;
+ }
+
+ r = getpeersec(in_fd, &peersec);
+ if (r < 0) {
+ log_error("Failed to get security creds: %s", strerror(-r));
+ goto finish;
+ }
}
if (arg_drop_privileges) {