summaryrefslogtreecommitdiffstats
path: root/daemons/ipa-slapi-plugins
diff options
context:
space:
mode:
authorMartin Kosek <mkosek@redhat.com>2011-01-14 10:24:04 +0100
committerSimo Sorce <ssorce@redhat.com>2011-01-14 14:20:57 -0500
commitc94d20cfd8cc1bd8cd8152b19d6807b654286197 (patch)
tree963fb678ee96ef9403e1fa54d0d1d94bc4976193 /daemons/ipa-slapi-plugins
parenta6a91e5dbc96498ef33505e4bf96466590f0da42 (diff)
downloadfreeipa-c94d20cfd8cc1bd8cd8152b19d6807b654286197.tar.gz
freeipa-c94d20cfd8cc1bd8cd8152b19d6807b654286197.tar.xz
freeipa-c94d20cfd8cc1bd8cd8152b19d6807b654286197.zip
Unchecked return values in SLAPI plugins
Return values weren't checked in several cases which could have lead to unhandled errors. https://fedorahosted.org/freeipa/ticket/722
Diffstat (limited to 'daemons/ipa-slapi-plugins')
-rw-r--r--daemons/ipa-slapi-plugins/ipa-modrdn/ipa_modrdn.c4
-rw-r--r--daemons/ipa-slapi-plugins/ipa-uuid/ipa_uuid.c14
-rw-r--r--daemons/ipa-slapi-plugins/ipa-winsync/ipa-winsync-config.c4
3 files changed, 15 insertions, 7 deletions
diff --git a/daemons/ipa-slapi-plugins/ipa-modrdn/ipa_modrdn.c b/daemons/ipa-slapi-plugins/ipa-modrdn/ipa_modrdn.c
index 6049c0409..45a29a510 100644
--- a/daemons/ipa-slapi-plugins/ipa-modrdn/ipa_modrdn.c
+++ b/daemons/ipa-slapi-plugins/ipa-modrdn/ipa_modrdn.c
@@ -748,8 +748,8 @@ static int ipamodrdn_post_op(Slapi_PBlock *pb)
Slapi_Value *val;
const char *strval;
- slapi_attr_first_value(sattr, &val);
- if (!val) {
+ ret = slapi_attr_first_value(sattr, &val);
+ if (ret == -1 || !val) {
LOG_FATAL("Source attr %s is empty\n", cfgentry->sattr);
continue;
}
diff --git a/daemons/ipa-slapi-plugins/ipa-uuid/ipa_uuid.c b/daemons/ipa-slapi-plugins/ipa-uuid/ipa_uuid.c
index 073b73cb6..83aac77da 100644
--- a/daemons/ipa-slapi-plugins/ipa-uuid/ipa_uuid.c
+++ b/daemons/ipa-slapi-plugins/ipa-uuid/ipa_uuid.c
@@ -815,8 +815,16 @@ static int ipauuid_pre_op(Slapi_PBlock *pb, int modtype)
*/
Slapi_DN *tmp_dn = slapi_sdn_new_dn_byref(dn);
if (tmp_dn) {
- slapi_search_internal_get_entry(tmp_dn, NULL, &e, getPluginID());
+ ret = slapi_search_internal_get_entry(tmp_dn, NULL, &e, getPluginID());
slapi_sdn_free(&tmp_dn);
+
+ if (ret) {
+ LOG_FATAL("slapi_search_internal_get_entry failed!? Err %d\n",
+ ret);
+ ret = LDAP_OPERATIONS_ERROR;
+ goto done;
+ }
+
free_entry = true;
}
@@ -967,8 +975,8 @@ static int ipauuid_pre_op(Slapi_PBlock *pb, int modtype)
Slapi_Attr *sattr = NULL;
int e_numvals = 0;
- slapi_entry_attr_find(e, attr, &sattr);
- if (sattr) {
+ if ((!slapi_entry_attr_find(e, attr, &sattr)) &&
+ (NULL != sattr)) {
slapi_attr_get_numvalues(sattr, &e_numvals);
if (numvals >= e_numvals) {
generate = true;
diff --git a/daemons/ipa-slapi-plugins/ipa-winsync/ipa-winsync-config.c b/daemons/ipa-slapi-plugins/ipa-winsync/ipa-winsync-config.c
index 1293c4c75..a61cabb14 100644
--- a/daemons/ipa-slapi-plugins/ipa-winsync/ipa-winsync-config.c
+++ b/daemons/ipa-slapi-plugins/ipa-winsync/ipa-winsync-config.c
@@ -702,8 +702,8 @@ internal_find_entry_get_attr_val(const Slapi_DN *basedn, int scope,
if (entries && entries[0]) { /* found one */
if (svs) {
Slapi_Attr *attr = NULL;
- slapi_entry_attr_find(entries[0], attrname, &attr);
- if (attr) {
+ if (!slapi_entry_attr_find(entries[0], attrname, &attr) &&
+ (NULL != attr)) {
/* slapi_attr_get_valueset allocates svs - must be freed later */
slapi_attr_get_valueset(attr, svs);
}