diff options
Diffstat (limited to 'pki')
-rw-r--r-- | pki/base/tps/src/engine/RA.cpp | 2 | ||||
-rw-r--r-- | pki/base/tps/src/include/tus/tus_db.h | 2 | ||||
-rw-r--r-- | pki/base/tps/src/tus/tus_db.c | 30 |
3 files changed, 30 insertions, 4 deletions
diff --git a/pki/base/tps/src/engine/RA.cpp b/pki/base/tps/src/engine/RA.cpp index 19c445f9d..7b8e7adcc 100644 --- a/pki/base/tps/src/engine/RA.cpp +++ b/pki/base/tps/src/engine/RA.cpp @@ -3151,7 +3151,7 @@ int RA::tdb_update(const char *userid, char* cuid, char* applet_version, char *k /* need code to modify things such as applet version ...*/ /* ldap modify code to follow...*/ rc = update_tus_db_entry ("~tps", cuid, userid, key_info, state, - applet_version, reason); + applet_version, reason, token_type); } loser: if (ldapResult != NULL) { diff --git a/pki/base/tps/src/include/tus/tus_db.h b/pki/base/tps/src/include/tus/tus_db.h index 078b556b0..b1c7ebe86 100644 --- a/pki/base/tps/src/include/tus/tus_db.h +++ b/pki/base/tps/src/include/tus/tus_db.h @@ -178,7 +178,7 @@ TPS_PUBLIC char *get_token_reason(LDAPMessage *e); TPS_PUBLIC int update_tus_db_entry (const char *agentid, char *cn, const char *uid, char *keyInfo, const char *status, - char *applet_version, const char *reason); + char *applet_version, const char *reason, const char* token_type); TPS_PUBLIC int update_tus_db_entry_with_mods (const char *agentid, const char *cn, LDAPMod **mods); TPS_PUBLIC int check_and_modify_tus_db_entry (char *userid, char *cn, char *check, LDAPMod **mods); TPS_PUBLIC int modify_tus_db_entry (char *userid, char *cn, LDAPMod **mods); diff --git a/pki/base/tps/src/tus/tus_db.c b/pki/base/tps/src/tus/tus_db.c index 30c59327e..377aaa8a2 100644 --- a/pki/base/tps/src/tus/tus_db.c +++ b/pki/base/tps/src/tus/tus_db.c @@ -1385,10 +1385,12 @@ TPS_PUBLIC int update_tus_db_entry (const char *agentid, char *cn, const char *u if (PR_snprintf(dn, 255, "cn=%s,%s", cn, baseDN) < 0) return -1; - if (keyInfo == NULL) + if (keyInfo == NULL && token_type == NULL) mods = allocate_modifications(5); - else + else if (keyInfo == NULL || token_type == NULL) mods = allocate_modifications(6); + else + mods = allocate_modifications(7); if (mods == NULL) return -1; @@ -1502,6 +1504,30 @@ TPS_PUBLIC int update_tus_db_entry (const char *agentid, char *cn, const char *u mods[k]->mod_values = v; k++; } + + /* for token_type */ + if (token_type != NULL) { + if (token_type != NULL && PL_strlen(token_type) > 0) + len = PL_strlen(token_type); + else + len = 0; + if ((v = allocate_values(1, len+1)) == NULL) { + if( mods != NULL ) { + free_modifications( mods, 0 ); + mods = NULL; + } + return -1; + } + mods[k]->mod_op = LDAP_MOD_REPLACE; + mods[k]->mod_type = TOKEN_TYPE; + if (len > 0) + PL_strcpy(v[0], token_type); + else + v[0] = ""; + mods[k]->mod_values = v; + k++; + } + for (tries = 0; tries < MAX_RETRIES; tries++) { if ((rc = ldap_modify_ext_s(ld, dn, mods, NULL, NULL)) == LDAP_SUCCESS) { break; |