fix pid wrapping in sss_cli_check_socket
resolves:https://gitee.com/src-openeuler/sssd/issues/I6HZQ8?from=project-issue
This commit is contained in:
parent
4648375407
commit
839d43ec2a
@ -1,21 +1,24 @@
|
|||||||
diff -Naur sssd-2.8.2/src/sss_client/common.c sssd-2.8.2-b/src/sss_client/common.c
|
diff -Naur sssd-2.8.2/src/sss_client/common.c sssd-2.8.2-b/src/sss_client/common.c
|
||||||
--- sssd-2.8.2/src/sss_client/common.c 2023-03-09 14:58:11.000000000 +0800
|
--- sssd-2.8.2/src/sss_client/common.c 2023-03-28 11:25:28.000000000 +0800
|
||||||
+++ sssd-2.8.2-b/src/sss_client/common.c 2023-03-09 15:02:20.000000000 +0800
|
+++ sssd-2.8.2-b/src/sss_client/common.c 2023-03-28 11:26:09.000000000 +0800
|
||||||
@@ -664,21 +664,28 @@
|
@@ -663,22 +663,27 @@
|
||||||
|
const char *socket_name,
|
||||||
int timeout)
|
int timeout)
|
||||||
{
|
{
|
||||||
static pid_t mypid;
|
- static pid_t mypid;
|
||||||
- struct stat mysb;
|
- struct stat mysb;
|
||||||
+ static struct stat selfsb;
|
+ static pid_t mypid_s;
|
||||||
|
+ static ino_t myself_ino;
|
||||||
+ struct stat mypid_sb, myself_sb;
|
+ struct stat mypid_sb, myself_sb;
|
||||||
|
+ pid_t mypid_d;
|
||||||
int mysd;
|
int mysd;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
- if (getpid() != mypid) {
|
- if (getpid() != mypid) {
|
||||||
- ret = fstat(sss_cli_sd, &mysb);
|
- ret = fstat(sss_cli_sd, &mysb);
|
||||||
+ ret = lstat("/proc/self/", &myself_sb);
|
+ ret = lstat("/proc/self/", &myself_sb);
|
||||||
+
|
+ mypid_d = getpid();
|
||||||
+ if (getpid() != mypid || (ret == 0 && myself_sb.st_ino != selfsb.st_ino)) {
|
+ if (mypid_d != mypid_s || (ret == 0 && myself_sb.st_ino != myself_ino)) {
|
||||||
+ ret = fstat(sss_cli_sd, &mypid_sb);
|
+ ret = fstat(sss_cli_sd, &mypid_sb);
|
||||||
if (ret == 0) {
|
if (ret == 0) {
|
||||||
- if (S_ISSOCK(mysb.st_mode) &&
|
- if (S_ISSOCK(mysb.st_mode) &&
|
||||||
@ -28,11 +31,9 @@ diff -Naur sssd-2.8.2/src/sss_client/common.c sssd-2.8.2-b/src/sss_client/common
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
sss_cli_sd = -1;
|
sss_cli_sd = -1;
|
||||||
mypid = getpid();
|
- mypid = getpid();
|
||||||
+ ret = lstat("/proc/self/", &selfsb);
|
+ mypid_s = mypid_d;
|
||||||
+ if (ret) {
|
+ myself_ino = myself_sb.st_ino;
|
||||||
+ memset(&selfsb, 0, sizeof(selfsb));
|
|
||||||
+ }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* check if the socket has been closed on the other side */
|
/* check if the socket has been closed on the other side */
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
Name: sssd
|
Name: sssd
|
||||||
Version: 2.8.2
|
Version: 2.8.2
|
||||||
Release: 4
|
Release: 5
|
||||||
Summary: System Security Services Daemon
|
Summary: System Security Services Daemon
|
||||||
License: GPLv3+ and LGPLv3+
|
License: GPLv3+ and LGPLv3+
|
||||||
URL: https://pagure.io/SSSD/sssd/
|
URL: https://pagure.io/SSSD/sssd/
|
||||||
@ -535,6 +535,9 @@ fi
|
|||||||
%systemd_postun_with_restart sssd.service
|
%systemd_postun_with_restart sssd.service
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Tue Mar 28 2023 jiangjixiang <jiangjixiang@kylinos.cn> - 2.8.2-5
|
||||||
|
- fix pid wrapping in sss_cli_check_socket
|
||||||
|
|
||||||
* Wed Mar 08 2023 zhouchenchen123 <zhouchenchen@huawei.com> - 2.8.2-4
|
* Wed Mar 08 2023 zhouchenchen123 <zhouchenchen@huawei.com> - 2.8.2-4
|
||||||
- fix coredump in sssd.service
|
- fix coredump in sssd.service
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user