pcp
[Top] [All Lists]

user/group access control question

To: <pcp@xxxxxxxxxxx>
Subject: user/group access control question
From: "Ken McDonell" <kenj@xxxxxxxxxxxxxxxx>
Date: Mon, 27 Oct 2014 14:30:44 +1100
Delivered-to: pcp@xxxxxxxxxxx
Thread-index: Ac/xlTlzXuD9W9FUTGezwUKon0oQ6w==
I think this one for Dave Brolley, but I'd welcome insight from any quarter.

I have a bunch of qa/944 failures, and they appear to be correlated with
hosts for which pmconfig -L reports ...

kenj@vm05:~/src/pcp/src/libpcp/src$ pmconfig -L
pcp_version=3.10.0
...
secure_sockets=false
...
authentication=false
unix_domain_sockets=true
...

qa/944 seems to be failing in the client connecting to pmcd which is
returning an error code of -95.  The problem seems to be in the logic around
DoCreds() where we never get to CheckAccountAccess() because the earlier
call to __pmSecureServerHandshake() fails, with, er, -95.

I am not sure how things are supposed to work in this config setup, but the
patch below makes qa/944 pass on at least one of these failing platforms.
Note this is for the "not secure sockets" variant of the implementation of
pmSecureServerHandshake() (there are two implementations in the code).

Could someone who knows please take a look and let me know if this is even
close to the "correct" way to fix this issue?

Cheers and thanks, Ken.

diff --git a/src/libpcp/src/auxserver.c b/src/libpcp/src/auxserver.c
index 498bac4..c18e6a5 100644
--- a/src/libpcp/src/auxserver.c
+++ b/src/libpcp/src/auxserver.c
@@ -867,7 +867,17 @@ __pmSecureServerHandshake(int fd, int flags,
__pmHashCtl *attrs)
     (void)fd;
     (void)flags;
     (void)attrs;
-    return -EOPNOTSUPP;
+
+    /* for things that require a secure server, return -EOPNOTSUPP */
+    if ((flags & (PDU_FLAG_SECURE | PDU_FLAG_SECURE_ACK | PDU_FLAG_COMPRESS
+                  | PDU_FLAG_AUTH)) != 0)
+       return -EOPNOTSUPP;
+
+    /* CREDS_REQD is a special case that does not need a secure server */
+    if ((flags & PDU_FLAG_CREDS_REQD) != 0)
+       return 0;
+    /* otherwise the flags are not expected */
+    return PM_ERR_IPC;
 }
 
 int

<Prev in Thread] Current Thread [Next in Thread>