Source Code (Use browser search to find items of interest.)

Class Index

kdesu'SocketSecurity (./kdebase/kdesu/kdesud/secure.h:36)

class SocketSecurity {
public:
    SocketSecurity(int fd);

    /** Returns the peer's process-id. */
    int peerPid() { if (!ok) return -1; return cred.pid; }

    /** Returns the peer's user-id */
    int peerUid() { if (!ok) return -1; return cred.uid; }

    /** Returns the peer's group-id */
    int peerGid() { if (!ok) return -1; return cred.gid; }

private:
    bool ok;
    struct ucred cred;
};

kdesu'SocketSecurity::SocketSecurity() (./kdebase/kdesu/kdesud/secure.cpp:33)

SocketSecurity::SocketSecurity(int sockfd)
{
    ksize_t len = sizeof(struct ucred);
    if (getsockopt(sockfd, SOL_SOCKET, SO_PEERCRED, &cred, &len) < 0) {
	kDebugPError("getsockopt(SO_PEERCRED)");
	return; 
    }

    ok = true;
}

#else


/**
 * The default version does nothing.
 */


kdesu'SocketSecurity::SocketSecurity() (./kdebase/kdesu/kdesud/secure.cpp:51)

SocketSecurity::SocketSecurity(int sockfd)
{
    kDebugWarning("Using void socket security. Please add support for your");
    kDebugWarning("platform to kdesu/kdesud/secure.cpp");

    // This passes the test made in handler.cpp
    cred.uid = getuid();
    ok = true;
}