1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-11 05:18:09 +03:00

Add tldap_search_va

This commit is contained in:
Volker Lendecke 2009-06-28 14:41:11 +02:00
parent ae5e1d9841
commit c594d21fda
2 changed files with 24 additions and 8 deletions

View File

@ -45,6 +45,10 @@ bool tldap_make_mod_fmt(struct tldap_message *existing, TALLOC_CTX *mem_ctx,
const char *tldap_errstr(TALLOC_CTX *mem_ctx, struct tldap_context *ld,
int rc);
int tldap_search_va(struct tldap_context *ld, const char *base, int scope,
const char *attrs[], int num_attrs, int attrsonly,
TALLOC_CTX *mem_ctx, struct tldap_message ***res,
const char *fmt, va_list ap);
int tldap_search_fmt(struct tldap_context *ld, const char *base, int scope,
const char *attrs[], int num_attrs, int attrsonly,
TALLOC_CTX *mem_ctx, struct tldap_message ***res,

View File

@ -325,22 +325,19 @@ const char *tldap_errstr(TALLOC_CTX *mem_ctx, struct tldap_context *ld, int rc)
return res;
}
int tldap_search_fmt(struct tldap_context *ld, const char *base, int scope,
const char *attrs[], int num_attrs, int attrsonly,
TALLOC_CTX *mem_ctx, struct tldap_message ***res,
const char *fmt, ...)
int tldap_search_va(struct tldap_context *ld, const char *base, int scope,
const char *attrs[], int num_attrs, int attrsonly,
TALLOC_CTX *mem_ctx, struct tldap_message ***res,
const char *fmt, va_list ap)
{
va_list ap;
char *filter;
int ret;
va_start(ap, fmt);
filter = talloc_vasprintf(talloc_tos(), fmt, ap);
va_end(ap);
if (filter == NULL) {
return TLDAP_NO_MEMORY;
}
ret = tldap_search(ld, base, scope, filter,
attrs, num_attrs, attrsonly,
NULL /*sctrls*/, 0, NULL /*cctrls*/, 0,
@ -350,6 +347,21 @@ int tldap_search_fmt(struct tldap_context *ld, const char *base, int scope,
return ret;
}
int tldap_search_fmt(struct tldap_context *ld, const char *base, int scope,
const char *attrs[], int num_attrs, int attrsonly,
TALLOC_CTX *mem_ctx, struct tldap_message ***res,
const char *fmt, ...)
{
va_list ap;
int ret;
va_start(ap, fmt);
ret = tldap_search_va(ld, base, scope, attrs, num_attrs, attrsonly,
mem_ctx, res, fmt, ap);
va_end(ap);
return ret;
}
bool tldap_pull_uint64(struct tldap_message *msg, const char *attr,
uint64_t *presult)
{