r24373: Implement backend for wbinfo -G (gid2sid)
authorKai Blin <kai@samba.org>
Mon, 13 Aug 2007 16:20:26 +0000 (16:20 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 20:01:47 +0000 (15:01 -0500)
source/winbind/config.mk
source/winbind/wb_samba3_cmd.c
source/winbind/wb_samba3_protocol.c

index 02d6039681e11d7d29fca123aecb957f3720eaf5..1a7696c6592c1b83118480c2cab4a7b13eb654d2 100644 (file)
@@ -16,6 +16,7 @@ OBJ_FILES = \
                wb_dom_info_trusted.o \
                wb_sid2domain.o \
                wb_name2domain.o \
+               wb_gid2sid.o \
                wb_sid2uid.o \
                wb_sid2gid.o \
                wb_uid2sid.o \
index 76125c4032ca9066cc47830501d7a080c9a7ffc7..03c5f7a1f9be5a4ff66e8c97c3ad4792f925f404 100644 (file)
@@ -875,3 +875,48 @@ static void uid2sid_recv(struct composite_context *ctx)
        wbsrv_samba3_async_epilogue(status, s3call);
 }
 
+static void gid2sid_recv(struct composite_context *ctx);
+
+NTSTATUS wbsrv_samba3_gid2sid(struct wbsrv_samba3_call *s3call)
+{
+       struct composite_context *ctx;
+       struct wbsrv_service *service =
+               s3call->wbconn->listen_socket->service;
+
+       DEBUG(5, ("wbsrv_samba3_gid2sid called\n"));
+
+       ctx = wb_gid2sid_send(s3call, service, s3call->request.data.gid);
+       NT_STATUS_HAVE_NO_MEMORY(ctx);
+
+       ctx->async.fn = gid2sid_recv;
+       ctx->async.private_data = s3call;
+       s3call->flags |= WBSRV_CALL_FLAGS_REPLY_ASYNC;
+       return NT_STATUS_OK;
+
+}
+
+static void gid2sid_recv(struct composite_context *ctx)
+{
+       struct wbsrv_samba3_call *s3call =
+               talloc_get_type(ctx->async.private_data,
+                               struct wbsrv_samba3_call);
+       NTSTATUS status;
+       struct dom_sid *sid;
+       char *sid_str;
+
+       DEBUG(5, ("gid2sid_recv called\n"));
+
+       status = wb_gid2sid_recv(ctx, s3call, &sid);
+       if(NT_STATUS_IS_OK(status)) {
+               sid_str = dom_sid_string(s3call, sid);
+
+               if (sid_str == NULL)
+                       wbsrv_samba3_async_epilogue(NT_STATUS_NO_MEMORY,s3call);
+
+               WBSRV_SAMBA3_SET_STRING(s3call->response.data.sid.sid, sid_str);
+               s3call->response.data.sid.type = SID_NAME_DOMAIN;
+       }
+
+       wbsrv_samba3_async_epilogue(status, s3call);
+}
+
index c5b3af464b2e61c67d87b18a92b6309118f3f3d8..4f33d0989ee44c03015ffc2ff3a8f18cc512a320 100644 (file)
@@ -169,6 +169,10 @@ NTSTATUS wbsrv_samba3_handle_call(struct wbsrv_samba3_call *s3call)
        case WINBINDD_DUAL_UID2SID:
                return wbsrv_samba3_uid2sid(s3call);
 
+       case WINBINDD_GID_TO_SID:
+       case WINBINDD_DUAL_GID2SID:
+               return wbsrv_samba3_gid2sid(s3call);
+
                /* Unimplemented commands */
 
        case WINBINDD_PAM_CHAUTHTOK:
@@ -178,7 +182,6 @@ NTSTATUS wbsrv_samba3_handle_call(struct wbsrv_samba3_call *s3call)
        case WINBINDD_LIST_GROUPS:
        case WINBINDD_LOOKUPRIDS:
        case WINBINDD_SIDS_TO_XIDS:
-       case WINBINDD_GID_TO_SID:
        case WINBINDD_ALLOCATE_UID:
        case WINBINDD_ALLOCATE_GID:
        case WINBINDD_SET_MAPPING:
@@ -192,7 +195,6 @@ NTSTATUS wbsrv_samba3_handle_call(struct wbsrv_samba3_call *s3call)
        case WINBINDD_GETGRLST:
        case WINBINDD_INIT_CONNECTION:
        case WINBINDD_DUAL_SIDS2XIDS:
-       case WINBINDD_DUAL_GID2SID:
        case WINBINDD_DUAL_SET_MAPPING:
        case WINBINDD_DUAL_SET_HWM:
        case WINBINDD_DUAL_DUMP_MAPS: