File indexing completed on 2024-05-05 03:54:29
0001 /* vi: ts=8 sts=4 sw=4 0002 0003 This file is part of the KDE project, module kdesu. 0004 SPDX-FileCopyrightText: 1999, 2000 Geert Jansen <jansen@kde.org> 0005 */ 0006 0007 #ifndef __Secure_h_included__ 0008 #define __Secure_h_included__ 0009 0010 #include <sys/socket.h> 0011 #include <sys/types.h> 0012 0013 /** 0014 * The Socket_security class authenticates the peer for you. It provides 0015 * the process-id, user-id and group-id plus the MD5 sum of the connected 0016 * binary. 0017 */ 0018 0019 class SocketSecurity 0020 { 0021 public: 0022 explicit SocketSecurity(int fd); 0023 0024 /** Returns the peer's process-id. */ 0025 int peerPid() const 0026 { 0027 return pid; 0028 } 0029 0030 /** Returns the peer's user-id */ 0031 int peerUid() const 0032 { 0033 return uid; 0034 } 0035 0036 /** Returns the peer's group-id */ 0037 int peerGid() const 0038 { 0039 return gid; 0040 } 0041 0042 private: 0043 int pid; 0044 int gid; 0045 int uid; 0046 }; 0047 0048 #endif