Blame SOURCES/Fix-handling-of-selinux-context-when-NULL.patch
|
|
165848 |
From 255188b5e3cfc3be5aebd037389bcf7da686a622 Mon Sep 17 00:00:00 2001
|
|
|
165848 |
From: Simo Sorce <simo@redhat.com>
|
|
|
165848 |
Date: Tue, 7 Apr 2020 08:56:53 -0400
|
|
|
165848 |
Subject: [PATCH] Fix handling of selinux context when NULL
|
|
|
165848 |
|
|
|
165848 |
Fixes: #256
|
|
|
165848 |
Signed-off-by: Simo Sorce <simo@redhat.com>
|
|
|
165848 |
Merges: #257
|
|
|
165848 |
Reviewed-by: Robbie Harwood <rharwood@redhat.com>
|
|
|
165848 |
---
|
|
|
165848 |
src/gp_socket.c | 7 +++++--
|
|
|
165848 |
1 file changed, 5 insertions(+), 2 deletions(-)
|
|
|
165848 |
|
|
|
165848 |
diff --git a/src/gp_socket.c b/src/gp_socket.c
|
|
|
165848 |
index 7a19ee5..9070928 100644
|
|
|
165848 |
--- a/src/gp_socket.c
|
|
|
165848 |
+++ b/src/gp_socket.c
|
|
|
165848 |
@@ -122,7 +122,9 @@ void gp_conn_free(struct gp_conn *conn)
|
|
|
165848 |
close(conn->us.sd);
|
|
|
165848 |
}
|
|
|
165848 |
free(conn->program);
|
|
|
165848 |
- SELINUX_context_free(conn->selinux_ctx);
|
|
|
165848 |
+ if (conn->selinux_ctx) {
|
|
|
165848 |
+ SELINUX_context_free(conn->selinux_ctx);
|
|
|
165848 |
+ }
|
|
|
165848 |
free(conn);
|
|
|
165848 |
}
|
|
|
165848 |
|
|
|
165848 |
@@ -635,7 +637,8 @@ void accept_sock_conn(verto_ctx *vctx, verto_ev *ev)
|
|
|
165848 |
conn->creds.ucred.uid,
|
|
|
165848 |
conn->creds.ucred.gid);
|
|
|
165848 |
}
|
|
|
165848 |
- if (conn->creds.type & CRED_TYPE_SELINUX) {
|
|
|
165848 |
+ if ((conn->creds.type & CRED_TYPE_SELINUX) &&
|
|
|
165848 |
+ (conn->selinux_ctx != NULL)) {
|
|
|
165848 |
GPDEBUG(" (context = %s)",
|
|
|
165848 |
SELINUX_context_str(conn->selinux_ctx));
|
|
|
165848 |
}
|
|
|
165848 |
--
|
|
|
165848 |
2.35.3
|
|
|
165848 |
|