The branch, master has been updated
       via  41ff0f4 winbind4: Remove unused winbind_get_idmap irpc operation
       via  6b04558 auth4: Remove unused wbc_context
       via  f35f88d ntvfs_unixuid: No wbc_context required
       via  55dd08c ntvfs_posix: No wbc_context required
       via  5a42527 dcesrv_unixinfo: No wbc_context required
       via  25e83a9 unixuid: Use the tevent_context from the ntvfs_context
       via  15700a9 pvfs: Use the tevent_context from the ntvfs_context
       via  5124a9e auth4: Do not generate just a temporary wbc_context
       via  75d7c46 auth4: auth_session_info_fill_unix only needs a 
tevent_context
       via  1de725c auth4: security_token_to_unix_token only needs a 
tevent_context
       via  ba5f027 libwbclient4: Remove unused composite-based functions
       via  d0932a1 source4: Use wbc_xids_to_sids
       via  f275ce4 libwbclient4: Add wbc_xids_to_sids
       via  de7122d source4: Use wbc_sids_to_xids
       via  fefc596 libwbclient4: Add wbc_sids_to_xids
      from  907f49e lib/param: Mark source code generators as group build_source

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


- Log -----------------------------------------------------------------
commit 41ff0f4454ef23d0ac3e31560d78a2b966769fea
Author: Volker Lendecke <[email protected]>
Date:   Tue Feb 4 10:22:25 2014 +0000

    winbind4: Remove unused winbind_get_idmap irpc operation
    
    Signed-off-by: Volker Lendecke <[email protected]>
    Reviewed-by: Kai Blin <[email protected]>
    
    Autobuild-User(master): Volker Lendecke <[email protected]>
    Autobuild-Date(master): Mon Feb 10 13:24:09 CET 2014 on sn-devel-104

commit 6b04558c5e0547a807ac0fcb5eeb1085cfe602ac
Author: Volker Lendecke <[email protected]>
Date:   Tue Feb 4 10:18:48 2014 +0000

    auth4: Remove unused wbc_context
    
    Signed-off-by: Volker Lendecke <[email protected]>
    Reviewed-by: Kai Blin <[email protected]>

commit f35f88d741f1f896268649238d4ddbda4abb1585
Author: Volker Lendecke <[email protected]>
Date:   Mon Feb 3 21:36:25 2014 +0100

    ntvfs_unixuid: No wbc_context required
    
    Signed-off-by: Volker Lendecke <[email protected]>
    Reviewed-by: Kai Blin <[email protected]>

commit 55dd08c4e80827ffc4fe423f3e67aec499af06df
Author: Volker Lendecke <[email protected]>
Date:   Mon Feb 3 21:35:05 2014 +0100

    ntvfs_posix: No wbc_context required
    
    Signed-off-by: Volker Lendecke <[email protected]>
    Reviewed-by: Kai Blin <[email protected]>

commit 5a4252789b54b6b270b3083f6e0732ba1fdd774b
Author: Volker Lendecke <[email protected]>
Date:   Mon Feb 3 21:33:21 2014 +0100

    dcesrv_unixinfo: No wbc_context required
    
    Signed-off-by: Volker Lendecke <[email protected]>
    Reviewed-by: Kai Blin <[email protected]>

commit 25e83a9b3e72cdb84c09ef8ada4784efd110f09a
Author: Volker Lendecke <[email protected]>
Date:   Sun Feb 2 15:54:53 2014 +0100

    unixuid: Use the tevent_context from the ntvfs_context
    
    Signed-off-by: Volker Lendecke <[email protected]>
    Reviewed-by: Kai Blin <[email protected]>

commit 15700a9f6e5393cecf78052f510e015300c5bd85
Author: Volker Lendecke <[email protected]>
Date:   Sun Feb 2 15:53:25 2014 +0100

    pvfs: Use the tevent_context from the ntvfs_context
    
    Signed-off-by: Volker Lendecke <[email protected]>
    Reviewed-by: Kai Blin <[email protected]>

commit 5124a9e1183de990ca3146cd355152094495a779
Author: Volker Lendecke <[email protected]>
Date:   Sun Feb 2 15:50:08 2014 +0100

    auth4: Do not generate just a temporary wbc_context
    
    Signed-off-by: Volker Lendecke <[email protected]>
    Reviewed-by: Kai Blin <[email protected]>

commit 75d7c4609c1c743f84ca9f2d0666aece9e5200d4
Author: Volker Lendecke <[email protected]>
Date:   Sun Feb 2 15:48:03 2014 +0100

    auth4: auth_session_info_fill_unix only needs a tevent_context
    
    Signed-off-by: Volker Lendecke <[email protected]>
    Reviewed-by: Kai Blin <[email protected]>

commit 1de725c2926b526200032c4f46132c17533986c7
Author: Volker Lendecke <[email protected]>
Date:   Sun Feb 2 15:45:47 2014 +0100

    auth4: security_token_to_unix_token only needs a tevent_context
    
    Signed-off-by: Volker Lendecke <[email protected]>
    Reviewed-by: Kai Blin <[email protected]>

commit ba5f02739cb454d2312f73f643f2c119e090ac5e
Author: Volker Lendecke <[email protected]>
Date:   Sun Feb 2 15:45:13 2014 +0100

    libwbclient4: Remove unused composite-based functions
    
    Signed-off-by: Volker Lendecke <[email protected]>
    Reviewed-by: Kai Blin <[email protected]>

commit d0932a1ae089fda0d41be21a9916caeca7c0c233
Author: Volker Lendecke <[email protected]>
Date:   Sun Feb 2 15:35:02 2014 +0100

    source4: Use wbc_xids_to_sids
    
    Signed-off-by: Volker Lendecke <[email protected]>
    Reviewed-by: Kai Blin <[email protected]>

commit f275ce4e4367478b488810491c7bcd993c37caf1
Author: Volker Lendecke <[email protected]>
Date:   Sat Feb 1 20:46:28 2014 +0100

    libwbclient4: Add wbc_xids_to_sids
    
    Signed-off-by: Volker Lendecke <[email protected]>
    Reviewed-by: Kai Blin <[email protected]>

commit de7122ddc356697777cce95d22b3fab7697b30db
Author: Volker Lendecke <[email protected]>
Date:   Thu Jan 30 20:12:07 2014 +0000

    source4: Use wbc_sids_to_xids
    
    Signed-off-by: Volker Lendecke <[email protected]>
    Reviewed-by: Kai Blin <[email protected]>

commit fefc59619b58cb0c38bf7e6ac2ebcc25a5ebbd6c
Author: Volker Lendecke <[email protected]>
Date:   Thu Jan 30 19:05:09 2014 +0000

    libwbclient4: Add wbc_sids_to_xids
    
    Signed-off-by: Volker Lendecke <[email protected]>
    Reviewed-by: Kai Blin <[email protected]>

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

Summary of changes:
 source4/auth/auth.h                           |    1 -
 source4/auth/ntlm/auth.c                      |   12 +-
 source4/auth/unix_token.c                     |   12 +-
 source4/libcli/wbclient/wbclient.c            |  455 ++++++++++++++++++-------
 source4/libcli/wbclient/wbclient.h            |   32 +--
 source4/libcli/wbclient/wscript_build         |    2 +-
 source4/librpc/idl/winbind.idl                |   24 +--
 source4/ntvfs/posix/pvfs_acl.c                |   23 +-
 source4/ntvfs/posix/pvfs_acl_nfs4.c           |   14 +-
 source4/ntvfs/posix/vfs_posix.c               |    7 -
 source4/ntvfs/posix/vfs_posix.h               |    1 -
 source4/ntvfs/unixuid/vfs_unixuid.c           |   12 +-
 source4/rpc_server/unixinfo/dcesrv_unixinfo.c |   52 +---
 source4/winbind/wb_irpc.c                     |   72 ----
 14 files changed, 361 insertions(+), 358 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source4/auth/auth.h b/source4/auth/auth.h
index 503bae9..129f58d 100644
--- a/source4/auth/auth.h
+++ b/source4/auth/auth.h
@@ -97,7 +97,6 @@ struct auth_critical_sizes {
                           const struct auth_usersupplied_info *user_info_in,
                           const struct auth_usersupplied_info 
**user_info_encrypted);
 
-struct wbc_context;
 #include "auth/session.h"
 #include "auth/unix_token_proto.h"
 #include "auth/system_session_proto.h"
diff --git a/source4/auth/ntlm/auth.c b/source4/auth/ntlm/auth.c
index 263dc80..ccfd20a 100644
--- a/source4/auth/ntlm/auth.c
+++ b/source4/auth/ntlm/auth.c
@@ -461,20 +461,12 @@ static NTSTATUS auth_generate_session_info_wrapper(struct 
auth4_context *auth_co
 
        if ((session_info_flags & AUTH_SESSION_INFO_UNIX_TOKEN)
            && NT_STATUS_IS_OK(status)) {
-               struct wbc_context *wbc_ctx = wbc_init(auth_context,
-                                                      auth_context->msg_ctx,
-                                                      auth_context->event_ctx);
-               if (!wbc_ctx) {
-                       TALLOC_FREE(*session_info);
-                       DEBUG(1, ("Cannot contact winbind to provide unix 
token\n"));
-                       return NT_STATUS_INVALID_SERVER_STATE;
-               }
-               status = auth_session_info_fill_unix(wbc_ctx, 
auth_context->lp_ctx,
+               status = auth_session_info_fill_unix(auth_context->event_ctx,
+                                                    auth_context->lp_ctx,
                                                     original_user_name, 
*session_info);
                if (!NT_STATUS_IS_OK(status)) {
                        TALLOC_FREE(*session_info);
                }
-               TALLOC_FREE(wbc_ctx);
        }
        return status;
 }
diff --git a/source4/auth/unix_token.c b/source4/auth/unix_token.c
index 3810945..efc9a9d 100644
--- a/source4/auth/unix_token.c
+++ b/source4/auth/unix_token.c
@@ -29,14 +29,13 @@
   form a security_unix_token from the current security_token
 */
 NTSTATUS security_token_to_unix_token(TALLOC_CTX *mem_ctx,
-                                     struct wbc_context *wbc_ctx,
+                                     struct tevent_context *ev,
                                      struct security_token *token,
                                      struct security_unix_token **sec)
 {
        uint32_t s, g;
        NTSTATUS status;
        struct id_map *ids;
-       struct composite_context *ctx;
 
        /* we can't do unix security without a user and group */
        if (token->num_sids < 2) {
@@ -56,10 +55,7 @@ NTSTATUS security_token_to_unix_token(TALLOC_CTX *mem_ctx,
                ids[s].status = ID_UNKNOWN;
        }
 
-       ctx = wbc_sids_to_xids_send(wbc_ctx, ids, token->num_sids, ids);
-       NT_STATUS_HAVE_NO_MEMORY(ctx);
-
-       status = wbc_sids_to_xids_recv(ctx, &ids);
+       status = wbc_sids_to_xids(ev, ids, token->num_sids);
        NT_STATUS_NOT_OK_RETURN(status);
 
        g = token->num_sids;
@@ -125,14 +121,14 @@ NTSTATUS security_token_to_unix_token(TALLOC_CTX *mem_ctx,
 /*
   Fill in the auth_user_info_unix and auth_unix_token elements in a struct 
session_info
 */
-NTSTATUS auth_session_info_fill_unix(struct wbc_context *wbc_ctx,
+NTSTATUS auth_session_info_fill_unix(struct tevent_context *ev,
                                     struct loadparm_context *lp_ctx,
                                     const char *original_user_name,
                                     struct auth_session_info *session_info)
 {
        char *su;
        size_t len;
-       NTSTATUS status = security_token_to_unix_token(session_info, wbc_ctx,
+       NTSTATUS status = security_token_to_unix_token(session_info, ev,
                                                       
session_info->security_token,
                                                       
&session_info->unix_token);
        if (!NT_STATUS_IS_OK(status)) {
diff --git a/source4/libcli/wbclient/wbclient.c 
b/source4/libcli/wbclient/wbclient.c
index 4f50c10..165333a 100644
--- a/source4/libcli/wbclient/wbclient.c
+++ b/source4/libcli/wbclient/wbclient.c
@@ -21,176 +21,387 @@
 
 #include "includes.h"
 #include <tevent.h>
+#include "lib/util/tevent_unix.h"
 #include "libcli/wbclient/wbclient.h"
-
-/**
- * Initialize the wbclient context, talloc_free() when done.
- *
- * \param mem_ctx talloc context to allocate memory from
- * \param msg_ctx message context to use
- * \param
- */
-struct wbc_context *wbc_init(TALLOC_CTX *mem_ctx,
-                            struct imessaging_context *msg_ctx,
-                            struct tevent_context *event_ctx)
+#include "nsswitch/wb_reqtrans.h"
+#include "system/network.h"
+#include "libcli/util/error.h"
+#include "libcli/security/dom_sid.h"
+
+static int wb_simple_trans(struct tevent_context *ev, int fd,
+                          struct winbindd_request *wb_req,
+                          TALLOC_CTX *mem_ctx,
+                          struct winbindd_response **resp, int *err)
 {
-       struct wbc_context *ctx;
+       struct tevent_req *req;
+       bool polled;
+       int ret;
+
+       req = wb_simple_trans_send(ev, ev, NULL, fd, wb_req);
+       if (req == NULL) {
+               *err = ENOMEM;
+               return -1;
+       }
+
+       polled = tevent_req_poll(req, ev);
+       if (!polled) {
+               *err = errno;
+               DEBUG(10, ("tevent_req_poll returned %s\n",
+                          strerror(*err)));
+               return -1;
+       }
 
-       ctx = talloc(mem_ctx, struct wbc_context);
-       if (ctx == NULL) return NULL;
+       ret = wb_simple_trans_recv(req, mem_ctx, resp, err);
+       TALLOC_FREE(req);
+       return ret;
+}
 
-       ctx->event_ctx = event_ctx;
+static const char *winbindd_socket_dir(void)
+{
+#ifdef SOCKET_WRAPPER
+       const char *env_dir;
 
-       ctx->irpc_handle = irpc_binding_handle_by_name(ctx, msg_ctx,
-                                                      "winbind_server",
-                                                      &ndr_table_winbind);
-       if (ctx->irpc_handle == NULL) {
-               talloc_free(ctx);
-               return NULL;
+       env_dir = getenv(WINBINDD_SOCKET_DIR_ENVVAR);
+       if (env_dir) {
+               return env_dir;
        }
+#endif
 
-       return ctx;
+       return WINBINDD_SOCKET_DIR;
 }
 
-struct wbc_idmap_state {
-       struct composite_context *ctx;
-       struct winbind_get_idmap *req;
-       struct id_map *ids;
-};
+static int winbindd_pipe_sock(void)
+{
+       struct sockaddr_un sunaddr = {};
+       int ret, fd;
+       char *path;
+
+       ret = asprintf(&path, "%s/%s", winbindd_socket_dir(),
+                      WINBINDD_SOCKET_NAME);
+       if (ret == -1) {
+               errno = ENOMEM;
+               return -1;
+       }
+       sunaddr.sun_family = AF_UNIX;
+       strlcpy(sunaddr.sun_path, path, sizeof(sunaddr.sun_path));
+       free(path);
+
+       fd = socket(AF_UNIX, SOCK_STREAM, 0);
+       if (fd == -1) {
+               return -1;
+       }
+
+       ret = connect(fd, (struct sockaddr *)&sunaddr, sizeof(sunaddr));
+       if (ret == -1) {
+               int err = errno;
+               close(fd);
+               errno = err;
+               return -1;
+       }
 
-static void sids_to_xids_recv_ids(struct tevent_req *subreq);
+       return fd;
+}
 
-struct composite_context *wbc_sids_to_xids_send(struct wbc_context *wbc_ctx,
-                                               TALLOC_CTX *mem_ctx,
-                                               uint32_t count,
-                                               struct id_map *ids)
+NTSTATUS wbc_sids_to_xids(struct tevent_context *ev, struct id_map *ids,
+                         uint32_t count)
 {
-       struct composite_context *ctx;
-       struct wbc_idmap_state *state;
-       struct tevent_req *subreq;
+       TALLOC_CTX *mem_ctx;
+       struct winbindd_request req = {};
+       struct winbindd_response *resp;
+       uint32_t i;
+       int fd, ret, err;
+       char *sids, *p;
+       size_t sidslen;
+
+       fd = winbindd_pipe_sock();
+       if (fd == -1) {
+               return map_nt_error_from_unix_common(errno);
+       }
+
+       mem_ctx = talloc_new(NULL);
+       if (mem_ctx == NULL) {
+               close(fd);
+               return NT_STATUS_NO_MEMORY;
+       }
 
-       DEBUG(5, ("wbc_sids_to_xids called\n"));
+       sidslen = count * (DOM_SID_STR_BUFLEN + 1);
 
-       ctx = composite_create(mem_ctx, wbc_ctx->event_ctx);
-       if (ctx == NULL) return NULL;
+       sids = talloc_array(mem_ctx, char, sidslen);
+       if (sids == NULL) {
+               close(fd);
+               TALLOC_FREE(mem_ctx);
+               return NT_STATUS_NO_MEMORY;
+       }
 
-       state = talloc(ctx, struct wbc_idmap_state);
-       if (composite_nomem(state, ctx)) return ctx;
-       ctx->private_data = state;
+       p = sids;
+       for (i=0; i<count; i++) {
+               p += dom_sid_string_buf(ids[i].sid, p, sidslen - (p - sids));
+               *p++ = '\n';
+       }
+       *p++ = '\0';
 
-       state->req = talloc(state, struct winbind_get_idmap);
-       if (composite_nomem(state->req, ctx)) return ctx;
+       DEBUG(10, ("sids=\n%s", sids));
 
-       state->req->in.count = count;
-       state->req->in.level = WINBIND_IDMAP_LEVEL_SIDS_TO_XIDS;
-       state->req->in.ids = ids;
-       state->ctx = ctx;
+       req.length = sizeof(struct winbindd_request);
+       req.cmd = WINBINDD_SIDS_TO_XIDS;
+       req.pid = getpid();
+       req.extra_data.data = sids;
+       req.extra_len = sidslen;
 
-       subreq = dcerpc_winbind_get_idmap_r_send(state,
-                                                wbc_ctx->event_ctx,
-                                                wbc_ctx->irpc_handle,
-                                                state->req);
-       if (composite_nomem(subreq, ctx)) return ctx;
+       ret = wb_simple_trans(ev, fd, &req, mem_ctx, &resp, &err);
+       if (ret == -1) {
+               return map_nt_error_from_unix_common(err);
+       }
 
-       tevent_req_set_callback(subreq, sids_to_xids_recv_ids, state);
+       close(fd);
+
+       p = resp->extra_data.data;
+
+       for (i=0; i<count; i++) {
+               struct unixid *id = &ids[i].xid;
+               char *q;
+
+               switch (p[0]) {
+               case 'U':
+                       id->type = ID_TYPE_UID;
+                       id->id = strtoul(p+1, &q, 10);
+                       break;
+               case 'G':
+                       id->type = ID_TYPE_GID;
+                       id->id = strtoul(p+1, &q, 10);
+                       break;
+               case 'B':
+                       id->type = ID_TYPE_BOTH;
+                       id->id = strtoul(p+1, &q, 10);
+                       break;
+               default:
+                       id->type = ID_TYPE_NOT_SPECIFIED;
+                       id->id = UINT32_MAX;
+                       q = strchr(p, '\n');
+                       break;
+               };
+               ids[i].status = ID_MAPPED;
+
+               if (q == NULL || q[0] != '\n') {
+                       TALLOC_FREE(mem_ctx);
+                       return NT_STATUS_INTERNAL_ERROR;
+               }
+               p = q+1;
+       }
 
-       return ctx;
+       return NT_STATUS_OK;
 }
 
-static void sids_to_xids_recv_ids(struct tevent_req *subreq)
+struct wbc_id_to_sid_state {
+       struct winbindd_request wbreq;
+       struct dom_sid sid;
+};
+
+static void wbc_id_to_sid_done(struct tevent_req *subreq);
+
+static struct tevent_req *wbc_id_to_sid_send(TALLOC_CTX *mem_ctx,
+                                            struct tevent_context *ev,
+                                            int fd, const struct unixid *id)
 {
-       struct wbc_idmap_state *state =
-               tevent_req_callback_data(subreq,
-               struct wbc_idmap_state);
+       struct tevent_req *req, *subreq;
+       struct wbc_id_to_sid_state *state;
 
-       state->ctx->status = dcerpc_winbind_get_idmap_r_recv(subreq, state);
-       TALLOC_FREE(subreq);
-       if (!composite_is_ok(state->ctx)) return;
+       req = tevent_req_create(mem_ctx, &state, struct wbc_id_to_sid_state);
+       if (req == NULL) {
+               return NULL;
+       }
+
+       switch(id->type) {
+       case ID_TYPE_UID:
+               state->wbreq.cmd = WINBINDD_UID_TO_SID;
+               state->wbreq.data.uid = id->id;
+               break;
+       case ID_TYPE_GID:
+               state->wbreq.cmd = WINBINDD_GID_TO_SID;
+               state->wbreq.data.gid = id->id;
+               break;
+       default:
+               tevent_req_error(req, ENOENT);
+               return tevent_req_post(req, ev);
+       }
 
-       state->ids = state->req->out.ids;
-       composite_done(state->ctx);
+       subreq = wb_simple_trans_send(state, ev, NULL, fd, &state->wbreq);
+       if (tevent_req_nomem(subreq, req)) {
+               return tevent_req_post(req, ev);
+       }
+       tevent_req_set_callback(subreq, wbc_id_to_sid_done, req);
+       return req;
 }
 
-NTSTATUS wbc_sids_to_xids_recv(struct composite_context *ctx,
-                              struct id_map **ids)
+static void wbc_id_to_sid_done(struct tevent_req *subreq)
 {
-       NTSTATUS status = composite_wait(ctx);
-               DEBUG(5, ("wbc_sids_to_xids_recv called\n"));
-       if (NT_STATUS_IS_OK(status)) {
-               struct wbc_idmap_state *state = talloc_get_type_abort(
-                                                       ctx->private_data,
-                                                       struct wbc_idmap_state);
-               *ids = state->ids;
+       struct tevent_req *req = tevent_req_callback_data(
+               subreq, struct tevent_req);
+       struct wbc_id_to_sid_state *state = tevent_req_data(
+               req, struct wbc_id_to_sid_state);
+       struct winbindd_response *wbresp;
+       int ret, err;
+
+       ret = wb_simple_trans_recv(subreq, state, &wbresp, &err);
+       TALLOC_FREE(subreq);
+       if (ret == -1) {
+               tevent_req_error(req, err);
+               return;
+       }
+       if ((wbresp->result != WINBINDD_OK) ||
+           !dom_sid_parse(wbresp->data.sid.sid, &state->sid)) {
+               tevent_req_error(req, ENOENT);
+               return;
        }
+       tevent_req_done(req);
+}
 
-       return status;
+static int wbc_id_to_sid_recv(struct tevent_req *req, struct dom_sid *sid)
+{
+       struct wbc_id_to_sid_state *state = tevent_req_data(
+               req, struct wbc_id_to_sid_state);
+       int err;
+
+       if (tevent_req_is_unix_error(req, &err)) {
+               return err;
+       }
+       sid_copy(sid, &state->sid);
+       return 0;
 }
 
-static void xids_to_sids_recv_ids(struct tevent_req *subreq);
+struct wbc_ids_to_sids_state {
+       struct tevent_context *ev;
+       int fd;
+       struct id_map *ids;
+       uint32_t count;
+       uint32_t idx;
+};
+
+static void wbc_ids_to_sids_done(struct tevent_req *subreq);
 
-struct composite_context *wbc_xids_to_sids_send(struct wbc_context *wbc_ctx,
-                                               TALLOC_CTX *mem_ctx,
-                                               uint32_t count,
-                                               struct id_map *ids)
+static struct tevent_req *wbc_ids_to_sids_send(
+       TALLOC_CTX *mem_ctx, struct tevent_context *ev,
+       int fd, struct id_map *ids, uint32_t count)
 {
-       struct composite_context *ctx;
-       struct wbc_idmap_state *state;
-       struct tevent_req *subreq;
+       struct tevent_req *req, *subreq;
+       struct wbc_ids_to_sids_state *state;
 
-       DEBUG(5, ("wbc_xids_to_sids called\n"));
-
-       ctx = composite_create(mem_ctx, wbc_ctx->event_ctx);
-       if (ctx == NULL) return NULL;
+       req = tevent_req_create(mem_ctx, &state,
+                               struct wbc_ids_to_sids_state);
+       if (req == NULL) {
+               return NULL;
+       }
+       state->ev = ev;
+       state->fd = fd;
+       state->ids = ids;
+       state->count = count;
+
+       if (count == 0) {
+               tevent_req_done(req);
+               return tevent_req_post(req, ev);
+       }
 
-       state = talloc(ctx, struct wbc_idmap_state);
-       if (composite_nomem(state, ctx)) return ctx;
-       ctx->private_data = state;
+       subreq = wbc_id_to_sid_send(state, state->ev, state->fd,
+                                   &state->ids[state->idx].xid);
+       if (tevent_req_nomem(subreq, req)) {
+               return tevent_req_post(req, ev);
+       }
+       tevent_req_set_callback(subreq, wbc_ids_to_sids_done, req);
+       return req;
+}
 
-       state->req = talloc(state, struct winbind_get_idmap);
-       if (composite_nomem(state->req, ctx)) return ctx;
+static void wbc_ids_to_sids_done(struct tevent_req *subreq)
+{
+       struct tevent_req *req = tevent_req_callback_data(
+               subreq, struct tevent_req);
+       struct wbc_ids_to_sids_state *state = tevent_req_data(
+               req, struct wbc_ids_to_sids_state);
+       struct id_map *id;
+       struct dom_sid sid;
+       int ret;
+
+       ret = wbc_id_to_sid_recv(subreq, &sid);
+       TALLOC_FREE(subreq);
 
-       state->req->in.count = count;
-       state->req->in.level = WINBIND_IDMAP_LEVEL_XIDS_TO_SIDS;
-       state->req->in.ids = ids;
-       state->ctx = ctx;
+       id = &state->ids[state->idx];
+       if (ret == 0) {
+               id->status = ID_MAPPED;
+               id->sid = dom_sid_dup(state->ids, &sid);
+               if (id->sid == NULL) {
+                       tevent_req_error(req, ENOMEM);
+                       return;
+               }


-- 
Samba Shared Repository

Reply via email to