| 1854 | } |
| 1855 | |
| 1856 | static int posix_socket_path_identity_read(const cbm_daemon_ipc_endpoint_t *endpoint, |
| 1857 | const char *socket_name, |
| 1858 | posix_socket_identity_t *identity_out, |
| 1859 | struct stat *status_out) { |
| 1860 | struct stat status; |
| 1861 | if (!endpoint || !socket_name || !identity_out) { |
| 1862 | return -1; |
| 1863 | } |
| 1864 | if (fstatat(endpoint->dir_fd, socket_name, &status, AT_SYMLINK_NOFOLLOW) != 0) { |
| 1865 | return errno == ENOENT ? 0 : -1; |
| 1866 | } |
| 1867 | if (!posix_socket_status_secure_transport(&status) || |
| 1868 | !posix_socket_identity_from_stat(&status, identity_out)) { |
| 1869 | return -1; |
| 1870 | } |
| 1871 | if (status_out) { |
| 1872 | *status_out = status; |
| 1873 | } |
| 1874 | return 1; |
| 1875 | } |
| 1876 | |
| 1877 | static bool posix_path_unlink_regular_if_matches(int dir_fd, const char *name, dev_t device, |
| 1878 | ino_t inode, nlink_t links) { |
no test coverage detected