summaryrefslogtreecommitdiffstats
path: root/src/db/sysdb_ops.c
diff options
context:
space:
mode:
authorPavel Reichl <preichl@redhat.com>2014-07-11 15:21:59 +0100
committerJakub Hrozek <jhrozek@redhat.com>2014-09-05 11:34:50 +0200
commit61602026ed8c91efd166000562899670449f1b50 (patch)
tree0471bd109d97c06e8fed36ce20e65d17767add5b /src/db/sysdb_ops.c
parent2344d7f71dd80618a41745b0818b46895fa61b2c (diff)
downloadsssd-61602026ed8c91efd166000562899670449f1b50.tar.gz
sssd-61602026ed8c91efd166000562899670449f1b50.tar.xz
sssd-61602026ed8c91efd166000562899670449f1b50.zip
SYSDB: SSS_LDB_SEARCH - macro around ldb_search
This patch amends previous patch 5153e8b9793dea1e212ca08af0f77ea1d023cbb7. Macro SSS_LDB_SEARCH is used instead of using fuction sss_ldb_search as a wrapper around ldb_search which could lead to premature expansion of variadic parameters. Part of solution for: https://fedorahosted.org/sssd/ticket/1991 Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com>
Diffstat (limited to 'src/db/sysdb_ops.c')
-rw-r--r--src/db/sysdb_ops.c51
1 files changed, 0 insertions, 51 deletions
diff --git a/src/db/sysdb_ops.c b/src/db/sysdb_ops.c
index e32d79a70..8a7feaefe 100644
--- a/src/db/sysdb_ops.c
+++ b/src/db/sysdb_ops.c
@@ -74,57 +74,6 @@ static uint32_t get_attr_as_uint32(struct ldb_message *msg, const char *attr)
return l;
}
-
-/* Wrapper around ldb_search to ensure that if zero results are found then
- * ENOENT is returned
- */
-errno_t sss_ldb_search(struct ldb_context *ldb, TALLOC_CTX *mem_ctx,
- struct ldb_result **_result, struct ldb_dn *base,
- enum ldb_scope scope, const char * const *attrs,
- const char *exp_fmt, ...)
-{
- char *s;
- int lret;
- va_list ap;
- errno_t ret;
- TALLOC_CTX *tmp_ctx = NULL;
-
- if (exp_fmt != NULL) {
- tmp_ctx = talloc_new(NULL);
- if (tmp_ctx == NULL) {
- ret = ENOMEM;
- goto done;
- }
-
- va_start(ap, exp_fmt);
- s = talloc_vasprintf(tmp_ctx, exp_fmt, ap);
- va_end(ap);
-
- if (s == NULL) {
- DEBUG(SSSDBG_MINOR_FAILURE, "Failed to process filter.\n");
- ret = ENOMEM;
- goto done;
- }
- lret = ldb_search(ldb, mem_ctx, _result, base, scope, attrs, "%s", s);
- } else {
- lret = ldb_search(ldb, mem_ctx, _result, base, scope, attrs, NULL);
- }
-
- ret = sysdb_error_to_errno(lret);
- if (ret != EOK) {
- goto done;
- }
-
- if ((*_result)->count == 0) {
- ret = ENOENT;
- goto done;
- }
-
-done:
- talloc_free(tmp_ctx);
- return ret;
-}
-
/*
* The wrapper around ldb_modify that uses LDB_CONTROL_PERMISSIVE_MODIFY_OID
* so that on adds entries that already exist are skipped and similarly