diff options
author | Volker Lendecke <vl@samba.org> | 2009-06-06 21:06:33 +0200 |
---|---|---|
committer | Volker Lendecke <vl@samba.org> | 2009-06-20 18:54:06 +0200 |
commit | 63a70ba0ad306e39311db3145d85323276e02c02 (patch) | |
tree | 80d2477357b87cec984e3a4cba73a906ffc4ae53 /source3/lib | |
parent | 62eb817c06458070d090c1698e9c0a99914c6d78 (diff) | |
download | samba-63a70ba0ad306e39311db3145d85323276e02c02.tar.gz samba-63a70ba0ad306e39311db3145d85323276e02c02.tar.bz2 samba-63a70ba0ad306e39311db3145d85323276e02c02.zip |
Prepare control support
We will have arrays of controls passed to tldap.c. Follow a mantra from the
classic book "Thinking Forth" by Leo Brodie: Favor counts over terminators :-)
This makes the parameter lists to tldap pretty long, but everyone will have
wrapper routines anyway, see for example tldap_search_fmt. And the OpenLDAP
manpages call the non-_ext routines deprecated, probably for a reason.
Diffstat (limited to 'source3/lib')
-rw-r--r-- | source3/lib/tldap.c | 71 | ||||
-rw-r--r-- | source3/lib/tldap_util.c | 4 |
2 files changed, 46 insertions, 29 deletions
diff --git a/source3/lib/tldap.c b/source3/lib/tldap.c index b76e2033a6..8495161b65 100644 --- a/source3/lib/tldap.c +++ b/source3/lib/tldap.c @@ -735,8 +735,10 @@ struct tevent_req *tldap_sasl_bind_send(TALLOC_CTX *mem_ctx, const char *dn, const char *mechanism, DATA_BLOB *creds, - struct tldap_control **sctrls, - struct tldap_control **cctrls) + struct tldap_control *sctrls, + int num_sctrls, + struct tldap_control *cctrls, + int num_cctrls) { struct tevent_req *req, *subreq; struct tldap_req_state *state; @@ -830,8 +832,10 @@ int tldap_sasl_bind(struct tldap_context *ld, const char *dn, const char *mechanism, DATA_BLOB *creds, - struct tldap_control **sctrls, - struct tldap_control **cctrls) + struct tldap_control *sctrls, + int num_sctrls, + struct tldap_control *cctrls, + int num_cctrls) { TALLOC_CTX *frame = talloc_stackframe(); struct tevent_context *ev; @@ -845,7 +849,7 @@ int tldap_sasl_bind(struct tldap_context *ld, } req = tldap_sasl_bind_send(frame, ev, ld, dn, mechanism, creds, - sctrls, cctrls); + sctrls, num_sctrls, cctrls, num_cctrls); if (req == NULL) { result = TLDAP_NO_MEMORY; goto fail; @@ -878,8 +882,8 @@ struct tevent_req *tldap_simple_bind_send(TALLOC_CTX *mem_ctx, cred.data = (uint8_t *)""; cred.length = 0; } - return tldap_sasl_bind_send(mem_ctx, ev, ld, dn, NULL, &cred, NULL, - NULL); + return tldap_sasl_bind_send(mem_ctx, ev, ld, dn, NULL, &cred, NULL, 0, + NULL, 0); } int tldap_simple_bind_recv(struct tevent_req *req) @@ -899,7 +903,7 @@ int tldap_simple_bind(struct tldap_context *ld, const char *dn, cred.data = (uint8_t *)""; cred.length = 0; } - return tldap_sasl_bind(ld, dn, NULL, &cred, NULL, NULL); + return tldap_sasl_bind(ld, dn, NULL, &cred, NULL, 0, NULL, 0); } /*****************************************************************************/ @@ -1088,8 +1092,10 @@ struct tevent_req *tldap_search_send(TALLOC_CTX *mem_ctx, const char **attrs, int num_attrs, int attrsonly, - struct tldap_control **sctrls, - struct tldap_control **cctrls, + struct tldap_control *sctrls, + int num_sctrls, + struct tldap_control *cctrls, + int num_cctrls, int timelimit, int sizelimit, int deref) @@ -1256,7 +1262,8 @@ static void tldap_search_cb(struct tevent_req *req) int tldap_search(struct tldap_context *ld, const char *base, int scope, const char *filter, const char **attrs, int num_attrs, int attrsonly, - struct tldap_control **sctrls, struct tldap_control **cctrls, + struct tldap_control *sctrls, int num_sctrls, + struct tldap_control *cctrls, int num_cctrls, int timelimit, int sizelimit, int deref, TALLOC_CTX *mem_ctx, struct tldap_message ***entries, struct tldap_message ***refs) @@ -1278,8 +1285,8 @@ int tldap_search(struct tldap_context *ld, req = tldap_search_send(frame, ev, ld, base, scope, filter, attrs, num_attrs, attrsonly, - sctrls, cctrls, timelimit, - sizelimit, deref); + sctrls, num_sctrls, cctrls, num_cctrls, + timelimit, sizelimit, deref); if (req == NULL) { state.rc = TLDAP_NO_MEMORY; goto fail; @@ -1454,10 +1461,12 @@ struct tevent_req *tldap_add_send(TALLOC_CTX *mem_ctx, struct tevent_context *ev, struct tldap_context *ld, const char *dn, - int num_attributes, struct tldap_mod *attributes, - struct tldap_control **sctrls, - struct tldap_control **cctrls) + int num_attributes, + struct tldap_control *sctrls, + int num_sctrls, + struct tldap_control *cctrls, + int num_cctrls) { struct tevent_req *req, *subreq; struct tldap_req_state *state; @@ -1510,7 +1519,8 @@ int tldap_add_recv(struct tevent_req *req) int tldap_add(struct tldap_context *ld, const char *dn, int num_attributes, struct tldap_mod *attributes, - struct tldap_control **sctrls, struct tldap_control **cctrls) + struct tldap_control *sctrls, int num_sctrls, + struct tldap_control *cctrls, int num_cctrls) { TALLOC_CTX *frame = talloc_stackframe(); struct tevent_context *ev; @@ -1523,8 +1533,8 @@ int tldap_add(struct tldap_context *ld, const char *dn, goto fail; } - req = tldap_add_send(frame, ev, ld, dn, num_attributes, attributes, - sctrls, cctrls); + req = tldap_add_send(frame, ev, ld, dn, attributes, num_attributes, + sctrls, num_sctrls, cctrls, num_cctrls); if (req == NULL) { result = TLDAP_NO_MEMORY; goto fail; @@ -1549,8 +1559,10 @@ struct tevent_req *tldap_modify_send(TALLOC_CTX *mem_ctx, struct tldap_context *ld, const char *dn, int num_mods, struct tldap_mod *mods, - struct tldap_control **sctrls, - struct tldap_control **cctrls) + struct tldap_control *sctrls, + int num_sctrls, + struct tldap_control *cctrls, + int num_cctrls) { struct tevent_req *req, *subreq; struct tldap_req_state *state; @@ -1606,7 +1618,8 @@ int tldap_modify_recv(struct tevent_req *req) int tldap_modify(struct tldap_context *ld, const char *dn, int num_mods, struct tldap_mod *mods, - struct tldap_control **sctrls, struct tldap_control **cctrls) + struct tldap_control *sctrls, int num_sctrls, + struct tldap_control *cctrls, int num_cctrls) { TALLOC_CTX *frame = talloc_stackframe(); struct tevent_context *ev; @@ -1620,7 +1633,7 @@ int tldap_modify(struct tldap_context *ld, const char *dn, } req = tldap_modify_send(frame, ev, ld, dn, num_mods, mods, - sctrls, cctrls); + sctrls, num_sctrls, cctrls, num_cctrls); if (req == NULL) { result = TLDAP_NO_MEMORY; goto fail; @@ -1644,8 +1657,10 @@ struct tevent_req *tldap_delete_send(TALLOC_CTX *mem_ctx, struct tevent_context *ev, struct tldap_context *ld, const char *dn, - struct tldap_control **sctrls, - struct tldap_control **cctrls) + struct tldap_control *sctrls, + int num_sctrls, + struct tldap_control *cctrls, + int num_cctrls) { struct tevent_req *req, *subreq; struct tldap_req_state *state; @@ -1678,7 +1693,8 @@ int tldap_delete_recv(struct tevent_req *req) } int tldap_delete(struct tldap_context *ld, const char *dn, - struct tldap_control **sctrls, struct tldap_control **cctrls) + struct tldap_control *sctrls, int num_sctrls, + struct tldap_control *cctrls, int num_cctrls) { TALLOC_CTX *frame = talloc_stackframe(); struct tevent_context *ev; @@ -1691,7 +1707,8 @@ int tldap_delete(struct tldap_context *ld, const char *dn, goto fail; } - req = tldap_delete_send(frame, ev, ld, dn, sctrls, cctrls); + req = tldap_delete_send(frame, ev, ld, dn, sctrls, num_sctrls, + cctrls, num_cctrls); if (req == NULL) { result = TLDAP_NO_MEMORY; goto fail; diff --git a/source3/lib/tldap_util.c b/source3/lib/tldap_util.c index 042665f15f..3698264bd6 100644 --- a/source3/lib/tldap_util.c +++ b/source3/lib/tldap_util.c @@ -343,7 +343,7 @@ int tldap_search_fmt(struct tldap_context *ld, const char *base, int scope, } ret = tldap_search(ld, base, scope, filter, attrs, num_attrs, attrsonly, - NULL /*sctrls*/, NULL /*cctrls*/, + NULL /*sctrls*/, 0, NULL /*cctrls*/, 0, 0 /*timelimit*/, 0 /*sizelimit*/, 0 /*deref*/, mem_ctx, res, NULL); TALLOC_FREE(filter); @@ -404,7 +404,7 @@ struct tevent_req *tldap_fetch_rootdse_send(TALLOC_CTX *mem_ctx, subreq = tldap_search_send( mem_ctx, ev, ld, "", TLDAP_SCOPE_BASE, "(objectclass=*)", - attrs, ARRAY_SIZE(attrs), 0, NULL, NULL, 0, 0, 0); + attrs, ARRAY_SIZE(attrs), 0, NULL, 0, NULL, 0, 0, 0, 0); if (tevent_req_nomem(subreq, req)) { return tevent_req_post(req, ev); } |