Skip to content

Commit

Permalink
SSS_CLIENT: check if reponder socket was hijacked
Browse files Browse the repository at this point in the history
  • Loading branch information
alexey-tikhonov committed Dec 20, 2023
1 parent f0c153c commit a285b62
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/sss_client/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -767,6 +767,16 @@ static enum sss_status sss_cli_check_socket(int *errnop,
myself_ino = myself_sb.st_ino;
}

/* check if the socket has been hijacked */
if (sss_cli_sd_get() != -1) {
ret = fstat(sss_cli_sd_get(), &mypid_sb);
if ((ret != 0) || (!S_ISSOCK(mypid_sb.st_mode))
|| (mypid_sb.st_dev != sss_cli_sb->st_dev)
|| (mypid_sb.st_ino != sss_cli_sb->st_ino)) {
sss_cli_sd_set(-1); /* don't ruin app even if it's misbehaving */
}
}

/* check if the socket has been closed on the other side */
if (sss_cli_sd_get() != -1) {
struct pollfd pfd;
Expand Down

0 comments on commit a285b62

Please sign in to comment.