|
|
ced1f5 |
From 22c5575eb442f20230081cc06528d685397c8914 Mon Sep 17 00:00:00 2001
|
|
|
ced1f5 |
From: Sumit Bose <sbose@redhat.com>
|
|
|
ced1f5 |
Date: Fri, 29 Sep 2017 21:38:54 +0200
|
|
|
ced1f5 |
Subject: [PATCH 22/31] sss_client: create nss_common.h
|
|
|
ced1f5 |
|
|
|
ced1f5 |
This patch makes sss_nss_getpw_readrep() and sss_nss_getgr_readrep()
|
|
|
ced1f5 |
calls which parse SSSD's replies for user and group requests available
|
|
|
ced1f5 |
to other components.
|
|
|
ced1f5 |
|
|
|
ced1f5 |
Related to https://pagure.io/SSSD/sssd/issue/2478
|
|
|
ced1f5 |
|
|
|
ced1f5 |
Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
|
|
|
ced1f5 |
(cherry picked from commit 7449b236523409cc8766fb957d6cba051fdfb483)
|
|
|
ced1f5 |
---
|
|
|
ced1f5 |
Makefile.am | 1 +
|
|
|
ced1f5 |
src/sss_client/nss_common.h | 43 +++++++++++++++++++++++++++++++++++++++++++
|
|
|
ced1f5 |
src/sss_client/nss_group.c | 10 +++-------
|
|
|
ced1f5 |
src/sss_client/nss_passwd.c | 11 +++--------
|
|
|
ced1f5 |
4 files changed, 50 insertions(+), 15 deletions(-)
|
|
|
ced1f5 |
create mode 100644 src/sss_client/nss_common.h
|
|
|
ced1f5 |
|
|
|
ced1f5 |
diff --git a/Makefile.am b/Makefile.am
|
|
|
ced1f5 |
index 5483375167d99568e8313c9a0488900419be6ec3..dc2f4b1857ce5bd376544488348731be29b6b293 100644
|
|
|
ced1f5 |
--- a/Makefile.am
|
|
|
ced1f5 |
+++ b/Makefile.am
|
|
|
ced1f5 |
@@ -3623,6 +3623,7 @@ libnss_sss_la_SOURCES = \
|
|
|
ced1f5 |
src/sss_client/nss_services.c \
|
|
|
ced1f5 |
src/sss_client/sss_cli.h \
|
|
|
ced1f5 |
src/sss_client/nss_compat.h \
|
|
|
ced1f5 |
+ src/sss_client/nss_common.h \
|
|
|
ced1f5 |
src/sss_client/nss_mc_common.c \
|
|
|
ced1f5 |
src/util/io.c \
|
|
|
ced1f5 |
src/util/murmurhash3.c \
|
|
|
ced1f5 |
diff --git a/src/sss_client/nss_common.h b/src/sss_client/nss_common.h
|
|
|
ced1f5 |
new file mode 100644
|
|
|
ced1f5 |
index 0000000000000000000000000000000000000000..e83b4f95a3136b5aa711194a4d37389eebfb607a
|
|
|
ced1f5 |
--- /dev/null
|
|
|
ced1f5 |
+++ b/src/sss_client/nss_common.h
|
|
|
ced1f5 |
@@ -0,0 +1,43 @@
|
|
|
ced1f5 |
+/*
|
|
|
ced1f5 |
+ SSSD
|
|
|
ced1f5 |
+
|
|
|
ced1f5 |
+ Common routines for classical and enhanced NSS interface
|
|
|
ced1f5 |
+
|
|
|
ced1f5 |
+ Authors:
|
|
|
ced1f5 |
+ Sumit Bose <sbose@redhat.com>
|
|
|
ced1f5 |
+
|
|
|
ced1f5 |
+ Copyright (C) Red Hat, Inc 2007
|
|
|
ced1f5 |
+
|
|
|
ced1f5 |
+ This program is free software; you can redistribute it and/or modify
|
|
|
ced1f5 |
+ it under the terms of the GNU Lesser General Public License as published by
|
|
|
ced1f5 |
+ the Free Software Foundation; either version 3 of the License, or
|
|
|
ced1f5 |
+ (at your option) any later version.
|
|
|
ced1f5 |
+
|
|
|
ced1f5 |
+ This program is distributed in the hope that it will be useful,
|
|
|
ced1f5 |
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
ced1f5 |
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
ced1f5 |
+ GNU Lesser General Public License for more details.
|
|
|
ced1f5 |
+
|
|
|
ced1f5 |
+ You should have received a copy of the GNU Lesser General Public License
|
|
|
ced1f5 |
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
ced1f5 |
+*/
|
|
|
ced1f5 |
+
|
|
|
ced1f5 |
+
|
|
|
ced1f5 |
+
|
|
|
ced1f5 |
+struct sss_nss_pw_rep {
|
|
|
ced1f5 |
+ struct passwd *result;
|
|
|
ced1f5 |
+ char *buffer;
|
|
|
ced1f5 |
+ size_t buflen;
|
|
|
ced1f5 |
+};
|
|
|
ced1f5 |
+
|
|
|
ced1f5 |
+int sss_nss_getpw_readrep(struct sss_nss_pw_rep *pr,
|
|
|
ced1f5 |
+ uint8_t *buf, size_t *len);
|
|
|
ced1f5 |
+
|
|
|
ced1f5 |
+struct sss_nss_gr_rep {
|
|
|
ced1f5 |
+ struct group *result;
|
|
|
ced1f5 |
+ char *buffer;
|
|
|
ced1f5 |
+ size_t buflen;
|
|
|
ced1f5 |
+};
|
|
|
ced1f5 |
+
|
|
|
ced1f5 |
+int sss_nss_getgr_readrep(struct sss_nss_gr_rep *pr,
|
|
|
ced1f5 |
+ uint8_t *buf, size_t *len);
|
|
|
ced1f5 |
diff --git a/src/sss_client/nss_group.c b/src/sss_client/nss_group.c
|
|
|
ced1f5 |
index 0e686af43aeb84a5938315e3922e9fcf2fef4e83..42fba6242d23fc1d52cfd7be10cf10383010f091 100644
|
|
|
ced1f5 |
--- a/src/sss_client/nss_group.c
|
|
|
ced1f5 |
+++ b/src/sss_client/nss_group.c
|
|
|
ced1f5 |
@@ -29,6 +29,7 @@
|
|
|
ced1f5 |
#include <stdbool.h>
|
|
|
ced1f5 |
#include "sss_cli.h"
|
|
|
ced1f5 |
#include "nss_mc.h"
|
|
|
ced1f5 |
+#include "nss_common.h"
|
|
|
ced1f5 |
|
|
|
ced1f5 |
static struct sss_nss_getgrent_data {
|
|
|
ced1f5 |
size_t len;
|
|
|
ced1f5 |
@@ -190,14 +191,9 @@ done:
|
|
|
ced1f5 |
*
|
|
|
ced1f5 |
* FIXME: do we need to pad so that each result is 32 bit aligned ?
|
|
|
ced1f5 |
*/
|
|
|
ced1f5 |
-struct sss_nss_gr_rep {
|
|
|
ced1f5 |
- struct group *result;
|
|
|
ced1f5 |
- char *buffer;
|
|
|
ced1f5 |
- size_t buflen;
|
|
|
ced1f5 |
-};
|
|
|
ced1f5 |
|
|
|
ced1f5 |
-static int sss_nss_getgr_readrep(struct sss_nss_gr_rep *pr,
|
|
|
ced1f5 |
- uint8_t *buf, size_t *len)
|
|
|
ced1f5 |
+int sss_nss_getgr_readrep(struct sss_nss_gr_rep *pr,
|
|
|
ced1f5 |
+ uint8_t *buf, size_t *len)
|
|
|
ced1f5 |
{
|
|
|
ced1f5 |
errno_t ret;
|
|
|
ced1f5 |
size_t i, l, slen, ptmem, pad, dlen, glen;
|
|
|
ced1f5 |
diff --git a/src/sss_client/nss_passwd.c b/src/sss_client/nss_passwd.c
|
|
|
ced1f5 |
index c43f9bc50f43599b541e97f5a5aa60de036a5cdf..61e2a567e684fbc7664b5d425e81cfa28a98e845 100644
|
|
|
ced1f5 |
--- a/src/sss_client/nss_passwd.c
|
|
|
ced1f5 |
+++ b/src/sss_client/nss_passwd.c
|
|
|
ced1f5 |
@@ -28,6 +28,7 @@
|
|
|
ced1f5 |
#include <string.h>
|
|
|
ced1f5 |
#include "sss_cli.h"
|
|
|
ced1f5 |
#include "nss_mc.h"
|
|
|
ced1f5 |
+#include "nss_common.h"
|
|
|
ced1f5 |
|
|
|
ced1f5 |
static struct sss_nss_getpwent_data {
|
|
|
ced1f5 |
size_t len;
|
|
|
ced1f5 |
@@ -63,14 +64,8 @@ static void sss_nss_getpwent_data_clean(void) {
|
|
|
ced1f5 |
* 8-X: sequence of 5, 0 terminated, strings (name, passwd, gecos, dir, shell)
|
|
|
ced1f5 |
*/
|
|
|
ced1f5 |
|
|
|
ced1f5 |
-struct sss_nss_pw_rep {
|
|
|
ced1f5 |
- struct passwd *result;
|
|
|
ced1f5 |
- char *buffer;
|
|
|
ced1f5 |
- size_t buflen;
|
|
|
ced1f5 |
-};
|
|
|
ced1f5 |
-
|
|
|
ced1f5 |
-static int sss_nss_getpw_readrep(struct sss_nss_pw_rep *pr,
|
|
|
ced1f5 |
- uint8_t *buf, size_t *len)
|
|
|
ced1f5 |
+int sss_nss_getpw_readrep(struct sss_nss_pw_rep *pr,
|
|
|
ced1f5 |
+ uint8_t *buf, size_t *len)
|
|
|
ced1f5 |
{
|
|
|
ced1f5 |
errno_t ret;
|
|
|
ced1f5 |
size_t i, slen, dlen;
|
|
|
ced1f5 |
--
|
|
|
ced1f5 |
2.13.6
|
|
|
ced1f5 |
|