summaryrefslogtreecommitdiffstats
path: root/daemons/ipa-slapi-plugins/ipa-modrdn
diff options
context:
space:
mode:
authorJakub Hrozek <jhrozek@redhat.com>2010-11-03 14:44:44 +0100
committerSimo Sorce <ssorce@redhat.com>2010-11-22 16:01:35 -0500
commit5da451876e76fa8bfc04a537d30c2d3c5ef84841 (patch)
tree4eae2286dbba4424b3d0f54888c6c51efca87ad3 /daemons/ipa-slapi-plugins/ipa-modrdn
parentb9f539ba19b40361265c7897a73a1f5757ed0e68 (diff)
downloadfreeipa-5da451876e76fa8bfc04a537d30c2d3c5ef84841.tar.gz
freeipa-5da451876e76fa8bfc04a537d30c2d3c5ef84841.tar.xz
freeipa-5da451876e76fa8bfc04a537d30c2d3c5ef84841.zip
Common include file for SLAPI plugin logging
Consolidate the common logging macros into common/util.h and use them in SLAPI plugins instead of calling slapi_log_error() directly. https://fedorahosted.org/freeipa/ticket/408 Signed-off-by: Simo Sorce <ssorce@redhat.com>
Diffstat (limited to 'daemons/ipa-slapi-plugins/ipa-modrdn')
-rw-r--r--daemons/ipa-slapi-plugins/ipa-modrdn/Makefile.am3
-rw-r--r--daemons/ipa-slapi-plugins/ipa-modrdn/ipa_modrdn.c41
2 files changed, 10 insertions, 34 deletions
diff --git a/daemons/ipa-slapi-plugins/ipa-modrdn/Makefile.am b/daemons/ipa-slapi-plugins/ipa-modrdn/Makefile.am
index 577062464..3b0ff6297 100644
--- a/daemons/ipa-slapi-plugins/ipa-modrdn/Makefile.am
+++ b/daemons/ipa-slapi-plugins/ipa-modrdn/Makefile.am
@@ -1,8 +1,11 @@
NULL =
+PLUGIN_COMMON_DIR=../common
+
INCLUDES = \
-I. \
-I$(srcdir) \
+ -I$(PLUGIN_COMMON_DIR) \
-I/usr/include/dirsrv \
-DPREFIX=\""$(prefix)"\" \
-DBINDIR=\""$(bindir)"\" \
diff --git a/daemons/ipa-slapi-plugins/ipa-modrdn/ipa_modrdn.c b/daemons/ipa-slapi-plugins/ipa-modrdn/ipa_modrdn.c
index 72e16e90c..1e094f1d0 100644
--- a/daemons/ipa-slapi-plugins/ipa-modrdn/ipa_modrdn.c
+++ b/daemons/ipa-slapi-plugins/ipa-modrdn/ipa_modrdn.c
@@ -44,40 +44,13 @@
#include "nspr.h"
#include "prclist.h"
-#define IPAMODRDN_PLUGIN_NAME "ipa-modrdn-plugin"
+#include "util.h"
+
+#define IPA_PLUGIN_NAME "ipa-modrdn-plugin"
#define IPAMODRDN_PLUGIN_VERSION 0x00010000
#define IPAMODRDN_DN "cn=IPA MODRDN,cn=plugins,cn=config" /* temporary */
-#define EOK 0
-#define EFAIL -1
-
-#ifndef discard_const
-#define discard_const(ptr) ((void *)((uintptr_t)(ptr)))
-#endif
-
-#define log_func discard_const(__func__)
-
-#define LOG(fmt, ...) \
- slapi_log_error(SLAPI_LOG_PLUGIN, \
- IPAMODRDN_PLUGIN_NAME, \
- fmt, ##__VA_ARGS__)
-
-#define LOG_CONFIG(fmt, ...) \
- slapi_log_error(SLAPI_LOG_CONFIG, \
- IPAMODRDN_PLUGIN_NAME, \
- fmt, ##__VA_ARGS__)
-
-#define LOG_FATAL(fmt, ...) \
- slapi_log_error(SLAPI_LOG_FATAL, log_func, \
- "[file %s, line %d]: " fmt, \
- __FILE__, __LINE__, ##__VA_ARGS__)
-
-#define LOG_TRACE(fmt, ...) \
- slapi_log_error(SLAPI_LOG_TRACE, log_func, fmt, ##__VA_ARGS__)
-
-#define LOG_OOM() LOG_FATAL("Out of Memory!\n")
-
/**
* IPA MODRDN config types
*/
@@ -701,7 +674,7 @@ ipamodrdn_change_attr(struct configEntry *cfgentry,
mods[0] = &mod;
mods[1] = 0;
- LOG("Setting %s to %s in entry (%s)\n", cfgentry->tattr, targetdn);
+ LOG("Setting %s to %s in entry (%s)\n", cfgentry->tattr, value, targetdn);
/* Perform the modify operation. */
slapi_modify_internal_set_pb(mod_pb, targetdn, mods,
@@ -785,12 +758,12 @@ static int ipamodrdn_post_op(Slapi_PBlock *pb)
}
if (slapi_entry_attr_find(e, cfgentry->sattr, &sattr) != 0) {
- LOG_TRACE("Source attr %s not found for %d\n",
+ LOG_TRACE("Source attr %s not found for %s\n",
cfgentry->sattr, dn);
continue;
}
if (slapi_entry_attr_find(e, cfgentry->tattr, &tattr) != 0) {
- LOG_TRACE("Target attr %s not found for %d\n",
+ LOG_TRACE("Target attr %s not found for %s\n",
cfgentry->tattr, dn);
} else {
Slapi_Value *val;
@@ -805,7 +778,7 @@ static int ipamodrdn_post_op(Slapi_PBlock *pb)
ret = ipamodrdn_change_attr(cfgentry, dn, strval);
if (ret != EOK) {
- LOG_FATAL("Failed to set target attr %s for %d\n",
+ LOG_FATAL("Failed to set target attr %s for %s\n",
cfgentry->tattr, dn);
}
}