diff options
Diffstat (limited to 'pki/base/tps/src')
-rw-r--r-- | pki/base/tps/src/modules/tokendb/mod_tokendb.cpp | 13 | ||||
-rw-r--r-- | pki/base/tps/src/tus/tus_db.c | 15 |
2 files changed, 20 insertions, 8 deletions
diff --git a/pki/base/tps/src/modules/tokendb/mod_tokendb.cpp b/pki/base/tps/src/modules/tokendb/mod_tokendb.cpp index a67eee22a..3e411c99a 100644 --- a/pki/base/tps/src/modules/tokendb/mod_tokendb.cpp +++ b/pki/base/tps/src/modules/tokendb/mod_tokendb.cpp @@ -6644,7 +6644,8 @@ mod_tokendb_handler( request_rec *rq ) } PR_snprintf((char *)userCN, 256, - "%s %s", firstName, lastName); + "%s%s%s", ((firstName != NULL && PL_strlen(firstName) > 0)? firstName: ""), + ((firstName != NULL && PL_strlen(firstName) > 0)? " ": ""), lastName); status = update_user_db_entry(userid, uid, lastName, firstName, userCN, userCert); @@ -6993,7 +6994,7 @@ mod_tokendb_handler( request_rec *rq ) opAgent = get_post_field(post, "opAgent", SHORT_LEN); userCert = get_encoded_post_field(post, "cert", HUGE_STRING_LEN); - if ((PL_strlen(uid) == 0) || (PL_strlen(firstName) == 0) || (PL_strlen(lastName) == 0)) { + if ((PL_strlen(uid) == 0) || (PL_strlen(lastName) == 0)) { error_out("Bad input to op=addUser", "Bad input to op=addUser"); do_free(uid); do_free(firstName); @@ -7008,11 +7009,13 @@ mod_tokendb_handler( request_rec *rq ) return OK; } - PR_snprintf((char *)userCN, 256, - "%s %s", firstName, lastName); + PR_snprintf((char *)userCN, 256, + "%s%s%s", ((firstName != NULL && PL_strlen(firstName) > 0)? firstName: ""), + ((firstName != NULL && PL_strlen(firstName) > 0)? " ": ""), lastName); PR_snprintf(oString, 512, "uid;;%s", uid); - PR_snprintf(pString, 512, "givenName;;%s+sn;;%s", firstName, lastName); + PR_snprintf(pString, 512, "givenName;;%s+sn;;%s", + ((firstName != NULL && PL_strlen(firstName) > 0)? firstName: ""), lastName); /* to meet STIG requirements, every user in ldap must have a password, even if that password is never used */ char *pwd = generatePassword(pwLength); diff --git a/pki/base/tps/src/tus/tus_db.c b/pki/base/tps/src/tus/tus_db.c index 286a7edf5..30c59327e 100644 --- a/pki/base/tps/src/tus/tus_db.c +++ b/pki/base/tps/src/tus/tus_db.c @@ -1324,7 +1324,7 @@ TPS_PUBLIC int update_user_db_entry(const char *agentid, char *uid, char *lastNa a03.mod_op = LDAP_MOD_REPLACE; a03.mod_type = USER_GIVENNAME; - a03.mod_values = givenName_values; + a03.mod_values = ((firstName != NULL && PL_strlen(firstName) > 0)? givenName_values: NULL); mods[0] = &a01; mods[1] = &a02; @@ -2283,7 +2283,9 @@ TPS_PUBLIC int add_user_db_entry(const char *agentid, char *userid, char *userPa mods[2] = &a03; mods[3] = &a04; mods[4] = &a05; - mods[5] = &a06; + if (givenName != NULL && PL_strlen(givenName) > 0) { + mods[5] = &a06; + } // now handle certificate certlen = strlen(userCert); @@ -2310,8 +2312,15 @@ TPS_PUBLIC int add_user_db_entry(const char *agentid, char *userid, char *userPa a07.mod_type = USER_CERT; a07.mod_bvalues = userCert_values; - mods[6] = &a07; + if (givenName != NULL && PL_strlen(givenName) > 0) { + mods[6] = &a07; + } else { + mods[5] = &a07; + } } else { + if (givenName == NULL || PL_strlen(givenName) == 0) { + mods[5] = NULL; + } mods[6] = NULL; } |