summaryrefslogtreecommitdiff
path: root/source4/ntptr
diff options
context:
space:
mode:
authorSimo Sorce <idra@samba.org>2005-08-18 15:02:01 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:33:32 -0500
commit3e4c4cff2177af33efdb15f03a1bbcb639505cee (patch)
tree852723e443ca41ef6b1d91dd3c11224eddebbd48 /source4/ntptr
parenta8d51f87620a688a286603766cbb7edb2b7c6e60 (diff)
downloadsamba-3e4c4cff2177af33efdb15f03a1bbcb639505cee.tar.gz
samba-3e4c4cff2177af33efdb15f03a1bbcb639505cee.tar.bz2
samba-3e4c4cff2177af33efdb15f03a1bbcb639505cee.zip
r9391: Convert all the code to use struct ldb_dn to ohandle ldap like distinguished names
Provide more functions to handle DNs in this form (This used to be commit 692e35b7797e39533dd2a1c4b63d9da30f1eb5ba)
Diffstat (limited to 'source4/ntptr')
-rw-r--r--source4/ntptr/simple_ldb/ntptr_simple_ldb.c37
1 files changed, 23 insertions, 14 deletions
diff --git a/source4/ntptr/simple_ldb/ntptr_simple_ldb.c b/source4/ntptr/simple_ldb/ntptr_simple_ldb.c
index bd3443e199..c0ae2e078d 100644
--- a/source4/ntptr/simple_ldb/ntptr_simple_ldb.c
+++ b/source4/ntptr/simple_ldb/ntptr_simple_ldb.c
@@ -45,14 +45,14 @@ static struct ldb_context *sptr_db_connect(TALLOC_CTX *mem_ctx)
static int sptr_db_search(struct ldb_context *ldb,
TALLOC_CTX *mem_ctx,
- const char *basedn,
+ const struct ldb_dn *basedn,
struct ldb_message ***res,
const char * const *attrs,
const char *format, ...) PRINTF_ATTRIBUTE(6,7);
static int sptr_db_search(struct ldb_context *ldb,
TALLOC_CTX *mem_ctx,
- const char *basedn,
+ const struct ldb_dn *basedn,
struct ldb_message ***res,
const char * const *attrs,
const char *format, ...)
@@ -222,8 +222,9 @@ static WERROR sptr_EnumPrintServerForms(struct ntptr_GenericHandle *server, TALL
int i;
union spoolss_FormInfo *info;
- count = sptr_db_search(sptr_db, mem_ctx, "CN=Forms,CN=PrintServer", &msgs, NULL,
- "(&(objectClass=form))");
+ count = sptr_db_search(sptr_db, mem_ctx,
+ ldb_dn_explode(mem_ctx, "CN=Forms,CN=PrintServer"),
+ &msgs, NULL, "(&(objectClass=form))");
if (count == 0) return WERR_OK;
if (count < 0) return WERR_GENERAL_FAILURE;
@@ -276,8 +277,9 @@ static WERROR sptr_AddPrintServerForm(struct ntptr_GenericHandle *server, TALLOC
if (!r->in.info.info1) {
return WERR_FOOBAR;
}
- count = sptr_db_search(sptr_db, mem_ctx, "CN=Forms,CN=PrintServer", &msgs, attrs,
- "(&(form-name=%s)(objectClass=form))",
+ count = sptr_db_search(sptr_db, mem_ctx,
+ ldb_dn_explode(mem_ctx, "CN=Forms,CN=PrintServer"),
+ &msgs, attrs, "(&(form-name=%s)(objectClass=form))",
r->in.info.info1->form_name);
if (count == 1) return WERR_FOOBAR;
@@ -292,8 +294,9 @@ static WERROR sptr_AddPrintServerForm(struct ntptr_GenericHandle *server, TALLOC
W_ERROR_HAVE_NO_MEMORY(msg);
/* add core elements to the ldb_message for the Form */
- msg->dn = talloc_asprintf(msg, "form-name=%s,CN=Forms,CN=PrintServer",
- r->in.info.info1->form_name);
+ msg->dn = ldb_dn_build_child(msg,
+ "form-name", r->in.info.info1->form_name,
+ ldb_dn_explode(msg, "CN=Forms,CN=PrintServer"));
SET_STRING(sptr_db, msg, "objectClass", "form");
SET_UINT(sptr_db, msg, "flags", r->in.info.info1->flags);
@@ -341,8 +344,9 @@ static WERROR sptr_SetPrintServerForm(struct ntptr_GenericHandle *server, TALLOC
return WERR_FOOBAR;
}
- count = sptr_db_search(sptr_db, mem_ctx, "CN=Forms,CN=PrintServer", &msgs, attrs,
- "(&(form-name=%s)(objectClass=form))",
+ count = sptr_db_search(sptr_db, mem_ctx,
+ ldb_dn_explode(mem_ctx, "CN=Forms,CN=PrintServer"),
+ &msgs, attrs, "(&(form-name=%s)(objectClass=form))",
r->in.info.info1->form_name);
if (count == 0) return WERR_FOOBAR;
@@ -403,8 +407,9 @@ static WERROR sptr_DeletePrintServerForm(struct ntptr_GenericHandle *server, TAL
return WERR_FOOBAR;
}
- count = sptr_db_search(sptr_db, mem_ctx, "CN=Forms,CN=PrintServer", &msgs, attrs,
- "(&(form-name=%s)(objectclass=form))",
+ count = sptr_db_search(sptr_db, mem_ctx,
+ ldb_dn_explode(mem_ctx, "CN=Forms,CN=PrintServer"),
+ &msgs, attrs, "(&(form-name=%s)(objectclass=form))",
r->in.form_name);
if (count == 0) return WERR_FOOBAR;
@@ -695,7 +700,7 @@ static WERROR sptr_GetPrinterForm(struct ntptr_GenericHandle *printer, TALLOC_CT
{
struct ldb_context *sptr_db = talloc_get_type(printer->ntptr->private_data, struct ldb_context);
struct ldb_message **msgs;
- const char *base_dn;
+ const struct ldb_dn *base_dn;
int count;
union spoolss_FormInfo *info;
@@ -705,7 +710,11 @@ static WERROR sptr_GetPrinterForm(struct ntptr_GenericHandle *printer, TALLOC_CT
* }
*/
- base_dn = talloc_asprintf(mem_ctx, "CN=Forms,CN=%s,CN=Printers", printer->object_name);
+ base_dn = ldb_dn_compose_string_dn(mem_ctx,
+ "CN=Forms",
+ ldb_dn_build_child(mem_ctx,
+ "CN", printer->object_name,
+ ldb_dn_explode(mem_ctx, "CN=Printers")));
W_ERROR_HAVE_NO_MEMORY(base_dn);
count = sptr_db_search(sptr_db, mem_ctx, base_dn, &msgs, NULL,