summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorKai Blin <kai@samba.org>2007-08-13 16:20:26 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 15:01:47 -0500
commit677ccf3047dddbaf6b0323a68c00ac58ae20cde6 (patch)
tree6101b7eaff7bfe081793eca9fc590f924bd86668 /source4
parente1c832521f636d186067bd13b235c5f18db1b0da (diff)
downloadsamba-677ccf3047dddbaf6b0323a68c00ac58ae20cde6.tar.gz
samba-677ccf3047dddbaf6b0323a68c00ac58ae20cde6.tar.bz2
samba-677ccf3047dddbaf6b0323a68c00ac58ae20cde6.zip
r24373: Implement backend for wbinfo -G (gid2sid)
(This used to be commit e928e56219c8911105b34e3a322bd70f7172382b)
Diffstat (limited to 'source4')
-rw-r--r--source4/winbind/config.mk1
-rw-r--r--source4/winbind/wb_samba3_cmd.c45
-rw-r--r--source4/winbind/wb_samba3_protocol.c6
3 files changed, 50 insertions, 2 deletions
diff --git a/source4/winbind/config.mk b/source4/winbind/config.mk
index 02d6039681..1a7696c659 100644
--- a/source4/winbind/config.mk
+++ b/source4/winbind/config.mk
@@ -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 \
diff --git a/source4/winbind/wb_samba3_cmd.c b/source4/winbind/wb_samba3_cmd.c
index 76125c4032..03c5f7a1f9 100644
--- a/source4/winbind/wb_samba3_cmd.c
+++ b/source4/winbind/wb_samba3_cmd.c
@@ -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);
+}
+
diff --git a/source4/winbind/wb_samba3_protocol.c b/source4/winbind/wb_samba3_protocol.c
index c5b3af464b..4f33d0989e 100644
--- a/source4/winbind/wb_samba3_protocol.c
+++ b/source4/winbind/wb_samba3_protocol.c
@@ -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: