summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2019-05-18 11:25:01 -0700
committerKarolin Seeger <kseeger@samba.org>2019-06-13 10:22:08 +0000
commit0dfd513f9883f2360c0ee13ce1bed3d80c5e7361 (patch)
treeb7c1c11674009b1d7269790d6158b4fa4621e5e1
parent19583f44bb44dddc61ba486cec0b2cc1eb801e33 (diff)
downloadsamba-0dfd513f9883f2360c0ee13ce1bed3d80c5e7361.tar.gz
s3: winbind: Convert idmap to use file_ploadv_send().
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13964 Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org> (cherry picked from commit 449d49946b295f574e1fed83b5a5ffbf1c1b1e30)
-rw-r--r--source3/winbindd/idmap_script.c53
1 files changed, 43 insertions, 10 deletions
diff --git a/source3/winbindd/idmap_script.c b/source3/winbindd/idmap_script.c
index 5f4f96cd768..4cb02efc151 100644
--- a/source3/winbindd/idmap_script.c
+++ b/source3/winbindd/idmap_script.c
@@ -63,7 +63,7 @@ struct idmap_script_context {
*/
struct idmap_script_xid2sid_state {
- const char *syscmd;
+ char **argl;
size_t idx;
uint8_t *out;
};
@@ -101,13 +101,32 @@ static struct tevent_req *idmap_script_xid2sid_send(
return tevent_req_post(req, ev);
}
- state->syscmd = talloc_asprintf(state, "%s IDTOSID %cID %lu", script, key,
- (unsigned long)xid.id);
- if (tevent_req_nomem(state->syscmd, req)) {
+ state->argl = talloc_zero_array(state,
+ char *,
+ 5);
+ if (tevent_req_nomem(state->argl, req)) {
return tevent_req_post(req, ev);
}
+ state->argl[0] = talloc_strdup(state->argl, script);
+ if (tevent_req_nomem(state->argl[0], req)) {
+ return tevent_req_post(req, ev);
+ }
+ state->argl[1] = talloc_strdup(state->argl, "IDTOSID");
+ if (tevent_req_nomem(state->argl[1], req)) {
+ return tevent_req_post(req, ev);
+ }
+ state->argl[2] = talloc_asprintf(state->argl, "%cID", key);
+ if (tevent_req_nomem(state->argl[2], req)) {
+ return tevent_req_post(req, ev);
+ }
+ state->argl[3] = talloc_asprintf(state->argl, "%lu",
+ (unsigned long)xid.id);
+ if (tevent_req_nomem(state->argl[3], req)) {
+ return tevent_req_post(req, ev);
+ }
+ state->argl[4] = NULL;
- subreq = file_pload_send(state, ev, state->syscmd, 1024);
+ subreq = file_ploadv_send(state, ev, state->argl, 1024);
if (tevent_req_nomem(subreq, req)) {
return tevent_req_post(req, ev);
}
@@ -320,7 +339,7 @@ static NTSTATUS idmap_script_unixids_to_sids(struct idmap_domain *dom,
}
struct idmap_script_sid2xid_state {
- const char *syscmd;
+ char **argl;
size_t idx;
uint8_t *out;
};
@@ -344,13 +363,27 @@ static struct tevent_req *idmap_script_sid2xid_send(
dom_sid_string_buf(sid, sidbuf, sizeof(sidbuf));
- state->syscmd = talloc_asprintf(state, "%s SIDTOID %s",
- script, sidbuf);
- if (tevent_req_nomem(state->syscmd, req)) {
+ state->argl = talloc_zero_array(state,
+ char *,
+ 4);
+ if (tevent_req_nomem(state->argl, req)) {
+ return tevent_req_post(req, ev);
+ }
+ state->argl[0] = talloc_strdup(state->argl, script);
+ if (tevent_req_nomem(state->argl[0], req)) {
+ return tevent_req_post(req, ev);
+ }
+ state->argl[1] = talloc_strdup(state->argl, "SIDTOID");
+ if (tevent_req_nomem(state->argl[1], req)) {
+ return tevent_req_post(req, ev);
+ }
+ state->argl[2] = talloc_asprintf(state->argl, "%s", sidbuf);
+ if (tevent_req_nomem(state->argl[2], req)) {
return tevent_req_post(req, ev);
}
+ state->argl[3] = NULL;
- subreq = file_pload_send(state, ev, state->syscmd, 1024);
+ subreq = file_ploadv_send(state, ev, state->argl, 1024);
if (tevent_req_nomem(subreq, req)) {
return tevent_req_post(req, ev);
}