s4:winbindd: do not drop the workgroup name in the getgrnam and getgrent calls.
[metze/samba/wip.git] / source4 / winbind / wb_cmd_getgrnam.c
index 0e498811f9f8c89fbc1413f58add399544603274..d75a460bd065f697521d14944e0a5051dd76c10f 100644 (file)
 #include "includes.h"
 #include "libcli/composite/composite.h"
 #include "winbind/wb_server.h"
-#include "winbind/wb_async_helpers.h"
-#include "param/param.h"
 #include "winbind/wb_helper.h"
 #include "smbd/service_task.h"
-#include "libnet/libnet_proto.h"
-#include "libcli/security/security.h"
+#include "param/param.h"
 
 struct cmd_getgrnam_state {
        struct composite_context *ctx;
@@ -109,6 +106,7 @@ static void cmd_getgrnam_recv_group_info(struct composite_context *ctx)
                        ctx->async.private_data, struct cmd_getgrnam_state);
        struct libnet_GroupInfo *group_info;
        struct winbindd_gr *gr;
+       char *group_name_with_domain;
 
        DEBUG(5, ("cmd_getgrnam_recv_group_info called\n"));
 
@@ -121,7 +119,15 @@ static void cmd_getgrnam_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_name,
+               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->num_gr_mem = group_info->out.num_members;
        gr->gr_mem_ofs = 0;