summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRoman Rakus <rrakus@redhat.com>2012-11-07 13:51:28 +0100
committerRoman Rakus <rrakus@redhat.com>2012-11-07 13:51:28 +0100
commitfcba47aa00263ffd0e6372d7de4ce20b04132559 (patch)
tree98cbb8dbfad898a7bf3bf6fe45a5a08ce5b62708 /src
parent0bd973c335dd56a198c05cc2fe2f37c99ac1d961 (diff)
downloadopenlmi-providers-fcba47aa00263ffd0e6372d7de4ce20b04132559.tar.gz
openlmi-providers-fcba47aa00263ffd0e6372d7de4ce20b04132559.tar.xz
openlmi-providers-fcba47aa00263ffd0e6372d7de4ce20b04132559.zip
Account: Compiletime definition of supported encrypt algorithms0.0.13
Signed-off-by: Roman Rakus <rrakus@redhat.com>
Diffstat (limited to 'src')
-rw-r--r--src/account/CMakeLists.txt9
-rw-r--r--src/account/LMI_AccountManagementCapabilitiesProvider.c16
-rw-r--r--src/account/account_globals.c4
-rw-r--r--src/account/account_globals.h6
4 files changed, 35 insertions, 0 deletions
diff --git a/src/account/CMakeLists.txt b/src/account/CMakeLists.txt
index 7aa517e..2c1d817 100644
--- a/src/account/CMakeLists.txt
+++ b/src/account/CMakeLists.txt
@@ -5,8 +5,17 @@ set(MOF LMI_Account.mof)
set(provider_SRCS
aux_lu.c
+ account_globals.c
)
+if (NOT DEFINED CRYPT_ALGS)
+ message ("Setting default crypto algorithms")
+ set (CRYPT_ALGS "\"DES\"")
+endif (NOT DEFINED CRYPT_ALGS)
+
+message ("Using crypto algorithms: ${CRYPT_ALGS}")
+add_definitions(-DCRYPT_ALGS=${CRYPT_ALGS})
+
konkretcmpi_generate(${MOF}
CIM_PROVIDERS
CIM_HEADERS
diff --git a/src/account/LMI_AccountManagementCapabilitiesProvider.c b/src/account/LMI_AccountManagementCapabilitiesProvider.c
index 391b715..c6be6af 100644
--- a/src/account/LMI_AccountManagementCapabilitiesProvider.c
+++ b/src/account/LMI_AccountManagementCapabilitiesProvider.c
@@ -22,6 +22,7 @@
#include "macros.h"
#include "globals.h"
+#include "account_globals.h"
#define NAME LAMCNAME
@@ -57,6 +58,8 @@ static CMPIStatus LMI_AccountManagementCapabilitiesEnumInstances(
const char** properties)
{
LMI_AccountManagementCapabilities lamc;
+ int size = 0; /* How many encrypt algorithms we have */
+ int i = 0;
LMI_AccountManagementCapabilities_Init(&lamc, _cb, KNameSpace(cop));
LMI_AccountManagementCapabilities_Set_ElementNameEditSupported(
@@ -75,6 +78,19 @@ static CMPIStatus LMI_AccountManagementCapabilitiesEnumInstances(
LMI_AccountManagementCapabilities_Init_SupportedUserPasswordEncryptionAlgorithms(&lamc, 1);
LMI_AccountManagementCapabilities_Set_SupportedUserPasswordEncryptionAlgorithms(&lamc, 0, LMI_AccountManagementCapabilities_SupportedUserPasswordEncryptionAlgorithms_Other);
+ /* Count how many ecrypt algorithms we have */
+ while(crypt_algs[size]) size++;
+
+ /* Create a list of other supported password encrypt algorithms */
+ if (size > 0)
+ {
+ LMI_AccountManagementCapabilities_Init_OtherSupportedUserPasswordEncryptionAlgorithms(&lamc, size);
+ for (i = 0; i < size; i++)
+ {
+ LMI_AccountManagementCapabilities_Set_OtherSupportedUserPasswordEncryptionAlgorithms(&lamc, i, crypt_algs[i]);
+ }
+ }
+
KReturnInstance(cr, lamc);
CMReturn(CMPI_RC_OK);
}
diff --git a/src/account/account_globals.c b/src/account/account_globals.c
new file mode 100644
index 0000000..a3e429f
--- /dev/null
+++ b/src/account/account_globals.c
@@ -0,0 +1,4 @@
+#include "account_globals.h"
+#include <stddef.h>
+
+const char *crypt_algs[] = {CRYPT_ALGS, NULL};
diff --git a/src/account/account_globals.h b/src/account/account_globals.h
new file mode 100644
index 0000000..0db14bd
--- /dev/null
+++ b/src/account/account_globals.h
@@ -0,0 +1,6 @@
+#ifndef ACCOUNT_GLOBALS_H
+#define ACCOUNT_GLOBALS_H
+
+/* Global declaration of valid cryptographic algorithms */
+extern const char * crypt_algs[];
+#endif