diff options
author | Denis Kozadaev <denis@dilos.org> | 2023-05-14 12:34:44 +0300 |
---|---|---|
committer | Michele Calgaro <michele.calgaro@yahoo.it> | 2023-05-22 10:41:26 +0900 |
commit | e5acdb1b39fa7d97d7153741202709e078b463a6 (patch) | |
tree | 8fdda91a64ae0c7f35474d44e29139f38f297958 /dcop | |
parent | 394b5ef0fb0e0555d16bced7c4c2c1b2ac1a8463 (diff) | |
download | tdelibs-e5acdb1b39fa7d97d7153741202709e078b463a6.tar.gz tdelibs-e5acdb1b39fa7d97d7153741202709e078b463a6.zip |
Add SunOS specific patches
Signed-off-by: Denis Kozadaev <denis@dilos.org>
Diffstat (limited to 'dcop')
-rw-r--r-- | dcop/dcopclient.cpp | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/dcop/dcopclient.cpp b/dcop/dcopclient.cpp index 5523365c8..52d9097c1 100644 --- a/dcop/dcopclient.cpp +++ b/dcop/dcopclient.cpp @@ -50,6 +50,9 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include <stdlib.h> #include <assert.h> #include <string.h> +#ifdef HAVE_UCRED_H +#include <ucred.h> +#endif /* HAVE_UCRED_H */ #include <tqguardedptr.h> #include <tqtextstream.h> @@ -724,7 +727,7 @@ bool DCOPClient::isSuspended() const return !d->notifier->isEnabled(); } -#if defined(SO_PEERCRED) || defined(LOCAL_PEEREID) +#if defined(SO_PEERCRED) || defined(LOCAL_PEEREID) || defined(HAVE_GETPEERUCRED) #define USE_PEER_IS_US // Check whether the remote end is owned by the same user. static bool peerIsUs(int sockfd) @@ -745,6 +748,18 @@ static bool peerIsUs(int sockfd) if (getsockopt(sockfd, 0, LOCAL_PEEREID, &cred, &siz) != 0 || siz != sizeof(cred)) return false; return (cred.unp_euid == geteuid()); +#elif defined(HAVE_GETPEERUCRED) + ucred_t *cred = nullptr; + uint_t peer_uid; + + if (getpeerucred(sockfd, &cred) != 0) { + if (cred != nullptr) + ucred_free(cred); + return false; + } + peer_uid = ucred_geteuid(cred); + ucred_free(cred); + return (peer_uid == getuid()); #endif } #else |