[SCM] Samba Shared Repository - branch master updated - release-4-0-0alpha8-1311-g0cae043

Volker Lendecke vlendec at samba.org
Sun Aug 30 01:49:06 MDT 2009


The branch, master has been updated
       via  0cae043b0c1d2fa55f6709230658155caaecb4fc (commit)
       via  9e7c6f12fdb6a8ce198359572bb9e69c7d46530a (commit)
      from  0d120be36bfc561e3f679d081993ccc6bea2a401 (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 0cae043b0c1d2fa55f6709230658155caaecb4fc
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Aug 30 09:46:34 2009 +0200

    w3:winbind: Convert WINBINDD_ALLOCATE_GID to the new API

commit 9e7c6f12fdb6a8ce198359572bb9e69c7d46530a
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Aug 30 09:41:43 2009 +0200

    w3:winbind: Convert WINBINDD_ALLOCATE_UID to the new API

-----------------------------------------------------------------------

Summary of changes:
 source3/Makefile.in                      |    2 +
 source3/librpc/gen_ndr/cli_wbint.c       |  314 ++++++++++++++++++++++++++++++
 source3/librpc/gen_ndr/cli_wbint.h       |   20 ++
 source3/librpc/gen_ndr/ndr_wbint.c       |  140 +++++++++++++-
 source3/librpc/gen_ndr/ndr_wbint.h       |   26 ++-
 source3/librpc/gen_ndr/srv_wbint.c       |  186 ++++++++++++++++++
 source3/librpc/gen_ndr/srv_wbint.h       |    4 +
 source3/librpc/gen_ndr/wbint.h           |   18 ++
 source3/librpc/idl/wbint.idl             |    8 +
 source3/winbindd/winbindd.c              |   20 ++-
 source3/winbindd/winbindd_allocate_gid.c |   92 +++++++++
 source3/winbindd/winbindd_allocate_uid.c |   92 +++++++++
 source3/winbindd/winbindd_cache.c        |    2 +
 source3/winbindd/winbindd_dual_srv.c     |   26 +++
 source3/winbindd/winbindd_idmap.c        |    8 -
 source3/winbindd/winbindd_proto.h        |   14 ++
 source3/winbindd/winbindd_sid.c          |   48 -----
 17 files changed, 951 insertions(+), 69 deletions(-)
 create mode 100644 source3/winbindd/winbindd_allocate_gid.c
 create mode 100644 source3/winbindd/winbindd_allocate_uid.c


Changeset truncated at 500 lines:

diff --git a/source3/Makefile.in b/source3/Makefile.in
index ebf6024..5e3e7eb 100644
--- a/source3/Makefile.in
+++ b/source3/Makefile.in
@@ -1190,6 +1190,8 @@ WINBINDD_OBJ1 = \
 		winbindd/winbindd_sid_to_gid.o \
 		winbindd/winbindd_uid_to_sid.o \
 		winbindd/winbindd_gid_to_sid.o \
+		winbindd/winbindd_allocate_uid.o \
+		winbindd/winbindd_allocate_gid.o \
 		winbindd/winbindd_getpwsid.o \
 		winbindd/winbindd_getpwnam.o \
 		winbindd/winbindd_getpwuid.o \
diff --git a/source3/librpc/gen_ndr/cli_wbint.c b/source3/librpc/gen_ndr/cli_wbint.c
index 3b683a7..6037b72 100644
--- a/source3/librpc/gen_ndr/cli_wbint.c
+++ b/source3/librpc/gen_ndr/cli_wbint.c
@@ -1162,6 +1162,320 @@ NTSTATUS rpccli_wbint_Gid2Sid(struct rpc_pipe_client *cli,
 	return r.out.result;
 }
 
+struct rpccli_wbint_AllocateUid_state {
+	struct wbint_AllocateUid orig;
+	struct wbint_AllocateUid tmp;
+	TALLOC_CTX *out_mem_ctx;
+	NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
+};
+
+static void rpccli_wbint_AllocateUid_done(struct tevent_req *subreq);
+
+struct tevent_req *rpccli_wbint_AllocateUid_send(TALLOC_CTX *mem_ctx,
+						 struct tevent_context *ev,
+						 struct rpc_pipe_client *cli,
+						 uint64_t *_uid /* [out] [ref] */)
+{
+	struct tevent_req *req;
+	struct rpccli_wbint_AllocateUid_state *state;
+	struct tevent_req *subreq;
+
+	req = tevent_req_create(mem_ctx, &state,
+				struct rpccli_wbint_AllocateUid_state);
+	if (req == NULL) {
+		return NULL;
+	}
+	state->out_mem_ctx = NULL;
+	state->dispatch_recv = cli->dispatch_recv;
+
+	/* In parameters */
+
+	/* Out parameters */
+	state->orig.out.uid = _uid;
+
+	/* Result */
+	ZERO_STRUCT(state->orig.out.result);
+
+	if (DEBUGLEVEL >= 10) {
+		NDR_PRINT_IN_DEBUG(wbint_AllocateUid, &state->orig);
+	}
+
+	state->out_mem_ctx = talloc_named_const(state, 0,
+			     "rpccli_wbint_AllocateUid_out_memory");
+	if (tevent_req_nomem(state->out_mem_ctx, req)) {
+		return tevent_req_post(req, ev);
+	}
+
+	/* make a temporary copy, that we pass to the dispatch function */
+	state->tmp = state->orig;
+
+	subreq = cli->dispatch_send(state, ev, cli,
+				    &ndr_table_wbint,
+				    NDR_WBINT_ALLOCATEUID,
+				    &state->tmp);
+	if (tevent_req_nomem(subreq, req)) {
+		return tevent_req_post(req, ev);
+	}
+	tevent_req_set_callback(subreq, rpccli_wbint_AllocateUid_done, req);
+	return req;
+}
+
+static void rpccli_wbint_AllocateUid_done(struct tevent_req *subreq)
+{
+	struct tevent_req *req = tevent_req_callback_data(
+		subreq, struct tevent_req);
+	struct rpccli_wbint_AllocateUid_state *state = tevent_req_data(
+		req, struct rpccli_wbint_AllocateUid_state);
+	NTSTATUS status;
+	TALLOC_CTX *mem_ctx;
+
+	if (state->out_mem_ctx) {
+		mem_ctx = state->out_mem_ctx;
+	} else {
+		mem_ctx = state;
+	}
+
+	status = state->dispatch_recv(subreq, mem_ctx);
+	TALLOC_FREE(subreq);
+	if (!NT_STATUS_IS_OK(status)) {
+		tevent_req_nterror(req, status);
+		return;
+	}
+
+	/* Copy out parameters */
+	*state->orig.out.uid = *state->tmp.out.uid;
+
+	/* Copy result */
+	state->orig.out.result = state->tmp.out.result;
+
+	/* Reset temporary structure */
+	ZERO_STRUCT(state->tmp);
+
+	if (DEBUGLEVEL >= 10) {
+		NDR_PRINT_OUT_DEBUG(wbint_AllocateUid, &state->orig);
+	}
+
+	tevent_req_done(req);
+}
+
+NTSTATUS rpccli_wbint_AllocateUid_recv(struct tevent_req *req,
+				       TALLOC_CTX *mem_ctx,
+				       NTSTATUS *result)
+{
+	struct rpccli_wbint_AllocateUid_state *state = tevent_req_data(
+		req, struct rpccli_wbint_AllocateUid_state);
+	NTSTATUS status;
+
+	if (tevent_req_is_nterror(req, &status)) {
+		tevent_req_received(req);
+		return status;
+	}
+
+	/* Steal possbile out parameters to the callers context */
+	talloc_steal(mem_ctx, state->out_mem_ctx);
+
+	/* Return result */
+	*result = state->orig.out.result;
+
+	tevent_req_received(req);
+	return NT_STATUS_OK;
+}
+
+NTSTATUS rpccli_wbint_AllocateUid(struct rpc_pipe_client *cli,
+				  TALLOC_CTX *mem_ctx,
+				  uint64_t *uid /* [out] [ref] */)
+{
+	struct wbint_AllocateUid r;
+	NTSTATUS status;
+
+	/* In parameters */
+
+	if (DEBUGLEVEL >= 10) {
+		NDR_PRINT_IN_DEBUG(wbint_AllocateUid, &r);
+	}
+
+	status = cli->dispatch(cli,
+				mem_ctx,
+				&ndr_table_wbint,
+				NDR_WBINT_ALLOCATEUID,
+				&r);
+
+	if (!NT_STATUS_IS_OK(status)) {
+		return status;
+	}
+
+	if (DEBUGLEVEL >= 10) {
+		NDR_PRINT_OUT_DEBUG(wbint_AllocateUid, &r);
+	}
+
+	if (NT_STATUS_IS_ERR(status)) {
+		return status;
+	}
+
+	/* Return variables */
+	*uid = *r.out.uid;
+
+	/* Return result */
+	return r.out.result;
+}
+
+struct rpccli_wbint_AllocateGid_state {
+	struct wbint_AllocateGid orig;
+	struct wbint_AllocateGid tmp;
+	TALLOC_CTX *out_mem_ctx;
+	NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
+};
+
+static void rpccli_wbint_AllocateGid_done(struct tevent_req *subreq);
+
+struct tevent_req *rpccli_wbint_AllocateGid_send(TALLOC_CTX *mem_ctx,
+						 struct tevent_context *ev,
+						 struct rpc_pipe_client *cli,
+						 uint64_t *_gid /* [out] [ref] */)
+{
+	struct tevent_req *req;
+	struct rpccli_wbint_AllocateGid_state *state;
+	struct tevent_req *subreq;
+
+	req = tevent_req_create(mem_ctx, &state,
+				struct rpccli_wbint_AllocateGid_state);
+	if (req == NULL) {
+		return NULL;
+	}
+	state->out_mem_ctx = NULL;
+	state->dispatch_recv = cli->dispatch_recv;
+
+	/* In parameters */
+
+	/* Out parameters */
+	state->orig.out.gid = _gid;
+
+	/* Result */
+	ZERO_STRUCT(state->orig.out.result);
+
+	if (DEBUGLEVEL >= 10) {
+		NDR_PRINT_IN_DEBUG(wbint_AllocateGid, &state->orig);
+	}
+
+	state->out_mem_ctx = talloc_named_const(state, 0,
+			     "rpccli_wbint_AllocateGid_out_memory");
+	if (tevent_req_nomem(state->out_mem_ctx, req)) {
+		return tevent_req_post(req, ev);
+	}
+
+	/* make a temporary copy, that we pass to the dispatch function */
+	state->tmp = state->orig;
+
+	subreq = cli->dispatch_send(state, ev, cli,
+				    &ndr_table_wbint,
+				    NDR_WBINT_ALLOCATEGID,
+				    &state->tmp);
+	if (tevent_req_nomem(subreq, req)) {
+		return tevent_req_post(req, ev);
+	}
+	tevent_req_set_callback(subreq, rpccli_wbint_AllocateGid_done, req);
+	return req;
+}
+
+static void rpccli_wbint_AllocateGid_done(struct tevent_req *subreq)
+{
+	struct tevent_req *req = tevent_req_callback_data(
+		subreq, struct tevent_req);
+	struct rpccli_wbint_AllocateGid_state *state = tevent_req_data(
+		req, struct rpccli_wbint_AllocateGid_state);
+	NTSTATUS status;
+	TALLOC_CTX *mem_ctx;
+
+	if (state->out_mem_ctx) {
+		mem_ctx = state->out_mem_ctx;
+	} else {
+		mem_ctx = state;
+	}
+
+	status = state->dispatch_recv(subreq, mem_ctx);
+	TALLOC_FREE(subreq);
+	if (!NT_STATUS_IS_OK(status)) {
+		tevent_req_nterror(req, status);
+		return;
+	}
+
+	/* Copy out parameters */
+	*state->orig.out.gid = *state->tmp.out.gid;
+
+	/* Copy result */
+	state->orig.out.result = state->tmp.out.result;
+
+	/* Reset temporary structure */
+	ZERO_STRUCT(state->tmp);
+
+	if (DEBUGLEVEL >= 10) {
+		NDR_PRINT_OUT_DEBUG(wbint_AllocateGid, &state->orig);
+	}
+
+	tevent_req_done(req);
+}
+
+NTSTATUS rpccli_wbint_AllocateGid_recv(struct tevent_req *req,
+				       TALLOC_CTX *mem_ctx,
+				       NTSTATUS *result)
+{
+	struct rpccli_wbint_AllocateGid_state *state = tevent_req_data(
+		req, struct rpccli_wbint_AllocateGid_state);
+	NTSTATUS status;
+
+	if (tevent_req_is_nterror(req, &status)) {
+		tevent_req_received(req);
+		return status;
+	}
+
+	/* Steal possbile out parameters to the callers context */
+	talloc_steal(mem_ctx, state->out_mem_ctx);
+
+	/* Return result */
+	*result = state->orig.out.result;
+
+	tevent_req_received(req);
+	return NT_STATUS_OK;
+}
+
+NTSTATUS rpccli_wbint_AllocateGid(struct rpc_pipe_client *cli,
+				  TALLOC_CTX *mem_ctx,
+				  uint64_t *gid /* [out] [ref] */)
+{
+	struct wbint_AllocateGid r;
+	NTSTATUS status;
+
+	/* In parameters */
+
+	if (DEBUGLEVEL >= 10) {
+		NDR_PRINT_IN_DEBUG(wbint_AllocateGid, &r);
+	}
+
+	status = cli->dispatch(cli,
+				mem_ctx,
+				&ndr_table_wbint,
+				NDR_WBINT_ALLOCATEGID,
+				&r);
+
+	if (!NT_STATUS_IS_OK(status)) {
+		return status;
+	}
+
+	if (DEBUGLEVEL >= 10) {
+		NDR_PRINT_OUT_DEBUG(wbint_AllocateGid, &r);
+	}
+
+	if (NT_STATUS_IS_ERR(status)) {
+		return status;
+	}
+
+	/* Return variables */
+	*gid = *r.out.gid;
+
+	/* Return result */
+	return r.out.result;
+}
+
 struct rpccli_wbint_QueryUser_state {
 	struct wbint_QueryUser orig;
 	struct wbint_QueryUser tmp;
diff --git a/source3/librpc/gen_ndr/cli_wbint.h b/source3/librpc/gen_ndr/cli_wbint.h
index cf9166a..c535dbb 100644
--- a/source3/librpc/gen_ndr/cli_wbint.h
+++ b/source3/librpc/gen_ndr/cli_wbint.h
@@ -102,6 +102,26 @@ NTSTATUS rpccli_wbint_Gid2Sid(struct rpc_pipe_client *cli,
 			      const char *dom_name /* [in] [unique,charset(UTF8)] */,
 			      uint64_t gid /* [in]  */,
 			      struct dom_sid *sid /* [out] [ref] */);
+struct tevent_req *rpccli_wbint_AllocateUid_send(TALLOC_CTX *mem_ctx,
+						 struct tevent_context *ev,
+						 struct rpc_pipe_client *cli,
+						 uint64_t *_uid /* [out] [ref] */);
+NTSTATUS rpccli_wbint_AllocateUid_recv(struct tevent_req *req,
+				       TALLOC_CTX *mem_ctx,
+				       NTSTATUS *result);
+NTSTATUS rpccli_wbint_AllocateUid(struct rpc_pipe_client *cli,
+				  TALLOC_CTX *mem_ctx,
+				  uint64_t *uid /* [out] [ref] */);
+struct tevent_req *rpccli_wbint_AllocateGid_send(TALLOC_CTX *mem_ctx,
+						 struct tevent_context *ev,
+						 struct rpc_pipe_client *cli,
+						 uint64_t *_gid /* [out] [ref] */);
+NTSTATUS rpccli_wbint_AllocateGid_recv(struct tevent_req *req,
+				       TALLOC_CTX *mem_ctx,
+				       NTSTATUS *result);
+NTSTATUS rpccli_wbint_AllocateGid(struct rpc_pipe_client *cli,
+				  TALLOC_CTX *mem_ctx,
+				  uint64_t *gid /* [out] [ref] */);
 struct tevent_req *rpccli_wbint_QueryUser_send(TALLOC_CTX *mem_ctx,
 					       struct tevent_context *ev,
 					       struct rpc_pipe_client *cli,
diff --git a/source3/librpc/gen_ndr/ndr_wbint.c b/source3/librpc/gen_ndr/ndr_wbint.c
index 9dc9e6f..5f294d0 100644
--- a/source3/librpc/gen_ndr/ndr_wbint.c
+++ b/source3/librpc/gen_ndr/ndr_wbint.c
@@ -1258,6 +1258,128 @@ _PUBLIC_ void ndr_print_wbint_Gid2Sid(struct ndr_print *ndr, const char *name, i
 	ndr->depth--;
 }
 
+static enum ndr_err_code ndr_push_wbint_AllocateUid(struct ndr_push *ndr, int flags, const struct wbint_AllocateUid *r)
+{
+	if (flags & NDR_IN) {
+	}
+	if (flags & NDR_OUT) {
+		if (r->out.uid == NULL) {
+			return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+		}
+		NDR_CHECK(ndr_push_hyper(ndr, NDR_SCALARS, *r->out.uid));
+		NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result));
+	}
+	return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_wbint_AllocateUid(struct ndr_pull *ndr, int flags, struct wbint_AllocateUid *r)
+{
+	TALLOC_CTX *_mem_save_uid_0;
+	if (flags & NDR_IN) {
+		ZERO_STRUCT(r->out);
+
+		NDR_PULL_ALLOC(ndr, r->out.uid);
+		ZERO_STRUCTP(r->out.uid);
+	}
+	if (flags & NDR_OUT) {
+		if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+			NDR_PULL_ALLOC(ndr, r->out.uid);
+		}
+		_mem_save_uid_0 = NDR_PULL_GET_MEM_CTX(ndr);
+		NDR_PULL_SET_MEM_CTX(ndr, r->out.uid, LIBNDR_FLAG_REF_ALLOC);
+		NDR_CHECK(ndr_pull_hyper(ndr, NDR_SCALARS, r->out.uid));
+		NDR_PULL_SET_MEM_CTX(ndr, _mem_save_uid_0, LIBNDR_FLAG_REF_ALLOC);
+		NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result));
+	}
+	return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_wbint_AllocateUid(struct ndr_print *ndr, const char *name, int flags, const struct wbint_AllocateUid *r)
+{
+	ndr_print_struct(ndr, name, "wbint_AllocateUid");
+	ndr->depth++;
+	if (flags & NDR_SET_VALUES) {
+		ndr->flags |= LIBNDR_PRINT_SET_VALUES;
+	}
+	if (flags & NDR_IN) {
+		ndr_print_struct(ndr, "in", "wbint_AllocateUid");
+		ndr->depth++;
+		ndr->depth--;
+	}
+	if (flags & NDR_OUT) {
+		ndr_print_struct(ndr, "out", "wbint_AllocateUid");
+		ndr->depth++;
+		ndr_print_ptr(ndr, "uid", r->out.uid);
+		ndr->depth++;
+		ndr_print_hyper(ndr, "uid", *r->out.uid);
+		ndr->depth--;
+		ndr_print_NTSTATUS(ndr, "result", r->out.result);
+		ndr->depth--;
+	}
+	ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_wbint_AllocateGid(struct ndr_push *ndr, int flags, const struct wbint_AllocateGid *r)
+{
+	if (flags & NDR_IN) {
+	}
+	if (flags & NDR_OUT) {
+		if (r->out.gid == NULL) {
+			return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+		}
+		NDR_CHECK(ndr_push_hyper(ndr, NDR_SCALARS, *r->out.gid));
+		NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result));
+	}
+	return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_wbint_AllocateGid(struct ndr_pull *ndr, int flags, struct wbint_AllocateGid *r)
+{
+	TALLOC_CTX *_mem_save_gid_0;
+	if (flags & NDR_IN) {
+		ZERO_STRUCT(r->out);
+
+		NDR_PULL_ALLOC(ndr, r->out.gid);
+		ZERO_STRUCTP(r->out.gid);
+	}
+	if (flags & NDR_OUT) {
+		if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+			NDR_PULL_ALLOC(ndr, r->out.gid);
+		}
+		_mem_save_gid_0 = NDR_PULL_GET_MEM_CTX(ndr);
+		NDR_PULL_SET_MEM_CTX(ndr, r->out.gid, LIBNDR_FLAG_REF_ALLOC);
+		NDR_CHECK(ndr_pull_hyper(ndr, NDR_SCALARS, r->out.gid));
+		NDR_PULL_SET_MEM_CTX(ndr, _mem_save_gid_0, LIBNDR_FLAG_REF_ALLOC);
+		NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result));
+	}
+	return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_wbint_AllocateGid(struct ndr_print *ndr, const char *name, int flags, const struct wbint_AllocateGid *r)
+{
+	ndr_print_struct(ndr, name, "wbint_AllocateGid");
+	ndr->depth++;
+	if (flags & NDR_SET_VALUES) {
+		ndr->flags |= LIBNDR_PRINT_SET_VALUES;
+	}
+	if (flags & NDR_IN) {
+		ndr_print_struct(ndr, "in", "wbint_AllocateGid");
+		ndr->depth++;
+		ndr->depth--;
+	}
+	if (flags & NDR_OUT) {
+		ndr_print_struct(ndr, "out", "wbint_AllocateGid");
+		ndr->depth++;
+		ndr_print_ptr(ndr, "gid", r->out.gid);
+		ndr->depth++;
+		ndr_print_hyper(ndr, "gid", *r->out.gid);
+		ndr->depth--;
+		ndr_print_NTSTATUS(ndr, "result", r->out.result);
+		ndr->depth--;
+	}
+	ndr->depth--;
+}
+
 static enum ndr_err_code ndr_push_wbint_QueryUser(struct ndr_push *ndr, int flags, const struct wbint_QueryUser *r)


-- 
Samba Shared Repository


More information about the samba-cvs mailing list