|
|
bb7cd1 |
From b1336bdfeacf904c8fdec04e06d8b90ef9ad15b3 Mon Sep 17 00:00:00 2001
|
|
|
bb7cd1 |
From: Sumit Bose <sbose@redhat.com>
|
|
|
bb7cd1 |
Date: Wed, 15 Mar 2017 10:57:09 +0100
|
|
|
bb7cd1 |
Subject: [PATCH 05/15] certmap: add placeholder for OpenSSL implementation
|
|
|
bb7cd1 |
MIME-Version: 1.0
|
|
|
bb7cd1 |
Content-Type: text/plain; charset=UTF-8
|
|
|
bb7cd1 |
Content-Transfer-Encoding: 8bit
|
|
|
bb7cd1 |
|
|
|
bb7cd1 |
Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
|
|
|
bb7cd1 |
Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com>
|
|
|
bb7cd1 |
---
|
|
|
bb7cd1 |
Makefile.am | 30 +++++++++++++++++++++--------
|
|
|
bb7cd1 |
src/lib/certmap/sss_cert_content_crypto.c | 32 +++++++++++++++++++++++++++++++
|
|
|
bb7cd1 |
src/lib/certmap/sss_certmap_int.h | 8 +++++---
|
|
|
bb7cd1 |
3 files changed, 59 insertions(+), 11 deletions(-)
|
|
|
bb7cd1 |
create mode 100644 src/lib/certmap/sss_cert_content_crypto.c
|
|
|
bb7cd1 |
|
|
|
bb7cd1 |
diff --git a/Makefile.am b/Makefile.am
|
|
|
bb7cd1 |
index 8ca12c10d2713b6a72361d84b25486500c79f407..7947b7a5fbe3ca1034baac1c13c53300994b1bf8 100644
|
|
|
bb7cd1 |
--- a/Makefile.am
|
|
|
bb7cd1 |
+++ b/Makefile.am
|
|
|
bb7cd1 |
@@ -278,9 +278,12 @@ if HAVE_CMOCKA
|
|
|
bb7cd1 |
simple-access-tests \
|
|
|
bb7cd1 |
krb5_common_test \
|
|
|
bb7cd1 |
test_iobuf \
|
|
|
bb7cd1 |
- sss_certmap_test \
|
|
|
bb7cd1 |
$(NULL)
|
|
|
bb7cd1 |
|
|
|
bb7cd1 |
+if HAVE_NSS
|
|
|
bb7cd1 |
+non_interactive_cmocka_based_tests += sss_certmap_test
|
|
|
bb7cd1 |
+endif #HAVE_NSS
|
|
|
bb7cd1 |
+
|
|
|
bb7cd1 |
if HAVE_LIBRESOLV
|
|
|
bb7cd1 |
non_interactive_cmocka_based_tests += test_resolv_fake
|
|
|
bb7cd1 |
endif # HAVE_LIBRESOLV
|
|
|
bb7cd1 |
@@ -1715,7 +1718,6 @@ sssd_check_socket_activated_responders_LDADD = \
|
|
|
bb7cd1 |
$(NULL)
|
|
|
bb7cd1 |
endif
|
|
|
bb7cd1 |
|
|
|
bb7cd1 |
-if HAVE_NSS
|
|
|
bb7cd1 |
pkgconfig_DATA += src/lib/certmap/sss_certmap.pc
|
|
|
bb7cd1 |
libsss_certmap_la_DEPENDENCIES = src/lib/certmap/sss_certmap.exports
|
|
|
bb7cd1 |
libsss_certmap_la_SOURCES = \
|
|
|
bb7cd1 |
@@ -1726,26 +1728,38 @@ libsss_certmap_la_SOURCES = \
|
|
|
bb7cd1 |
src/lib/certmap/sss_certmap_ldap_mapping.c \
|
|
|
bb7cd1 |
src/util/util_ext.c \
|
|
|
bb7cd1 |
src/util/cert/cert_common.c \
|
|
|
bb7cd1 |
- src/util/crypto/nss/nss_base64.c \
|
|
|
bb7cd1 |
- src/util/cert/nss/cert.c \
|
|
|
bb7cd1 |
- src/util/crypto/nss/nss_util.c \
|
|
|
bb7cd1 |
$(NULL)
|
|
|
bb7cd1 |
libsss_certmap_la_CFLAGS = \
|
|
|
bb7cd1 |
$(AM_CFLAGS) \
|
|
|
bb7cd1 |
$(TALLOC_CFLAGS) \
|
|
|
bb7cd1 |
- $(NSS_CFLAGS) \
|
|
|
bb7cd1 |
$(NULL)
|
|
|
bb7cd1 |
libsss_certmap_la_LIBADD = \
|
|
|
bb7cd1 |
$(TALLOC_LIBS) \
|
|
|
bb7cd1 |
- $(NSS_LIBS) \
|
|
|
bb7cd1 |
$(NULL)
|
|
|
bb7cd1 |
libsss_certmap_la_LDFLAGS = \
|
|
|
bb7cd1 |
-Wl,--version-script,$(srcdir)/src/lib/certmap/sss_certmap.exports \
|
|
|
bb7cd1 |
-version-info 0:0:0
|
|
|
bb7cd1 |
|
|
|
bb7cd1 |
+if HAVE_NSS
|
|
|
bb7cd1 |
+libsss_certmap_la_SOURCES += \
|
|
|
bb7cd1 |
+ src/util/crypto/nss/nss_base64.c \
|
|
|
bb7cd1 |
+ src/util/cert/nss/cert.c \
|
|
|
bb7cd1 |
+ src/util/crypto/nss/nss_util.c \
|
|
|
bb7cd1 |
+ $(NULL)
|
|
|
bb7cd1 |
+libsss_certmap_la_CFLAGS += $(NSS_CFLAGS)
|
|
|
bb7cd1 |
+libsss_certmap_la_LIBADD += $(NSS_LIBS)
|
|
|
bb7cd1 |
+else
|
|
|
bb7cd1 |
+libsss_certmap_la_SOURCES += \
|
|
|
bb7cd1 |
+ src/util/crypto/libcrypto/crypto_base64.c \
|
|
|
bb7cd1 |
+ src/util/cert/libcrypto/cert.c \
|
|
|
bb7cd1 |
+ $(NULL)
|
|
|
bb7cd1 |
+
|
|
|
bb7cd1 |
+libsss_certmap_la_CFLAGS += $(CRYPTO_CFLAGS)
|
|
|
bb7cd1 |
+libsss_certmap_la_LIBADD += $(CRYPTO_LIBS)
|
|
|
bb7cd1 |
+endif
|
|
|
bb7cd1 |
+
|
|
|
bb7cd1 |
dist_noinst_DATA += src/lib/certmap/sss_certmap.exports
|
|
|
bb7cd1 |
dist_noinst_HEADERS += src/lib/certmap/sss_certmap_int.h
|
|
|
bb7cd1 |
-endif
|
|
|
bb7cd1 |
|
|
|
bb7cd1 |
#################
|
|
|
bb7cd1 |
# Feature Tests #
|
|
|
bb7cd1 |
diff --git a/src/lib/certmap/sss_cert_content_crypto.c b/src/lib/certmap/sss_cert_content_crypto.c
|
|
|
bb7cd1 |
new file mode 100644
|
|
|
bb7cd1 |
index 0000000000000000000000000000000000000000..bddcf9bce986bd986aa0aa5f16a0744a97ab36d6
|
|
|
bb7cd1 |
--- /dev/null
|
|
|
bb7cd1 |
+++ b/src/lib/certmap/sss_cert_content_crypto.c
|
|
|
bb7cd1 |
@@ -0,0 +1,32 @@
|
|
|
bb7cd1 |
+/*
|
|
|
bb7cd1 |
+ SSSD - certificate handling utils - OpenSSL version
|
|
|
bb7cd1 |
+ The calls defined here should be useable outside of SSSD as well, e.g. in
|
|
|
bb7cd1 |
+ libsss_certmap.
|
|
|
bb7cd1 |
+
|
|
|
bb7cd1 |
+ Copyright (C) Sumit Bose <sbose@redhat.com> 2017
|
|
|
bb7cd1 |
+
|
|
|
bb7cd1 |
+ This program is free software; you can redistribute it and/or modify
|
|
|
bb7cd1 |
+ it under the terms of the GNU General Public License as published by
|
|
|
bb7cd1 |
+ the Free Software Foundation; either version 3 of the License, or
|
|
|
bb7cd1 |
+ (at your option) any later version.
|
|
|
bb7cd1 |
+
|
|
|
bb7cd1 |
+ This program is distributed in the hope that it will be useful,
|
|
|
bb7cd1 |
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
bb7cd1 |
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
bb7cd1 |
+ GNU General Public License for more details.
|
|
|
bb7cd1 |
+
|
|
|
bb7cd1 |
+ You should have received a copy of the GNU General Public License
|
|
|
bb7cd1 |
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
bb7cd1 |
+*/
|
|
|
bb7cd1 |
+
|
|
|
bb7cd1 |
+#include <errno.h>
|
|
|
bb7cd1 |
+
|
|
|
bb7cd1 |
+#include "lib/certmap/sss_certmap.h"
|
|
|
bb7cd1 |
+#include "lib/certmap/sss_certmap_int.h"
|
|
|
bb7cd1 |
+
|
|
|
bb7cd1 |
+int sss_cert_get_content(TALLOC_CTX *mem_ctx,
|
|
|
bb7cd1 |
+ const uint8_t *der_blob, size_t der_size,
|
|
|
bb7cd1 |
+ struct sss_cert_content **content)
|
|
|
bb7cd1 |
+{
|
|
|
bb7cd1 |
+ return EINVAL;
|
|
|
bb7cd1 |
+}
|
|
|
bb7cd1 |
diff --git a/src/lib/certmap/sss_certmap_int.h b/src/lib/certmap/sss_certmap_int.h
|
|
|
bb7cd1 |
index 28f1c596cfb5e78077b6a8e9baefa88b4900a022..0b4cda73639be9b323ac3388f97be90bc1a771f2 100644
|
|
|
bb7cd1 |
--- a/src/lib/certmap/sss_certmap_int.h
|
|
|
bb7cd1 |
+++ b/src/lib/certmap/sss_certmap_int.h
|
|
|
bb7cd1 |
@@ -22,12 +22,14 @@
|
|
|
bb7cd1 |
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
bb7cd1 |
*/
|
|
|
bb7cd1 |
|
|
|
bb7cd1 |
-#include <sys/types.h>
|
|
|
bb7cd1 |
-#include <regex.h>
|
|
|
bb7cd1 |
-
|
|
|
bb7cd1 |
#ifndef __SSS_CERTMAP_INT_H__
|
|
|
bb7cd1 |
#define __SSS_CERTMAP_INT_H__
|
|
|
bb7cd1 |
|
|
|
bb7cd1 |
+#include <sys/types.h>
|
|
|
bb7cd1 |
+#include <regex.h>
|
|
|
bb7cd1 |
+#include <stdint.h>
|
|
|
bb7cd1 |
+#include <talloc.h>
|
|
|
bb7cd1 |
+
|
|
|
bb7cd1 |
#define CM_DEBUG(cm_ctx, format, ...) do { \
|
|
|
bb7cd1 |
if (cm_ctx != NULL && cm_ctx->debug != NULL) { \
|
|
|
bb7cd1 |
cm_ctx->debug(cm_ctx->debug_priv, __FILE__, __LINE__, __FUNCTION__, \
|
|
|
bb7cd1 |
--
|
|
|
bb7cd1 |
2.9.3
|
|
|
bb7cd1 |
|