From 99c7335b43821d7bf5731185973a7fa51a6d57b9 Mon Sep 17 00:00:00 2001
From: Simo Sorce <simo@redhat.com>
Date: Wed, 19 Jun 2013 12:18:31 -0400
Subject: [PATCH 1/2] Properly check socket for connection matching.

We always need to chekc if the socket matches otherwise the worng service may
be selected if a specific socket is being used but a service allowing the same
euid is confgured to use the deault socket as well.

Signed-off-by: Simo Sorce <simo@redhat.com>
---
 proxy/src/gp_creds.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/proxy/src/gp_creds.c b/proxy/src/gp_creds.c
index 25176656ab415574eda5b1f843ae937604d25e36..cd513089f309318b4357fc5b0c3f3a7e49b186f7 100644
--- a/proxy/src/gp_creds.c
+++ b/proxy/src/gp_creds.c
@@ -103,9 +103,14 @@ struct gp_service *gp_creds_match_conn(struct gssproxy_ctx *gpctx,
 
     for (i = 0; i < gpctx->config->num_svcs; i++) {
         if (gpctx->config->svcs[i]->euid == gcs->ucred.uid) {
-            if (gpctx->config->svcs[i]->socket &&
-                !gp_same(socket, gpctx->config->svcs[i]->socket)) {
-                continue;
+            if (gpctx->config->svcs[i]->socket) {
+                if (!gp_same(socket, gpctx->config->svcs[i]->socket)) {
+                    continue;
+                }
+            } else {
+                if (!gp_same(socket, gpctx->config->socket_name)) {
+                    continue;
+                }
             }
             return gpctx->config->svcs[i];
         }
-- 
1.8.1.4

