Bug 14944 - Missing pop_sec_ctx() in error path inside close_directory()
Summary: Missing pop_sec_ctx() in error path inside close_directory()
Status: RESOLVED FIXED
Alias: None
Product: Samba 4.1 and newer
Classification: Unclassified
Component: File services (show other bugs)
Version: 4.15.3
Hardware: All All
: P5 normal (vote)
Target Milestone: ---
Assignee: Jule Anger
QA Contact: Samba QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-01-12 18:37 UTC by Jeremy Allison
Modified: 2022-01-19 15:08 UTC (History)
2 users (show)

See Also:


Attachments
git-am fix for 4.15.next and 4.14.next. (1.14 KB, patch)
2022-01-14 04:06 UTC, Jeremy Allison
cs: review+
jra: review? (slow)
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jeremy Allison 2022-01-12 18:37:33 UTC
Noticed by Andrew Walker <awalker@ixsystems.com>.

                set_sec_ctx(del_token->uid,
                                del_token->gid,
                                del_token->ngroups,
                                del_token->groups,
                                del_nt_token);

                if (!del_share_mode(lck, fsp)) {
                        DEBUG(0, ("close_directory: Could not delete share
entry for "
                                  "%s\n", fsp_str_dbg(fsp)));
                }

                TALLOC_FREE(lck);

                if ((fsp->conn->fs_capabilities & FILE_NAMED_STREAMS)
                    && !is_ntfs_stream_smb_fname(fsp->fsp_name)) {

                        status = delete_all_streams(fsp->conn,
fsp->fsp_name);
                        if (!NT_STATUS_IS_OK(status)) {
                                DEBUG(5, ("delete_all_streams failed: %s\n",
                                          nt_errstr(status)));
                                file_free(req, fsp);
                                return status;
                        }
                }

Shouldn't we be pop_sec_ctx() before returning status here? Am I
misunderstanding something?
Comment 1 Jeremy Allison 2022-01-12 20:31:12 UTC
MR: https://gitlab.com/samba-team/samba/-/merge_requests/2329

Passes ci.
Comment 2 Samba QA Contact 2022-01-14 03:35:08 UTC
This bug was referenced in samba master:

5f9dbf3decd17129f360cbe14383cc79e20fb70b
Comment 3 Jeremy Allison 2022-01-14 04:06:29 UTC
Created attachment 17086 [details]
git-am fix for 4.15.next and 4.14.next.

Cherry-picked from master.
Comment 4 Jeremy Allison 2022-01-14 17:44:43 UTC
Re-assigning to Jule for inclusion in 4.15.next, 4.14.next.
Comment 5 Jule Anger 2022-01-17 08:44:55 UTC
Pushed to autobuild-v4-{15,14}-test.
Comment 6 Samba QA Contact 2022-01-17 09:58:03 UTC
This bug was referenced in samba v4-14-test:

4a6813f7bc93fcaf802f6733e24679adb7cfc52c
Comment 7 Samba QA Contact 2022-01-17 10:25:17 UTC
This bug was referenced in samba v4-15-test:

5a2227d704c9385bc51489e570e744ab750d9aa9
Comment 8 Jule Anger 2022-01-17 12:42:13 UTC
Closing out bug report.

Thanks!
Comment 9 Samba QA Contact 2022-01-19 15:08:39 UTC
This bug was referenced in samba v4-15-stable (Release samba-4.15.4):

5a2227d704c9385bc51489e570e744ab750d9aa9