Blame SOURCES/0005-certmap-add-placeholder-for-OpenSSL-implementation.patch

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