summaryrefslogtreecommitdiff
path: root/source3/utils
diff options
context:
space:
mode:
authorJim McDonough <jmcd@samba.org>2006-03-10 14:28:51 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 11:15:14 -0500
commita5eda886778fe22b15f973236b3b133e78308148 (patch)
treef32e437311623dd17f2afef3e470345aecc8dfec /source3/utils
parentc0d4100517bc50d7f81c3e5816a08c1a8284efa4 (diff)
downloadsamba-a5eda886778fe22b15f973236b3b133e78308148.tar.gz
samba-a5eda886778fe22b15f973236b3b133e78308148.tar.bz2
samba-a5eda886778fe22b15f973236b3b133e78308148.zip
r14156: Fix coverity #114: free storage alloc'ed by sstring_sub()
(This used to be commit 655fb66b289bdd19c4432eea00fac935184f25c9)
Diffstat (limited to 'source3/utils')
-rw-r--r--source3/utils/net_rpc_samsync.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/source3/utils/net_rpc_samsync.c b/source3/utils/net_rpc_samsync.c
index 691e28af8e..9b001e02f3 100644
--- a/source3/utils/net_rpc_samsync.c
+++ b/source3/utils/net_rpc_samsync.c
@@ -1455,7 +1455,7 @@ static NTSTATUS fetch_account_info_to_ldif(SAM_DELTA_CTR *delta, GROUPMAP *group
fstring hex_nt_passwd, hex_lm_passwd;
fstring description, fullname, sambaSID;
uchar lm_passwd[16], nt_passwd[16];
- char *flags;
+ char *flags, *user_rdn;
const char* nopasswd = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
static uchar zero_buf[16];
uint32 rid = 0, group_rid = 0, gidNumber = 0;
@@ -1551,10 +1551,11 @@ static NTSTATUS fetch_account_info_to_ldif(SAM_DELTA_CTR *delta, GROUPMAP *group
NEW_PW_FORMAT_SPACE_PADDED_LEN);
/* Add the user to the temporary add ldif file */
- fprintf(add_fd, "# %s, %s, %s\n", username,
- sstring_sub(lp_ldap_user_suffix(), '=', ','), suffix);
- fprintf(add_fd, "dn: uid=%s,ou=%s,%s\n", username,
- sstring_sub(lp_ldap_user_suffix(), '=', ','), suffix);
+ /* this isn't quite right...we can't assume there's just OU=. jmcd */
+ user_rdn = sstring_sub(lp_ldap_user_suffix(), '=', ',');
+ fprintf(add_fd, "# %s, %s, %s\n", username, user_rdn, suffix);
+ fprintf(add_fd, "dn: uid=%s,ou=%s,%s\n", username, user_rdn, suffix);
+ SAFE_FREE(user_rdn);
fprintf(add_fd, "ObjectClass: top\n");
fprintf(add_fd, "objectClass: inetOrgPerson\n");
fprintf(add_fd, "objectClass: posixAccount\n");