summaryrefslogtreecommitdiffstats
path: root/service_passwords.c
diff options
context:
space:
mode:
Diffstat (limited to 'service_passwords.c')
-rw-r--r--service_passwords.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/service_passwords.c b/service_passwords.c
index a43dbf6..d150e45 100644
--- a/service_passwords.c
+++ b/service_passwords.c
@@ -368,13 +368,16 @@ static Slapi_Entry *entry_dup_new_dn(Slapi_Entry *entry, char *dn)
static Slapi_Entry *prepend_service_prefix(Slapi_Entry *entry, char *service)
{
Slapi_Entry *new_entry = NULL;
- char rdn[255] = {0};
+ Slapi_RDN *rdn = NULL;
char *old_dn = NULL;
char *new_dn = NULL;
old_dn = slapi_entry_get_dn(entry);
- snprintf(rdn, 254, "cn=%s", service);
- new_dn = slapi_dn_plus_rdn(old_dn, rdn);
+
+ rdn = slapi_rdn_new();
+ slapi_rdn_add(rdn, "cn", service);
+ new_dn = slapi_dn_plus_rdn(old_dn, slapi_rdn_get_rdn(rdn));
+ slapi_rdn_free(&rdn);
new_entry = entry_dup_new_dn(entry, new_dn);
slapi_ch_free_string(&new_dn);