X-Git-Url: http://git.ipfire.org/?p=ipfire-2.x.git;a=blobdiff_plain;f=src%2Fpatches%2Fsamba%2Fsamba-3.6.99-fix_group_expansion_with_nss_templates.patch;fp=src%2Fpatches%2Fsamba%2Fsamba-3.6.99-fix_group_expansion_with_nss_templates.patch;h=0000000000000000000000000000000000000000;hp=6d43f7c5948825411da717a0d3fde6e3271587eb;hb=1dd31d858ecc4d37fa9c895b59e2b752cc124818;hpb=b3e5529459d4dec78aa07b08b4ccfacdc449c3f9 diff --git a/src/patches/samba/samba-3.6.99-fix_group_expansion_with_nss_templates.patch b/src/patches/samba/samba-3.6.99-fix_group_expansion_with_nss_templates.patch deleted file mode 100644 index 6d43f7c594..0000000000 --- a/src/patches/samba/samba-3.6.99-fix_group_expansion_with_nss_templates.patch +++ /dev/null @@ -1,376 +0,0 @@ -commit 75989f1d0d3ec86bb2046511b962ad72119c750b -Author: Andreas Schneider -AuthorDate: Mon Nov 18 14:58:04 2013 +0100 -Commit: Andreas Schneider -CommitDate: Wed Feb 5 11:38:44 2014 +0100 - - s3-lib: Add grpname to talloc_sub_specified(). - - BUG: https://bugzilla.samba.org/show_bug.cgi?id=2191 ---- - source3/include/proto.h | 1 + - source3/lib/substitute.c | 31 +++++++++++++++++++++++++------ - source3/passdb/passdb.c | 8 ++++---- - source3/passdb/pdb_ldap.c | 24 +++++++++++++++++++++--- - source3/torture/torture.c | 2 +- - source3/utils/net_sam.c | 2 ++ - source3/winbindd/wb_fill_pwent.c | 4 ++-- - 7 files changed, 56 insertions(+), 16 deletions(-) - -diff --git a/source3/include/proto.h b/source3/include/proto.h -index 7303e76..db091ce 100644 ---- a/source3/include/proto.h -+++ b/source3/include/proto.h -@@ -365,6 +365,7 @@ char *talloc_sub_basic(TALLOC_CTX *mem_ctx, const char *smb_name, - char *talloc_sub_specified(TALLOC_CTX *mem_ctx, - const char *input_string, - const char *username, -+ const char *grpname, - const char *domain, - uid_t uid, - gid_t gid); -diff --git a/source3/lib/substitute.c b/source3/lib/substitute.c -index 68328e5..10beed7 100644 ---- a/source3/lib/substitute.c -+++ b/source3/lib/substitute.c -@@ -722,6 +722,7 @@ done: - char *talloc_sub_specified(TALLOC_CTX *mem_ctx, - const char *input_string, - const char *username, -+ const char *grpname, - const char *domain, - uid_t uid, - gid_t gid) -@@ -757,9 +758,18 @@ char *talloc_sub_specified(TALLOC_CTX *mem_ctx, - break; - case 'G' : - if (gid != -1) { -- a_string = talloc_string_sub( -- tmp_ctx, a_string, "%G", -- gidtoname(gid)); -+ const char *name; -+ -+ if (grpname != NULL) { -+ name = grpname; -+ } else { -+ name = gidtoname(gid); -+ } -+ -+ a_string = talloc_string_sub(tmp_ctx, -+ a_string, -+ "%G", -+ name); - } else { - a_string = talloc_string_sub( - tmp_ctx, a_string, -@@ -768,9 +778,18 @@ char *talloc_sub_specified(TALLOC_CTX *mem_ctx, - break; - case 'g' : - if (gid != -1) { -- a_string = talloc_string_sub( -- tmp_ctx, a_string, "%g", -- gidtoname(gid)); -+ const char *name; -+ -+ if (grpname != NULL) { -+ name = grpname; -+ } else { -+ name = gidtoname(gid); -+ } -+ -+ a_string = talloc_string_sub(tmp_ctx, -+ a_string, -+ "%g", -+ name); - } else { - a_string = talloc_string_sub( - tmp_ctx, a_string, "%g", "NO_GROUP"); -diff --git a/source3/passdb/passdb.c b/source3/passdb/passdb.c -index 52c1129..493a694 100644 ---- a/source3/passdb/passdb.c -+++ b/source3/passdb/passdb.c -@@ -228,16 +228,16 @@ static NTSTATUS samu_set_unix_internal(struct samu *user, const struct passwd *p - /* set some basic attributes */ - - pdb_set_profile_path(user, talloc_sub_specified(user, -- lp_logon_path(), pwd->pw_name, domain, pwd->pw_uid, pwd->pw_gid), -+ lp_logon_path(), pwd->pw_name, NULL, domain, pwd->pw_uid, pwd->pw_gid), - PDB_DEFAULT); - pdb_set_homedir(user, talloc_sub_specified(user, -- lp_logon_home(), pwd->pw_name, domain, pwd->pw_uid, pwd->pw_gid), -+ lp_logon_home(), pwd->pw_name, NULL, domain, pwd->pw_uid, pwd->pw_gid), - PDB_DEFAULT); - pdb_set_dir_drive(user, talloc_sub_specified(user, -- lp_logon_drive(), pwd->pw_name, domain, pwd->pw_uid, pwd->pw_gid), -+ lp_logon_drive(), pwd->pw_name, NULL, domain, pwd->pw_uid, pwd->pw_gid), - PDB_DEFAULT); - pdb_set_logon_script(user, talloc_sub_specified(user, -- lp_logon_script(), pwd->pw_name, domain, pwd->pw_uid, pwd->pw_gid), -+ lp_logon_script(), pwd->pw_name, NULL, domain, pwd->pw_uid, pwd->pw_gid), - PDB_DEFAULT); - } - -diff --git a/source3/passdb/pdb_ldap.c b/source3/passdb/pdb_ldap.c -index 9316f40..1665641 100644 ---- a/source3/passdb/pdb_ldap.c -+++ b/source3/passdb/pdb_ldap.c -@@ -5399,11 +5399,29 @@ static NTSTATUS ldapsam_create_user(struct pdb_methods *my_methods, - - if (is_machine) { - /* TODO: choose a more appropriate default for machines */ -- homedir = talloc_sub_specified(tmp_ctx, lp_template_homedir(), "SMB_workstations_home", ldap_state->domain_name, uid, gid); -+ homedir = talloc_sub_specified(tmp_ctx, -+ lp_template_homedir(), -+ "SMB_workstations_home", -+ NULL, -+ ldap_state->domain_name, -+ uid, -+ gid); - shell = talloc_strdup(tmp_ctx, "/bin/false"); - } else { -- homedir = talloc_sub_specified(tmp_ctx, lp_template_homedir(), name, ldap_state->domain_name, uid, gid); -- shell = talloc_sub_specified(tmp_ctx, lp_template_shell(), name, ldap_state->domain_name, uid, gid); -+ homedir = talloc_sub_specified(tmp_ctx, -+ lp_template_homedir(), -+ name, -+ NULL, -+ ldap_state->domain_name, -+ uid, -+ gid); -+ shell = talloc_sub_specified(tmp_ctx, -+ lp_template_shell(), -+ name, -+ NULL, -+ ldap_state->domain_name, -+ uid, -+ gid); - } - uidstr = talloc_asprintf(tmp_ctx, "%u", (unsigned int)uid); - gidstr = talloc_asprintf(tmp_ctx, "%u", (unsigned int)gid); -diff --git a/source3/torture/torture.c b/source3/torture/torture.c -index d37d83c..def177b 100644 ---- a/source3/torture/torture.c -+++ b/source3/torture/torture.c -@@ -5976,7 +5976,7 @@ static bool subst_test(const char *str, const char *user, const char *domain, - char *subst; - bool result = true; - -- subst = talloc_sub_specified(talloc_tos(), str, user, domain, uid, gid); -+ subst = talloc_sub_specified(talloc_tos(), str, user, NULL, domain, uid, gid); - - if (strcmp(subst, expected) != 0) { - printf("sub_specified(%s, %s, %s, %d, %d) returned [%s], expected " -diff --git a/source3/utils/net_sam.c b/source3/utils/net_sam.c -index 0ff7c55..b49bb73 100644 ---- a/source3/utils/net_sam.c -+++ b/source3/utils/net_sam.c -@@ -1847,10 +1847,12 @@ doma_done: - gidstr = talloc_asprintf(tc, "%u", (unsigned int)domadmins_gid); - dir = talloc_sub_specified(tc, lp_template_homedir(), - "Administrator", -+ NULL, - get_global_sam_name(), - uid, domadmins_gid); - shell = talloc_sub_specified(tc, lp_template_shell(), - "Administrator", -+ NULL, - get_global_sam_name(), - uid, domadmins_gid); - -diff --git a/source3/winbindd/wb_fill_pwent.c b/source3/winbindd/wb_fill_pwent.c -index 8f09480..4d94a31 100644 ---- a/source3/winbindd/wb_fill_pwent.c -+++ b/source3/winbindd/wb_fill_pwent.c -@@ -181,11 +181,11 @@ static bool fillup_pw_field(const char *lp_template, - - if ((in != NULL) && (in[0] != '\0') && (lp_security() == SEC_ADS)) { - templ = talloc_sub_specified(talloc_tos(), in, -- username, domname, -+ username, NULL, domname, - uid, gid); - } else { - templ = talloc_sub_specified(talloc_tos(), lp_template, -- username, domname, -+ username, NULL, domname, - uid, gid); - } - -commit 5faa0adf0a8c450897d7a61d348a600f889e5bef -Author: Andreas Schneider -AuthorDate: Mon Nov 18 14:58:14 2013 +0100 -Commit: Andreas Schneider -CommitDate: Wed Feb 5 11:43:17 2014 +0100 - - s3-winbind: Pass the group name to fillup_pw_field(). - - BUG: https://bugzilla.samba.org/show_bug.cgi?id=2191 ---- - source3/winbindd/wb_fill_pwent.c | 58 +++++++++++++++++++++++++++++----------- - 1 file changed, 42 insertions(+), 16 deletions(-) - -diff --git a/source3/winbindd/wb_fill_pwent.c b/source3/winbindd/wb_fill_pwent.c -index 4d94a31..878c5ad 100644 ---- a/source3/winbindd/wb_fill_pwent.c -+++ b/source3/winbindd/wb_fill_pwent.c -@@ -29,6 +29,7 @@ struct wb_fill_pwent_state { - - static bool fillup_pw_field(const char *lp_template, - const char *username, -+ const char *grpname, - const char *domname, - uid_t uid, - gid_t gid, -@@ -36,7 +37,7 @@ static bool fillup_pw_field(const char *lp_template, - fstring out); - - static void wb_fill_pwent_sid2uid_done(struct tevent_req *subreq); --static void wb_fill_pwent_sid2gid_done(struct tevent_req *subreq); -+static void wb_fill_pwent_getgrsid_done(struct tevent_req *subreq); - - struct tevent_req *wb_fill_pwent_send(TALLOC_CTX *mem_ctx, - struct tevent_context *ev, -@@ -76,33 +77,44 @@ static void wb_fill_pwent_sid2uid_done(struct tevent_req *subreq) - return; - } - -- subreq = wb_sid2gid_send(state, state->ev, &state->info->group_sid); -+ subreq = wb_getgrsid_send(state, state->ev, &state->info->group_sid, 1); - if (tevent_req_nomem(subreq, req)) { - return; - } -- tevent_req_set_callback(subreq, wb_fill_pwent_sid2gid_done, req); -+ tevent_req_set_callback(subreq, wb_fill_pwent_getgrsid_done, req); - } - --static void wb_fill_pwent_sid2gid_done(struct tevent_req *subreq) -+static void wb_fill_pwent_getgrsid_done(struct tevent_req *subreq) - { - struct tevent_req *req = tevent_req_callback_data( - subreq, struct tevent_req); - struct wb_fill_pwent_state *state = tevent_req_data( - req, struct wb_fill_pwent_state); - struct winbindd_domain *domain; -- char *dom_name; -+ const char *dom_name; -+ const char *grp_name; - fstring user_name, output_username; - char *mapped_name = NULL; -+ struct talloc_dict *members; -+ TALLOC_CTX *tmp_ctx = talloc_stackframe(); - NTSTATUS status; -- -- status = wb_sid2gid_recv(subreq, &state->pw->pw_gid); -+ bool ok; -+ -+ status = wb_getgrsid_recv(subreq, -+ tmp_ctx, -+ &dom_name, -+ &grp_name, -+ &state->pw->pw_gid, -+ &members); - TALLOC_FREE(subreq); - if (tevent_req_nterror(req, status)) { -+ talloc_free(tmp_ctx); - return; - } - - domain = find_domain_from_sid_noinit(&state->info->user_sid); - if (domain == NULL) { -+ talloc_free(tmp_ctx); - tevent_req_nterror(req, NT_STATUS_NO_SUCH_USER); - return; - } -@@ -133,17 +145,30 @@ static void wb_fill_pwent_sid2gid_done(struct tevent_req *subreq) - fstrcpy(state->pw->pw_gecos, state->info->full_name); - - /* Home directory and shell */ -- -- if (!fillup_pw_field(lp_template_homedir(), user_name, dom_name, -- state->pw->pw_uid, state->pw->pw_gid, -- state->info->homedir, state->pw->pw_dir)) { -+ ok = fillup_pw_field(lp_template_homedir(), -+ user_name, -+ grp_name, -+ dom_name, -+ state->pw->pw_uid, -+ state->pw->pw_gid, -+ state->info->homedir, -+ state->pw->pw_dir); -+ if (!ok) { -+ talloc_free(tmp_ctx); - tevent_req_nterror(req, NT_STATUS_NO_SUCH_USER); - return; - } - -- if (!fillup_pw_field(lp_template_shell(), user_name, dom_name, -- state->pw->pw_uid, state->pw->pw_gid, -- state->info->shell, state->pw->pw_shell)) { -+ ok = fillup_pw_field(lp_template_shell(), -+ user_name, -+ grp_name, -+ dom_name, -+ state->pw->pw_uid, -+ state->pw->pw_gid, -+ state->info->shell, -+ state->pw->pw_shell); -+ talloc_free(tmp_ctx); -+ if (!ok) { - tevent_req_nterror(req, NT_STATUS_NO_SUCH_USER); - return; - } -@@ -162,6 +187,7 @@ NTSTATUS wb_fill_pwent_recv(struct tevent_req *req) - - static bool fillup_pw_field(const char *lp_template, - const char *username, -+ const char *grpname, - const char *domname, - uid_t uid, - gid_t gid, -@@ -181,11 +207,11 @@ static bool fillup_pw_field(const char *lp_template, - - if ((in != NULL) && (in[0] != '\0') && (lp_security() == SEC_ADS)) { - templ = talloc_sub_specified(talloc_tos(), in, -- username, NULL, domname, -+ username, grpname, domname, - uid, gid); - } else { - templ = talloc_sub_specified(talloc_tos(), lp_template, -- username, NULL, domname, -+ username, grpname, domname, - uid, gid); - } - -commit db176c22f4f3e4c4f38288144d63822c3c191419 -Author: Volker Lendecke -AuthorDate: Thu Jan 16 16:10:25 2014 +0100 -Commit: Andreas Schneider -CommitDate: Wed Feb 5 11:44:15 2014 +0100 - - s3-winbind: Improve performance of wb_fill_pwent_sid2uid_done(). - - BUG: https://bugzilla.samba.org/show_bug.cgi?id=2191 - - Signed-off-by: Volker Lendecke - Reviewed-by: Andreas Schneider - - Autobuild-User(master): Andreas Schneider - Autobuild-Date(master): Thu Jan 16 20:17:24 CET 2014 on sn-devel-104 - - (cherry picked from commit 1a43778433934530d77791edd1af538de8b1d8a3) ---- - source3/winbindd/wb_fill_pwent.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/source3/winbindd/wb_fill_pwent.c b/source3/winbindd/wb_fill_pwent.c -index 878c5ad..9634317 100644 ---- a/source3/winbindd/wb_fill_pwent.c -+++ b/source3/winbindd/wb_fill_pwent.c -@@ -77,7 +77,7 @@ static void wb_fill_pwent_sid2uid_done(struct tevent_req *subreq) - return; - } - -- subreq = wb_getgrsid_send(state, state->ev, &state->info->group_sid, 1); -+ subreq = wb_getgrsid_send(state, state->ev, &state->info->group_sid, 0); - if (tevent_req_nomem(subreq, req)) { - return; - }