VirtualBox

Changeset 93451 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Jan 26, 2022 8:00:17 PM (3 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
149563
Message:

IPRT: Local IPC Server: add interface to set server socket access mode directly, bugref:10134.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/r3/posix/localipc-posix.cpp

    r93115 r93451  
    4444#include <iprt/string.h>
    4545#include <iprt/time.h>
     46#include <iprt/path.h>
    4647
    4748#include <sys/types.h>
     
    295296        LogRel(("RTLocalIpcServerGrantGroupAccess: cannot change IPC socket %s group ownership to %RTgid: errno=%d\n",
    296297                pThis->Name.sun_path, gid, errno));
     298    return RTErrConvertFromErrno(errno);
     299}
     300
     301
     302RTDECL(int) RTLocalIpcServerSetAccessMode(RTLOCALIPCSERVER hServer, RTFMODE fMode)
     303{
     304    PRTLOCALIPCSERVERINT pThis = (PRTLOCALIPCSERVERINT)hServer;
     305    AssertPtrReturn(pThis, VERR_INVALID_HANDLE);
     306    AssertReturn(pThis->u32Magic == RTLOCALIPCSERVER_MAGIC, VERR_INVALID_HANDLE);
     307    AssertReturn(pThis->Name.sun_path[0] != '\0', VERR_INVALID_STATE);
     308
     309    if (chmod(pThis->Name.sun_path, fMode & RTFS_UNIX_ALL_ACCESS_PERMS) == 0)
     310        return VINF_SUCCESS;
     311
    297312    return RTErrConvertFromErrno(errno);
    298313}
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette