connection: improve the connection do not accept fd passing check
authorDjalal Harouni <tixxdz@opendz.org>
Tue, 28 Oct 2014 09:44:21 +0000 (10:44 +0100)
committerDjalal Harouni <tixxdz@opendz.org>
Tue, 28 Oct 2014 09:44:21 +0000 (10:44 +0100)
Signed-off-by: Djalal Harouni <tixxdz@opendz.org>
connection.c

index 898db9cbebae20c2b42458708ab7583876385e8c..cca14a49d4cc457239a89ee1fef0c65c16732f90 100644 (file)
@@ -470,8 +470,9 @@ static int kdbus_conn_entry_insert(struct kdbus_conn *conn,
                goto exit_unlock;
        }
 
-       if ((kmsg->fds && !(conn->flags & KDBUS_HELLO_ACCEPT_FD)) ||
-           (kmsg->memfds_count && !(conn->flags & KDBUS_HELLO_ACCEPT_FD))) {
+       /* The connection does not accept file descriptors */
+       if (!(conn->flags & KDBUS_HELLO_ACCEPT_FD) &&
+           (kmsg->fds_count > 0 || kmsg->memfds_count > 0)) {
                ret = -ECOMM;
                goto exit_unlock;
        }