189 lines
4.9 KiB
Diff
189 lines
4.9 KiB
Diff
From 0543f1d02ee733d34ee109d00e7d0efd432bb37b Mon Sep 17 00:00:00 2001
|
|
From: Lee Duncan <lduncan@suse.com>
|
|
Date: Tue, 28 Jan 2020 11:49:55 -0800
|
|
Subject: [PATCH 2/7] Fix compiler issue when not in security mode
|
|
|
|
---
|
|
client.c | 20 +++++++++++++-------
|
|
db-policy.c | 12 +++++++++---
|
|
include/libisns/util.h | 1 +
|
|
isnsadm.c | 2 +-
|
|
security.c | 14 ++++++++------
|
|
socket.c | 5 +++--
|
|
6 files changed, 35 insertions(+), 19 deletions(-)
|
|
|
|
diff --git a/client.c b/client.c
|
|
index 8487877..fda26be 100644
|
|
--- a/client.c
|
|
+++ b/client.c
|
|
@@ -122,22 +122,17 @@ isns_client_get_local_address(const isns_client_t *clnt,
|
|
/*
|
|
* Create a security context
|
|
*/
|
|
+#ifdef WITH_SECURITY
|
|
static isns_security_t *
|
|
__create_security_context(const char *name, const char *auth_key,
|
|
const char *server_key)
|
|
{
|
|
-#ifdef WITH_SECURITY
|
|
isns_security_t *ctx;
|
|
isns_principal_t *princ;
|
|
-#endif /* WITH_SECURITY */
|
|
|
|
if (!isns_config.ic_security)
|
|
return NULL;
|
|
|
|
-#ifndef WITH_SECURITY
|
|
- isns_error("Cannot create security context: security disabled at build time\n");
|
|
- return NULL;
|
|
-#else /* WITH_SECURITY */
|
|
ctx = isns_create_dsa_context();
|
|
if (ctx == NULL)
|
|
isns_fatal("Unable to create security context\n");
|
|
@@ -174,8 +169,19 @@ __create_security_context(const char *name, const char *auth_key,
|
|
}
|
|
|
|
return ctx;
|
|
-#endif /* WITH_SECURITY */
|
|
}
|
|
+#else /* WITH_SECURITY */
|
|
+static isns_security_t *
|
|
+__create_security_context(__attribute__((unused))const char *name,
|
|
+ __attribute__((unused))const char *auth_key,
|
|
+ __attribute__((unused))const char *server_key)
|
|
+{
|
|
+ if (!isns_config.ic_security)
|
|
+ return NULL;
|
|
+ isns_error("Cannot create security context: security disabled at build time\n");
|
|
+ return NULL;
|
|
+}
|
|
+#endif /* WITH_SECURITY */
|
|
|
|
/*
|
|
* Create the default security context
|
|
diff --git a/db-policy.c b/db-policy.c
|
|
index b1c46e2..d4a0cba 100644
|
|
--- a/db-policy.c
|
|
+++ b/db-policy.c
|
|
@@ -52,11 +52,11 @@ __isns_db_keystore_lookup(isns_db_keystore_t *store,
|
|
/*
|
|
* Load a DSA key from the DB store
|
|
*/
|
|
+#ifdef WITH_SECURITY
|
|
static EVP_PKEY *
|
|
__isns_db_keystore_find(isns_keystore_t *store_base,
|
|
const char *name, size_t namelen)
|
|
{
|
|
-#ifdef WITH_SECURITY
|
|
isns_db_keystore_t *store = (isns_db_keystore_t *) store_base;
|
|
isns_object_t *obj;
|
|
const void *key_data;
|
|
@@ -71,10 +71,16 @@ __isns_db_keystore_find(isns_keystore_t *store_base,
|
|
return NULL;
|
|
|
|
return isns_dsa_decode_public(key_data, key_size);
|
|
-#else
|
|
+}
|
|
+#else /* WITH_SECURITY */
|
|
+static EVP_PKEY *
|
|
+__isns_db_keystore_find(__attribute__((unused))isns_keystore_t *store_base,
|
|
+ __attribute__((unused))const char *name,
|
|
+ __attribute__((unused))size_t namelen)
|
|
+{
|
|
return NULL;
|
|
-#endif
|
|
}
|
|
+#endif /* WITH_SECURITY */
|
|
|
|
/*
|
|
* Retrieve policy from database
|
|
diff --git a/include/libisns/util.h b/include/libisns/util.h
|
|
index 4174480..e5ed037 100644
|
|
--- a/include/libisns/util.h
|
|
+++ b/include/libisns/util.h
|
|
@@ -14,6 +14,7 @@
|
|
#include <string.h> // for strdup
|
|
#include <signal.h>
|
|
#include <libisns/types.h>
|
|
+#include <stdlib.h>
|
|
|
|
#define array_num_elements(a) (sizeof(a) / sizeof((a)[0]))
|
|
|
|
diff --git a/isnsadm.c b/isnsadm.c
|
|
index 7a96007..94c705e 100644
|
|
--- a/isnsadm.c
|
|
+++ b/isnsadm.c
|
|
@@ -1162,7 +1162,7 @@ generate_key_callback(void)
|
|
}
|
|
|
|
isns_attr_t *
|
|
-load_key_callback(const char *pathname)
|
|
+load_key_callback(__attribute__((unused))const char *pathname)
|
|
{
|
|
isns_fatal("Authentication disabled in this build\n");
|
|
return NULL;
|
|
diff --git a/security.c b/security.c
|
|
index 673a26e..68eb779 100644
|
|
--- a/security.c
|
|
+++ b/security.c
|
|
@@ -408,32 +408,34 @@ isns_security_init(void)
|
|
}
|
|
|
|
isns_keystore_t *
|
|
-isns_create_keystore(const char *spec)
|
|
+isns_create_keystore(__attribute__((unused))const char *spec)
|
|
{
|
|
isns_no_security();
|
|
return NULL;
|
|
}
|
|
|
|
void
|
|
-isns_security_set_keystore(isns_security_t *ctx,
|
|
- isns_keystore_t *ks)
|
|
+isns_security_set_keystore(__attribute__((unused))isns_security_t *ctx,
|
|
+ __attribute__((unused))isns_keystore_t *ks)
|
|
{
|
|
isns_no_security();
|
|
}
|
|
|
|
void
|
|
-isns_principal_free(isns_principal_t *peer)
|
|
+isns_principal_free(__attribute__((unused))isns_principal_t *peer)
|
|
{
|
|
}
|
|
|
|
isns_principal_t *
|
|
-isns_get_principal(isns_security_t *ctx, const char *spi, size_t spi_len)
|
|
+isns_get_principal(__attribute__((unused))isns_security_t *ctx,
|
|
+ __attribute__((unused))const char *spi,
|
|
+ __attribute__((unused))size_t spi_len)
|
|
{
|
|
return NULL;
|
|
}
|
|
|
|
const char *
|
|
-isns_principal_name(const isns_principal_t *princ)
|
|
+isns_principal_name(__attribute__((unused))const isns_principal_t *princ)
|
|
{
|
|
return NULL;
|
|
}
|
|
diff --git a/socket.c b/socket.c
|
|
index da9f5dc..a76d593 100644
|
|
--- a/socket.c
|
|
+++ b/socket.c
|
|
@@ -322,8 +322,9 @@ failed:
|
|
}
|
|
#else /* WITH_SECURITY */
|
|
static int
|
|
-isns_pdu_authenticate(isns_security_t *sec,
|
|
- struct isns_partial_msg *msg, buf_t *bp)
|
|
+isns_pdu_authenticate(__attribute__((unused))isns_security_t *sec,
|
|
+ __attribute__((unused))struct isns_partial_msg *msg,
|
|
+ __attribute__((unused))buf_t *bp)
|
|
{
|
|
return 0;
|
|
}
|
|
--
|
|
2.18.1
|
|
|