| 1890 | } |
| 1891 | |
| 1892 | static int posix_socket_path_identity_read(const cbm_daemon_ipc_endpoint_t *endpoint, |
| 1893 | const char *socket_name, |
| 1894 | posix_socket_identity_t *identity_out, |
| 1895 | struct stat *status_out) { |
| 1896 | struct stat status; |
| 1897 | if (!endpoint || !socket_name || !identity_out) { |
| 1898 | return -1; |
| 1899 | } |
| 1900 | if (fstatat(endpoint->dir_fd, socket_name, &status, AT_SYMLINK_NOFOLLOW) != 0) { |
| 1901 | return errno == ENOENT ? 0 : -1; |
| 1902 | } |
| 1903 | if (!posix_socket_status_secure_transport(&status) || |
| 1904 | !posix_socket_identity_from_stat(&status, identity_out)) { |
| 1905 | return -1; |
| 1906 | } |
| 1907 | if (status_out) { |
| 1908 | *status_out = status; |
| 1909 | } |
| 1910 | return 1; |
| 1911 | } |
| 1912 | |
| 1913 | static bool posix_path_unlink_regular_if_matches(int dir_fd, const char *name, dev_t device, |
| 1914 | ino_t inode, nlink_t links) { |
no test coverage detected