diff options
author | Roman Rakus <rrakus@redhat.com> | 2012-11-07 13:51:28 +0100 |
---|---|---|
committer | Roman Rakus <rrakus@redhat.com> | 2012-11-07 13:51:28 +0100 |
commit | fcba47aa00263ffd0e6372d7de4ce20b04132559 (patch) | |
tree | 98cbb8dbfad898a7bf3bf6fe45a5a08ce5b62708 | |
parent | 0bd973c335dd56a198c05cc2fe2f37c99ac1d961 (diff) | |
download | openlmi-providers-0.0.13.tar.gz openlmi-providers-0.0.13.tar.xz openlmi-providers-0.0.13.zip |
Account: Compiletime definition of supported encrypt algorithms0.0.13
Signed-off-by: Roman Rakus <rrakus@redhat.com>
-rw-r--r-- | src/account/CMakeLists.txt | 9 | ||||
-rw-r--r-- | src/account/LMI_AccountManagementCapabilitiesProvider.c | 16 | ||||
-rw-r--r-- | src/account/account_globals.c | 4 | ||||
-rw-r--r-- | src/account/account_globals.h | 6 |
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 |