diff --git a/c_micasadk/sscs_ndk.c b/c_micasadk/sscs_ndk.c index ce00c21c..7aa6e5e0 100644 --- a/c_micasadk/sscs_ndk.c +++ b/c_micasadk/sscs_ndk.c @@ -755,7 +755,6 @@ miCASAOpenSecretStoreCache /* ############################## CODE STARTS HERE ############################ */ - searchKey.srchKey[0] = NSSCS_ENUM_DELIM; searchKey.srchKeyLen = sscs_Utf8Strlen(searchKey.srchKey) + 1; @@ -2671,7 +2670,7 @@ miCASAGetCredential uint32_t ssFlags, // IN SSCS_SECRET_ID_T * appSecretID, // IN SSCS_SECRET_ID_T * sharedSecretID, // Optional IN - int32_t * credentialType, // IN/OUT + uint32_t * credentialType, // IN/OUT void * credential, // OUT SSCS_EXT_T * ext // Reserved ) @@ -2709,44 +2708,42 @@ miCASAGetCredential store.version = 1; context = miCASAOpenSecretStoreCache(&store, ssFlags, NULL); - /* if (*credentialType == SSCS_CRED_TYPE_BINARY_F) { // first check appSecretID rcode = miCASAReadBinaryKey( - context, - ssFlags, - &kc, - appSecretID, - binaryCred->id, - binaryCred->idLen, - binaryCred->data, - binaryCred->dataLen, - NULL, - &bytesRequired, - ext); + context, + ssFlags, + &kc, + appSecretID, + binaryCred->id, + binaryCred->idLen, + binaryCred->data, + binaryCred->dataLen, + NULL, + &bytesRequired, + ext); if ((rcode != NSSCS_SUCCESS) && (sharedSecretID != NULL)) { // try shared if set rcode = miCASAReadBinaryKey( - context, - ssFlags, - &kc, - sharedSecretID, - binaryCred->id, - binaryCred->idLen, - binaryCred->data, - binaryCred->dataLen, - NULL, - &bytesRequired, - ext); + context, + ssFlags, + &kc, + sharedSecretID, + binaryCred->id, + binaryCred->idLen, + binaryCred->data, + binaryCred->dataLen, + NULL, + &bytesRequired, + ext); } miCASACloseSecretStoreCache(context, ssFlags, NULL); return rcode; } - */ // create a SHS Handle secretHandle = miCASA_CreateSHSHandle(); @@ -2905,6 +2902,7 @@ miCASASetCredential SSCS_BASIC_CREDENTIAL *basicCred; SSCS_BINARY_CREDENTIAL *binaryCred; + // check params if ((appSecretID == NULL) || (credential == NULL)) { @@ -2927,7 +2925,7 @@ miCASASetCredential sscs_Utf8Strcpy(kc.keychainID, SSCS_SESSION_KEY_CHAIN_ID); kc.len = SSCS_S_KC_ID_CHARS; -/* + if (credentialType == SSCS_CRED_TYPE_BINARY_F) { binaryCred = (SSCS_BINARY_CREDENTIAL *)credential; @@ -2937,23 +2935,23 @@ miCASASetCredential // set apps binary key rcode = miCASAWriteBinaryKey( - context, - ssFlags, - &kc, - appSecretID, - binaryCred->id, - binaryCred->idLen, - binaryCred->data, - binaryCred->dataLen, - NULL, - ext); + context, + ssFlags, + &kc, + appSecretID, + binaryCred->id, + binaryCred->idLen, + binaryCred->data, + binaryCred->dataLen, + NULL, + ext); miCASACloseSecretStoreCache(context, ssFlags, NULL); return rcode; } else -*/ + basicCred = (SSCS_BASIC_CREDENTIAL *)credential; diff --git a/c_test/c_sample/cSample.c b/c_test/c_sample/cSample.c index ab9627fd..6f3b7010 100644 --- a/c_test/c_sample/cSample.c +++ b/c_test/c_sample/cSample.c @@ -30,8 +30,8 @@ you may find current contact information at www.novell.com. #include #include -#include #include +#include /////////////////////////////////////////////////////////////////////// @@ -81,6 +81,7 @@ void AddSecret() sscs_Utf8Strcpy(credential.password, inputPassword); credential.pwordLen = sscs_Utf8Strlen(inputPassword) + 1; + printf("SAMPLE: Calling miCASASetCredential\r\n"); // sets the credential for this app rcode = miCASASetCredential( 0, @@ -104,6 +105,7 @@ void DisplaySecret() int rcode = 0; char inputID[20]; + int32_t credtype = SSCS_CRED_TYPE_BASIC_F; SSCS_BASIC_CREDENTIAL credential = {0}; SSCS_SECRET_ID_T appSecretId = {0}; @@ -127,7 +129,7 @@ void DisplaySecret() 0, &appSecretId, NULL, - SSCS_CRED_TYPE_BASIC_F, + &credtype, //SSCS_CRED_TYPE_BASIC_F, &credential, NULL ); @@ -193,6 +195,7 @@ void RunTest() { SSCS_BASIC_CREDENTIAL credential = {0}; SSCS_SECRET_ID_T appSecretId = {0}; + int32_t credtype = SSCS_CRED_TYPE_BASIC_F; int rcode = 0; int iFlags = 0; @@ -286,7 +289,7 @@ void RunTest() iFlags, &appSecretId, NULL, - SSCS_CRED_TYPE_BASIC_F, + &credtype, //SSCS_CRED_TYPE_BASIC_F, &credential, NULL ); @@ -328,7 +331,7 @@ void RunTest() iFlags, &appSecretId, NULL, - SSCS_CRED_TYPE_BASIC_F, + &credtype, //SSCS_CRED_TYPE_BASIC_F, &credential, NULL ); diff --git a/include/micasa_mgmd.h b/include/micasa_mgmd.h index 7ff3f96e..84bc1e0d 100644 --- a/include/micasa_mgmd.h +++ b/include/micasa_mgmd.h @@ -381,7 +381,7 @@ typedef struct _sscs_ext_t uint32_t ssFlags, // IN SSCS_SECRET_ID_T * appSecretID, // IN SSCS_SECRET_ID_T * sharedSecretID, // Optional IN - int32_t * credentialType, // IN/OUT + uint32_t * credentialType, // IN/OUT void * credential, // OUT SSCS_EXT_T * ext // Reserved ); @@ -392,7 +392,7 @@ typedef struct _sscs_ext_t uint32_t ssFlags, // IN SSCS_SECRET_ID_T * appSecretID, // IN SSCS_SECRET_ID_T * sharedSecretID, // Optional IN - int32_t credentialType, // IN + uint32_t credentialType, // IN void * credential, // IN SSCS_EXT_T * ext // Reserved );