diff options
-rw-r--r-- | source4/winbind/wb_samba3_cmd.c | 76 | ||||
-rw-r--r-- | source4/winbind/wb_samba3_protocol.c | 12 |
2 files changed, 84 insertions, 4 deletions
diff --git a/source4/winbind/wb_samba3_cmd.c b/source4/winbind/wb_samba3_cmd.c index c5d5654ed7..a964aa9434 100644 --- a/source4/winbind/wb_samba3_cmd.c +++ b/source4/winbind/wb_samba3_cmd.c @@ -750,3 +750,79 @@ NTSTATUS wbsrv_samba3_endgrent(struct wbsrv_samba3_call *s3call) s3call->response.result = WINBINDD_OK; return NT_STATUS_OK; } + +static void sid2uid_recv(struct composite_context *ctx); + +NTSTATUS wbsrv_samba3_sid2uid(struct wbsrv_samba3_call *s3call) +{ + struct composite_context *ctx; + struct wbsrv_service *service = + s3call->wbconn->listen_socket->service; + struct dom_sid *sid; + + DEBUG(1, ("wbsrv_samba3_sid2uid called\n")); + + sid = dom_sid_parse_talloc(s3call, s3call->request.data.sid); + NT_STATUS_HAVE_NO_MEMORY(sid); + + ctx = wb_sid2uid_send(s3call, service, sid); + NT_STATUS_HAVE_NO_MEMORY(ctx); + + ctx->async.fn = sid2uid_recv; + ctx->async.private_data = s3call; + s3call->flags |= WBSRV_CALL_FLAGS_REPLY_ASYNC; + return NT_STATUS_OK; + +} + +static void sid2uid_recv(struct composite_context *ctx) +{ + struct wbsrv_samba3_call *s3call = + talloc_get_type(ctx->async.private_data, + struct wbsrv_samba3_call); + NTSTATUS status; + + DEBUG(1, ("sid2uid_recv called\n")); + + status = wb_sid2uid_recv(ctx, &s3call->response.data.uid); + + wbsrv_samba3_async_epilogue(status, s3call); +} + +static void sid2gid_recv(struct composite_context *ctx); + +NTSTATUS wbsrv_samba3_sid2gid(struct wbsrv_samba3_call *s3call) +{ + struct composite_context *ctx; + struct wbsrv_service *service = + s3call->wbconn->listen_socket->service; + struct dom_sid *sid; + + DEBUG(1, ("wbsrv_samba3_sid2gid called\n")); + + sid = dom_sid_parse_talloc(s3call, s3call->request.data.sid); + NT_STATUS_HAVE_NO_MEMORY(sid); + + ctx = wb_sid2gid_send(s3call, service, sid); + NT_STATUS_HAVE_NO_MEMORY(ctx); + + ctx->async.fn = sid2gid_recv; + ctx->async.private_data = s3call; + s3call->flags |= WBSRV_CALL_FLAGS_REPLY_ASYNC; + return NT_STATUS_OK; + +} + +static void sid2gid_recv(struct composite_context *ctx) +{ + struct wbsrv_samba3_call *s3call = + talloc_get_type(ctx->async.private_data, + struct wbsrv_samba3_call); + NTSTATUS status; + + DEBUG(1, ("sid2gid_recv called\n")); + + status = wb_sid2gid_recv(ctx, &s3call->response.data.gid); + + wbsrv_samba3_async_epilogue(status, s3call); +} diff --git a/source4/winbind/wb_samba3_protocol.c b/source4/winbind/wb_samba3_protocol.c index 88d4c8a847..e65add9fd8 100644 --- a/source4/winbind/wb_samba3_protocol.c +++ b/source4/winbind/wb_samba3_protocol.c @@ -157,6 +157,14 @@ NTSTATUS wbsrv_samba3_handle_call(struct wbsrv_samba3_call *s3call) case WINBINDD_ENDGRENT: return wbsrv_samba3_endgrent(s3call); + case WINBINDD_SID_TO_UID: + case WINBINDD_DUAL_SID2UID: + return wbsrv_samba3_sid2uid(s3call); + + case WINBINDD_SID_TO_GID: + case WINBINDD_DUAL_SID2GID: + return wbsrv_samba3_sid2gid(s3call); + /* Unimplemented commands */ case WINBINDD_PAM_CHAUTHTOK: @@ -165,8 +173,6 @@ NTSTATUS wbsrv_samba3_handle_call(struct wbsrv_samba3_call *s3call) case WINBINDD_LIST_USERS: case WINBINDD_LIST_GROUPS: case WINBINDD_LOOKUPRIDS: - case WINBINDD_SID_TO_UID: - case WINBINDD_SID_TO_GID: case WINBINDD_SIDS_TO_XIDS: case WINBINDD_UID_TO_SID: case WINBINDD_GID_TO_SID: @@ -182,8 +188,6 @@ NTSTATUS wbsrv_samba3_handle_call(struct wbsrv_samba3_call *s3call) case WINBINDD_WINS_BYNAME: case WINBINDD_GETGRLST: case WINBINDD_INIT_CONNECTION: - case WINBINDD_DUAL_SID2UID: - case WINBINDD_DUAL_SID2GID: case WINBINDD_DUAL_SIDS2XIDS: case WINBINDD_DUAL_UID2SID: case WINBINDD_DUAL_GID2SID: |