root/source4/winbind/wb_xids2sids.c

/* [<][>][^][v][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. wb_xids2sids_send
  2. wb_xids2sids_recv

   1 /*
   2    Unix SMB/CIFS implementation.
   3 
   4    Convet an unixid struct to a SID
   5 
   6    Copyright (C) 2008 Kai Blin
   7 
   8    This program is free software; you can redistribute it and/or modify
   9    it under the terms of the GNU General Public License as published by
  10    the Free Software Foundation; either version 3 of the License, or
  11    (at your option) any later version.
  12 
  13    This program is distributed in the hope that it will be useful,
  14    but WITHOUT ANY WARRANTY; without even the implied warranty of
  15    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  16    GNU General Public License for more details.
  17 
  18    You should have received a copy of the GNU General Public License
  19    along with this program.  If not, see <http://www.gnu.org/licenses/>.
  20 */
  21 
  22 #include "includes.h"
  23 #include "libcli/composite/composite.h"
  24 #include "winbind/wb_server.h"
  25 #include "smbd/service_task.h"
  26 #include "winbind/wb_helper.h"
  27 #include "libcli/security/proto.h"
  28 #include "winbind/idmap.h"
  29 
  30 struct xids2sids_state {
  31         struct composite_context *ctx;
  32         struct wbsrv_service *service;
  33         struct id_mapping *ids;
  34         int count;
  35 };
  36 
  37 struct composite_context *wb_xids2sids_send(TALLOC_CTX *mem_ctx,
     /* [<][>][^][v][top][bottom][index][help] */
  38                                             struct wbsrv_service *service,
  39                                             int count, struct id_mapping *ids)
  40 {
  41         struct composite_context *result;
  42         struct xids2sids_state *state;
  43 
  44         DEBUG(5, ("wb_xids2sids_send called\n"));
  45 
  46         result = composite_create(mem_ctx, service->task->event_ctx);
  47         if (!result) return NULL;
  48 
  49         state = talloc(mem_ctx, struct xids2sids_state);
  50         if (composite_nomem(state, result)) return result;
  51 
  52         state->ctx = result;
  53         result->private_data = state;
  54         state->service = service;
  55         state->count = count;
  56         state->ids = ids;
  57 
  58         state->ctx->status = idmap_xids_to_sids(service->idmap_ctx, mem_ctx,
  59                                                 count, state->ids);
  60         if (!composite_is_ok(state->ctx)) return result;
  61 
  62         composite_done(state->ctx);
  63         return result;
  64 }
  65 
  66 NTSTATUS wb_xids2sids_recv(struct composite_context *ctx,
     /* [<][>][^][v][top][bottom][index][help] */
  67                            struct id_mapping **ids)
  68 {
  69         NTSTATUS status = composite_wait(ctx);
  70         struct xids2sids_state *state = talloc_get_type(ctx->private_data,
  71                                                         struct xids2sids_state);
  72 
  73         DEBUG(5, ("wb_xids2sids_recv called.\n"));
  74 
  75         *ids = state->ids;
  76 
  77         talloc_free(ctx);
  78         return status;
  79 }
  80 

/* [<][>][^][v][top][bottom][index][help] */