diff options
author | Volker Lendecke <vlendec@samba.org> | 2006-05-13 17:10:20 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 11:17:01 -0500 |
commit | f390936c5b77c74717c364f0685f5be914daad1b (patch) | |
tree | 313b565c5b3abddbbe1ac88518fd3a6581f68e7c | |
parent | c2e6ebe22c7a6b51f4142073fb37e55b7f2b7737 (diff) | |
download | samba-f390936c5b77c74717c364f0685f5be914daad1b.tar.gz samba-f390936c5b77c74717c364f0685f5be914daad1b.tar.bz2 samba-f390936c5b77c74717c364f0685f5be914daad1b.zip |
r15566: Fix Coverity bug # 284. The lp_ldap_xx_suffix function only return NULL if
talloc fails.
Volker
(This used to be commit 0ece5b32f97f162be0af2ea3354a597c56ed4373)
-rw-r--r-- | source3/utils/net_rpc_samsync.c | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/source3/utils/net_rpc_samsync.c b/source3/utils/net_rpc_samsync.c index b1807bb79b..d13d5b1cb3 100644 --- a/source3/utils/net_rpc_samsync.c +++ b/source3/utils/net_rpc_samsync.c @@ -1042,10 +1042,12 @@ static NTSTATUS populate_ldap_for_ldif(fstring sid, const char *suffix, const ch fflush(add_fd); user_suffix = lp_ldap_user_suffix(); + if (user_suffix == NULL) { + return NT_STATUS_NO_MEMORY; + } /* If it exists and is distinct from other containers, Write the Users entity */ - if (user_suffix && *user_suffix && - strcmp(user_suffix, suffix)) { + if (*user_suffix && strcmp(user_suffix, suffix)) { user_attr = sstring_sub(lp_ldap_user_suffix(), '=', ','); fprintf(add_fd, "# %s\n", user_suffix); fprintf(add_fd, "dn: %s\n", user_suffix); @@ -1057,10 +1059,12 @@ static NTSTATUS populate_ldap_for_ldif(fstring sid, const char *suffix, const ch group_suffix = lp_ldap_group_suffix(); + if (group_suffix == NULL) { + return NT_STATUS_NO_MEMORY; + } /* If it exists and is distinct from other containers, Write the Groups entity */ - if (group_suffix && *group_suffix && - strcmp(group_suffix, suffix)) { + if (*group_suffix && strcmp(group_suffix, suffix)) { group_attr = sstring_sub(lp_ldap_group_suffix(), '=', ','); fprintf(add_fd, "# %s\n", group_suffix); fprintf(add_fd, "dn: %s\n", group_suffix); @@ -1073,8 +1077,10 @@ static NTSTATUS populate_ldap_for_ldif(fstring sid, const char *suffix, const ch /* If it exists and is distinct from other containers, Write the Computers entity */ machine_suffix = lp_ldap_machine_suffix(); - if (machine_suffix && *machine_suffix && - strcmp(machine_suffix, user_suffix) && + if (machine_suffix == NULL) { + return NT_STATUS_NO_MEMORY; + } + if (*machine_suffix && strcmp(machine_suffix, user_suffix) && strcmp(machine_suffix, suffix)) { char *machine_ou = NULL; fprintf(add_fd, "# %s\n", machine_suffix); @@ -1092,7 +1098,10 @@ static NTSTATUS populate_ldap_for_ldif(fstring sid, const char *suffix, const ch /* If it exists and is distinct from other containers, Write the IdMap entity */ idmap_suffix = lp_ldap_idmap_suffix(); - if (idmap_suffix && *idmap_suffix && + if (idmap_suffix == NULL) { + return NT_STATUS_NO_MEMORY; + } + if (*idmap_suffix && strcmp(idmap_suffix, user_suffix) && strcmp(idmap_suffix, suffix)) { char *s; |