s4:winbindd: do not drop the workgroup name in the getgrgid call
authorMichael Adam <obnox@samba.org>
Wed, 27 Feb 2013 00:04:46 +0000 (01:04 +0100)
committerAndrew Bartlett <abartlet@samba.org>
Wed, 27 Feb 2013 04:44:39 +0000 (05:44 +0100)
Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Wed Feb 27 05:44:39 CET 2013 on sn-devel-104

source4/winbind/wb_cmd_getgrgid.c

index fe946ed25795eefc570972cdc10be06906989f82..8ca93db38ee468b24dcb248ef580618e22dcd455 100644 (file)
@@ -23,6 +23,7 @@
 #include "libcli/composite/composite.h"
 #include "winbind/wb_server.h"
 #include "smbd/service_task.h"
+#include "param/param.h"
 
 struct cmd_getgrgid_state {
        struct composite_context *ctx;
@@ -127,6 +128,7 @@ static void cmd_getgrgid_recv_group_info(struct composite_context *ctx)
                                struct cmd_getgrgid_state);
        struct libnet_GroupInfo *group_info;
        struct winbindd_gr *gr;
+       char *group_name_with_domain;
 
        DEBUG(5, ("cmd_getgrgid_recv_group_info called\n"));
 
@@ -139,7 +141,15 @@ static void cmd_getgrgid_recv_group_info(struct composite_context *ctx)
        state->ctx->status = libnet_GroupInfo_recv(ctx, state, group_info);
        if (!composite_is_ok(state->ctx)) return;
 
-       WBSRV_SAMBA3_SET_STRING(gr->gr_name, group_info->out.group_name);
+       group_name_with_domain = talloc_asprintf(gr, "%s%s%s",
+               state->workgroup,
+               lpcfg_winbind_separator(state->service->task->lp_ctx),
+               group_info->out.group_name);
+       if (composite_nomem(group_name_with_domain, state->ctx)) {
+               return;
+       }
+
+       WBSRV_SAMBA3_SET_STRING(gr->gr_name, group_name_with_domain);
        WBSRV_SAMBA3_SET_STRING(gr->gr_passwd, "*");
 
        gr->gr_gid = state->gid;