Changeset 740 for vendor/current/source4/libcli/wbclient
- Timestamp:
- Nov 14, 2012, 12:59:34 PM (13 years ago)
- Location:
- vendor/current/source4/libcli/wbclient
- Files:
-
- 1 added
- 1 deleted
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
vendor/current/source4/libcli/wbclient/wbclient.c
r414 r740 21 21 22 22 #include "includes.h" 23 #include <tevent.h> 23 24 #include "libcli/wbclient/wbclient.h" 24 25 /**26 * Get the server_id of the winbind task.27 *28 * \param[in] msg_ctx message context to use29 * \param[in] mem_ctx talloc context to use30 * \param[out] ids array of server_id structs containing the winbind id31 * \return NT_STATUS_OK on success, NT_STATUS_INTERNAL_ERROR on failure32 */33 static NTSTATUS get_server_id(struct messaging_context *msg_ctx,34 TALLOC_CTX *mem_ctx, struct server_id **ids)35 {36 *ids = irpc_servers_byname(msg_ctx, mem_ctx, "winbind_server");37 if (*ids == NULL || (*ids)[0].id == 0) {38 DEBUG(0, ("Geting the winbind server ID failed.\n"));39 return NT_STATUS_INTERNAL_ERROR;40 }41 return NT_STATUS_OK;42 }43 25 44 26 /** … … 54 36 { 55 37 struct wbc_context *ctx; 56 NTSTATUS status;57 38 58 39 ctx = talloc(mem_ctx, struct wbc_context); 59 40 if (ctx == NULL) return NULL; 60 41 61 status = get_server_id(msg_ctx, mem_ctx, &ctx->ids); 62 if (!NT_STATUS_IS_OK(status)) { 42 ctx->event_ctx = event_ctx; 43 44 ctx->irpc_handle = irpc_binding_handle_by_name(ctx, msg_ctx, 45 "winbind_server", 46 &ndr_table_winbind); 47 if (ctx->irpc_handle == NULL) { 63 48 talloc_free(ctx); 64 49 return NULL; 65 50 } 66 67 ctx->msg_ctx = msg_ctx;68 ctx->event_ctx = event_ctx;69 51 70 52 return ctx; … … 74 56 struct composite_context *ctx; 75 57 struct winbind_get_idmap *req; 76 struct irpc_request *irpc_req; 77 struct id_mapping *ids; 58 struct id_map *ids; 78 59 }; 79 60 80 static void sids_to_xids_recv_ids(struct irpc_request *req);61 static void sids_to_xids_recv_ids(struct tevent_req *subreq); 81 62 82 63 struct composite_context *wbc_sids_to_xids_send(struct wbc_context *wbc_ctx, 83 64 TALLOC_CTX *mem_ctx, 84 65 uint32_t count, 85 struct id_map ping*ids)66 struct id_map *ids) 86 67 { 87 68 struct composite_context *ctx; 88 69 struct wbc_idmap_state *state; 70 struct tevent_req *subreq; 89 71 90 72 DEBUG(5, ("wbc_sids_to_xids called\n")); … … 105 87 state->ctx = ctx; 106 88 107 state->irpc_req = IRPC_CALL_SEND(wbc_ctx->msg_ctx, wbc_ctx->ids[0], 108 winbind, WINBIND_GET_IDMAP, state->req, 109 state); 110 if (composite_nomem(state->irpc_req, ctx)) return ctx; 89 subreq = dcerpc_winbind_get_idmap_r_send(state, 90 wbc_ctx->event_ctx, 91 wbc_ctx->irpc_handle, 92 state->req); 93 if (composite_nomem(subreq, ctx)) return ctx; 111 94 112 composite_continue_irpc(ctx, state->irpc_req, sids_to_xids_recv_ids,113 state); 95 tevent_req_set_callback(subreq, sids_to_xids_recv_ids, state); 96 114 97 return ctx; 115 98 } 116 99 117 static void sids_to_xids_recv_ids(struct irpc_request *req)100 static void sids_to_xids_recv_ids(struct tevent_req *subreq) 118 101 { 119 struct wbc_idmap_state *state = talloc_get_type_abort(120 req->async.private_data,121 102 struct wbc_idmap_state *state = 103 tevent_req_callback_data(subreq, 104 struct wbc_idmap_state); 122 105 123 state->ctx->status = irpc_call_recv(state->irpc_req); 106 state->ctx->status = dcerpc_winbind_get_idmap_r_recv(subreq, state); 107 TALLOC_FREE(subreq); 124 108 if (!composite_is_ok(state->ctx)) return; 125 109 … … 129 113 130 114 NTSTATUS wbc_sids_to_xids_recv(struct composite_context *ctx, 131 struct id_map ping**ids)115 struct id_map **ids) 132 116 { 133 117 NTSTATUS status = composite_wait(ctx); … … 143 127 } 144 128 145 static void xids_to_sids_recv_ids(struct irpc_request *req);129 static void xids_to_sids_recv_ids(struct tevent_req *subreq); 146 130 147 131 struct composite_context *wbc_xids_to_sids_send(struct wbc_context *wbc_ctx, 148 132 TALLOC_CTX *mem_ctx, 149 133 uint32_t count, 150 struct id_map ping*ids)134 struct id_map *ids) 151 135 { 152 136 struct composite_context *ctx; 153 137 struct wbc_idmap_state *state; 138 struct tevent_req *subreq; 154 139 155 140 DEBUG(5, ("wbc_xids_to_sids called\n")); … … 170 155 state->ctx = ctx; 171 156 172 state->irpc_req = IRPC_CALL_SEND(wbc_ctx->msg_ctx, wbc_ctx->ids[0], 173 winbind, WINBIND_GET_IDMAP, state->req, 174 state); 175 if (composite_nomem(state->irpc_req, ctx)) return ctx; 157 subreq = dcerpc_winbind_get_idmap_r_send(state, 158 wbc_ctx->event_ctx, 159 wbc_ctx->irpc_handle, 160 state->req); 161 if (composite_nomem(subreq, ctx)) return ctx; 176 162 177 composite_continue_irpc(ctx, state->irpc_req, xids_to_sids_recv_ids, 178 state); 163 tevent_req_set_callback(subreq, xids_to_sids_recv_ids, state); 179 164 180 165 return ctx; 181 166 } 182 167 183 static void xids_to_sids_recv_ids(struct irpc_request *req)168 static void xids_to_sids_recv_ids(struct tevent_req *subreq) 184 169 { 185 struct wbc_idmap_state *state = talloc_get_type_abort(186 req->async.private_data,187 170 struct wbc_idmap_state *state = 171 tevent_req_callback_data(subreq, 172 struct wbc_idmap_state); 188 173 189 state->ctx->status = irpc_call_recv(state->irpc_req); 174 state->ctx->status = dcerpc_winbind_get_idmap_r_recv(subreq, state); 175 TALLOC_FREE(subreq); 190 176 if (!composite_is_ok(state->ctx)) return; 191 177 … … 195 181 196 182 NTSTATUS wbc_xids_to_sids_recv(struct composite_context *ctx, 197 struct id_map ping**ids)183 struct id_map **ids) 198 184 { 199 185 NTSTATUS status = composite_wait(ctx); -
vendor/current/source4/libcli/wbclient/wbclient.h
r414 r740 21 21 #include "lib/messaging/irpc.h" 22 22 #include "libcli/composite/composite.h" 23 #include "librpc/gen_ndr/ndr_winbind .h"23 #include "librpc/gen_ndr/ndr_winbind_c.h" 24 24 25 25 struct wbc_context { 26 struct messaging_context *msg_ctx;27 26 struct tevent_context *event_ctx; 28 struct server_id *ids;27 struct dcerpc_binding_handle *irpc_handle; 29 28 }; 30 29 … … 36 35 TALLOC_CTX *mem_ctx, 37 36 uint32_t count, 38 struct id_map ping*ids);37 struct id_map *ids); 39 38 40 39 NTSTATUS wbc_sids_to_xids_recv(struct composite_context *ctx, 41 struct id_map ping**ids);40 struct id_map **ids); 42 41 43 42 struct composite_context *wbc_xids_to_sids_send(struct wbc_context *wbc_ctx, 44 43 TALLOC_CTX *mem_ctx, 45 44 uint32_t count, 46 struct id_map ping*ids);45 struct id_map *ids); 47 46 48 47 NTSTATUS wbc_xids_to_sids_recv(struct composite_context *ctx, 49 struct id_map ping**ids);48 struct id_map **ids); 50 49
Note:
See TracChangeset
for help on using the changeset viewer.