|
|
ced1f5 |
From 2a3accc78bb9658401b33ad5a3a2f1bc4bc3c269 Mon Sep 17 00:00:00 2001
|
|
|
ced1f5 |
From: Sumit Bose <sbose@redhat.com>
|
|
|
ced1f5 |
Date: Thu, 7 Dec 2017 17:42:45 +0100
|
|
|
ced1f5 |
Subject: [PATCH 86/86] nss-idmap: allow NULL result in *_timeout calls
|
|
|
ced1f5 |
MIME-Version: 1.0
|
|
|
ced1f5 |
Content-Type: text/plain; charset=UTF-8
|
|
|
ced1f5 |
Content-Transfer-Encoding: 8bit
|
|
|
ced1f5 |
|
|
|
ced1f5 |
To make the *_timeout calls more resilient checks are added if the
|
|
|
ced1f5 |
result parameter is NULL. It will not be used in this case.
|
|
|
ced1f5 |
|
|
|
ced1f5 |
Related to https://pagure.io/SSSD/sssd/issue/2478
|
|
|
ced1f5 |
|
|
|
ced1f5 |
Reviewed-by: Fabiano FidĂȘncio <fidencio@redhat.com>
|
|
|
ced1f5 |
Reviewed-by: Alexander Bokovoy <abokovoy@redhat.com>
|
|
|
ced1f5 |
(cherry picked from commit bba068c535d23eebff61f592bddb3a6438446d6f)
|
|
|
ced1f5 |
---
|
|
|
ced1f5 |
src/sss_client/idmap/sss_nss_ex.c | 46 +++++++++++++++++++++++++++------------
|
|
|
ced1f5 |
1 file changed, 32 insertions(+), 14 deletions(-)
|
|
|
ced1f5 |
|
|
|
ced1f5 |
diff --git a/src/sss_client/idmap/sss_nss_ex.c b/src/sss_client/idmap/sss_nss_ex.c
|
|
|
ced1f5 |
index dcd9619a8b07ced7498f61b7e809fa46ebffe09e..861b1e1e92db4f7e6e8d74a812dc3c9220711773 100644
|
|
|
ced1f5 |
--- a/src/sss_client/idmap/sss_nss_ex.c
|
|
|
ced1f5 |
+++ b/src/sss_client/idmap/sss_nss_ex.c
|
|
|
ced1f5 |
@@ -367,13 +367,17 @@ int sss_nss_getpwnam_timeout(const char *name, struct passwd *pwd,
|
|
|
ced1f5 |
return ret;
|
|
|
ced1f5 |
}
|
|
|
ced1f5 |
|
|
|
ced1f5 |
- *result = NULL;
|
|
|
ced1f5 |
-
|
|
|
ced1f5 |
ret = sss_get_ex(&inp, flags, timeout);
|
|
|
ced1f5 |
free(discard_const(inp.rd.data));
|
|
|
ced1f5 |
- if (ret == 0) {
|
|
|
ced1f5 |
- *result = inp.result.pwrep.result;
|
|
|
ced1f5 |
+
|
|
|
ced1f5 |
+ if (result != NULL) {
|
|
|
ced1f5 |
+ if (ret == 0) {
|
|
|
ced1f5 |
+ *result = inp.result.pwrep.result;
|
|
|
ced1f5 |
+ } else {
|
|
|
ced1f5 |
+ *result = NULL;
|
|
|
ced1f5 |
+ }
|
|
|
ced1f5 |
}
|
|
|
ced1f5 |
+
|
|
|
ced1f5 |
return ret;
|
|
|
ced1f5 |
}
|
|
|
ced1f5 |
|
|
|
ced1f5 |
@@ -395,12 +399,17 @@ int sss_nss_getpwuid_timeout(uid_t uid, struct passwd *pwd,
|
|
|
ced1f5 |
|
|
|
ced1f5 |
SAFEALIGN_COPY_UINT32(&req_data[0], &uid, NULL);
|
|
|
ced1f5 |
SAFEALIGN_COPY_UINT32(&req_data[1], &flags, NULL);
|
|
|
ced1f5 |
- *result = NULL;
|
|
|
ced1f5 |
|
|
|
ced1f5 |
ret = sss_get_ex(&inp, flags, timeout);
|
|
|
ced1f5 |
- if (ret == 0) {
|
|
|
ced1f5 |
- *result = inp.result.pwrep.result;
|
|
|
ced1f5 |
+
|
|
|
ced1f5 |
+ if (result != NULL) {
|
|
|
ced1f5 |
+ if (ret == 0) {
|
|
|
ced1f5 |
+ *result = inp.result.pwrep.result;
|
|
|
ced1f5 |
+ } else {
|
|
|
ced1f5 |
+ *result = NULL;
|
|
|
ced1f5 |
+ }
|
|
|
ced1f5 |
}
|
|
|
ced1f5 |
+
|
|
|
ced1f5 |
return ret;
|
|
|
ced1f5 |
}
|
|
|
ced1f5 |
|
|
|
ced1f5 |
@@ -421,13 +430,17 @@ int sss_nss_getgrnam_timeout(const char *name, struct group *grp,
|
|
|
ced1f5 |
return ret;
|
|
|
ced1f5 |
}
|
|
|
ced1f5 |
|
|
|
ced1f5 |
- *result = NULL;
|
|
|
ced1f5 |
-
|
|
|
ced1f5 |
ret = sss_get_ex(&inp, flags, timeout);
|
|
|
ced1f5 |
free(discard_const(inp.rd.data));
|
|
|
ced1f5 |
- if (ret == 0) {
|
|
|
ced1f5 |
- *result = inp.result.grrep.result;
|
|
|
ced1f5 |
+
|
|
|
ced1f5 |
+ if (result != NULL) {
|
|
|
ced1f5 |
+ if (ret == 0) {
|
|
|
ced1f5 |
+ *result = inp.result.grrep.result;
|
|
|
ced1f5 |
+ } else {
|
|
|
ced1f5 |
+ *result = NULL;
|
|
|
ced1f5 |
+ }
|
|
|
ced1f5 |
}
|
|
|
ced1f5 |
+
|
|
|
ced1f5 |
return ret;
|
|
|
ced1f5 |
}
|
|
|
ced1f5 |
|
|
|
ced1f5 |
@@ -448,12 +461,17 @@ int sss_nss_getgrgid_timeout(gid_t gid, struct group *grp,
|
|
|
ced1f5 |
|
|
|
ced1f5 |
SAFEALIGN_COPY_UINT32(&req_data[0], &gid, NULL);
|
|
|
ced1f5 |
SAFEALIGN_COPY_UINT32(&req_data[1], &flags, NULL);
|
|
|
ced1f5 |
- *result = NULL;
|
|
|
ced1f5 |
|
|
|
ced1f5 |
ret = sss_get_ex(&inp, flags, timeout);
|
|
|
ced1f5 |
- if (ret == 0) {
|
|
|
ced1f5 |
- *result = inp.result.grrep.result;
|
|
|
ced1f5 |
+
|
|
|
ced1f5 |
+ if (result != NULL) {
|
|
|
ced1f5 |
+ if (ret == 0) {
|
|
|
ced1f5 |
+ *result = inp.result.grrep.result;
|
|
|
ced1f5 |
+ } else {
|
|
|
ced1f5 |
+ *result = NULL;
|
|
|
ced1f5 |
+ }
|
|
|
ced1f5 |
}
|
|
|
ced1f5 |
+
|
|
|
ced1f5 |
return ret;
|
|
|
ced1f5 |
}
|
|
|
ced1f5 |
|
|
|
ced1f5 |
--
|
|
|
ced1f5 |
2.14.3
|
|
|
ced1f5 |
|