summaryrefslogtreecommitdiffstats
path: root/source/utils
diff options
context:
space:
mode:
authorJim McDonough <jmcd@samba.org>2006-03-10 14:28:51 +0000
committerJim McDonough <jmcd@samba.org>2006-03-10 14:28:51 +0000
commit0908b5eb7ecbb4535988e1dabd2616061fbd564a (patch)
tree5c6c19e16e0c2034c8eaab1658c0693d77936f4f /source/utils
parenteca3b4b4819d3c1eef4cd2901e13d976a4c03290 (diff)
downloadsamba-0908b5eb7ecbb4535988e1dabd2616061fbd564a.tar.gz
samba-0908b5eb7ecbb4535988e1dabd2616061fbd564a.tar.xz
samba-0908b5eb7ecbb4535988e1dabd2616061fbd564a.zip
r14156: Fix coverity #114: free storage alloc'ed by sstring_sub()
Diffstat (limited to 'source/utils')
-rw-r--r--source/utils/net_rpc_samsync.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/source/utils/net_rpc_samsync.c b/source/utils/net_rpc_samsync.c
index 691e28af8eb..9b001e02f32 100644
--- a/source/utils/net_rpc_samsync.c
+++ b/source/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");