Author: idra Date: 2005-12-11 10:09:32 +0000 (Sun, 11 Dec 2005) New Revision: 12180
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=12180 Log: The ber encoding of the control now seems correct but I am not yet able to get any results from w2k3 this time I do not get back any error (so it seems the parsing is ok) but we time out the connection after 60 second before any reply is received. Modified: branches/tmp/samba4_ldap_controls/source/lib/ldb/modules/sort.c branches/tmp/samba4_ldap_controls/source/lib/ldb/tools/ldbtest_controls.c Changeset: Modified: branches/tmp/samba4_ldap_controls/source/lib/ldb/modules/sort.c =================================================================== --- branches/tmp/samba4_ldap_controls/source/lib/ldb/modules/sort.c 2005-12-11 08:31:46 UTC (rev 12179) +++ branches/tmp/samba4_ldap_controls/source/lib/ldb/modules/sort.c 2005-12-11 10:09:32 UTC (rev 12180) @@ -59,7 +59,7 @@ { struct ldb_result *sort_result; struct ldb_control **saved_controls; - struct ldb_server_sort_control *sort_ctrl; + struct ldb_server_sort_control **sort_ctrls; struct ldb_sort_resp_control *sort_resp; int i, cnum, ret; @@ -79,8 +79,13 @@ } /* sort_ctrl = talloc_get_type(req->controls[i]->data, struct ldb_server_sort_control); */ - sort_ctrl = (struct ldb_server_sort_control *)req->controls[cnum]->data; + sort_ctrls = (struct ldb_server_sort_control **)req->controls[cnum]->data; + /* FIXME: we do not support more than one attribute for sorting right now */ + if (sort_ctrls[1] != NULL) { + return LDB_ERR_UNSUPPORTED_CRITICAL_EXTENSION; + } + /* save it locally and remove it from the list */ saved_controls = req->controls; for (i = 0; req->controls[i]; i++); @@ -109,9 +114,9 @@ /* SORT HERE */ sort_result = req->op.search.res; - sort_control = sort_ctrl; + sort_control = sort_ctrls[0]; ldbctx = module->ldb; - h = ldb_attrib_handler(module->ldb, sort_ctrl->attributeName); + h = ldb_attrib_handler(ldbctx, sort_control->attributeName); /* FIXME: I don't like to use a static structure like sort_control * we need to either: Modified: branches/tmp/samba4_ldap_controls/source/lib/ldb/tools/ldbtest_controls.c =================================================================== --- branches/tmp/samba4_ldap_controls/source/lib/ldb/tools/ldbtest_controls.c 2005-12-11 08:31:46 UTC (rev 12179) +++ branches/tmp/samba4_ldap_controls/source/lib/ldb/tools/ldbtest_controls.c 2005-12-11 10:09:32 UTC (rev 12180) @@ -73,7 +73,6 @@ ctrl = talloc_array(ldb, struct ldb_control *, 2); ctrl[0] = talloc(ldb, struct ldb_control); - ctrl[1] = NULL; ctrl[0]->oid = LDB_CONTROL_PAGED_RESULTS_OID; ctrl[0]->critical = True; paged_control = talloc(ctrl[0], struct ldb_paged_control); @@ -81,6 +80,7 @@ paged_control->cookie = NULL; paged_control->cookie_len = 0; ctrl[0]->data = paged_control; + ctrl[1] = NULL; req.operation = LDB_REQ_SEARCH; req.op.search.base = basedn; @@ -155,12 +155,12 @@ ctrl = talloc_array(ldb, struct ldb_control *, 2); ctrl[0] = talloc(ldb, struct ldb_control); - ctrl[1] = NULL; ctrl[0]->oid = LDB_CONTROL_EXTENDED_DN_OID; ctrl[0]->critical = True; extended_control = talloc(ctrl[0], struct ldb_extended_dn_control); extended_control->type = 0; ctrl[0]->data = extended_control; + ctrl[1] = NULL; req.operation = LDB_REQ_SEARCH; req.op.search.base = basedn; @@ -210,23 +210,25 @@ struct ldb_request req; struct ldb_result *result = NULL; struct ldb_control **ctrl; - struct ldb_server_sort_control *sort_control; + struct ldb_server_sort_control **sort_control; struct ldb_sort_resp_control *sort_result; ctrl = talloc_array(ldb, struct ldb_control *, 2); ctrl[0] = talloc(ldb, struct ldb_control); - ctrl[1] = NULL; ctrl[0]->oid = LDB_CONTROL_SERVER_SORT_OID; ctrl[0]->critical = True; - sort_control = talloc(ctrl[0], struct ldb_server_sort_control); + sort_control = talloc_array(ctrl[0], struct ldb_server_sort_control *, 2); + sort_control[0] = talloc(sort_control, struct ldb_server_sort_control); if (attrs) { - sort_control->attributeName = talloc_strdup(sort_control, attrs[0]); + sort_control[0]->attributeName = talloc_strdup(sort_control[0], attrs[0]); } else { - sort_control->attributeName = "distinguishedName"; + sort_control[0]->attributeName = "distinguishedName"; } - sort_control->orderingRule = NULL; - sort_control->reverse = True; + sort_control[0]->orderingRule = NULL; + sort_control[0]->reverse = True; + sort_control[1] = NULL; ctrl[0]->data = sort_control; + ctrl[1] = NULL; req.operation = LDB_REQ_SEARCH; req.op.search.base = basedn;