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