Merge ~ahasenack/ubuntu/+source/samba:fix-printing-1951490-impish into ubuntu/+source/samba:ubuntu/impish-devel

Proposed by Andreas Hasenack
Status: Merged
Merge reported by: Andreas Hasenack
Merged at revision: c6266671f8feabfa45dc1d8adc4fd2006886d867
Proposed branch: ~ahasenack/ubuntu/+source/samba:fix-printing-1951490-impish
Merge into: ubuntu/+source/samba:ubuntu/impish-devel
Diff against target: 256 lines (+234/-0)
3 files modified
debian/changelog (+7/-0)
debian/patches/lp-1951490-fix-printing-KB5006743.patch (+226/-0)
debian/patches/series (+1/-0)
Reviewer Review Type Date Requested Status
Sergio Durigan Junior (community) Approve
Canonical Server Pending
Review via email: mp+416667@code.launchpad.net

Description of the change

Fix printing after KB5006743 from MS is applied to the clients.

This one is complicated to test because of the environment. I will try to rely on community members for the SRU testing. Some have already tested the patch in PPA builds that others have provided in the bug.

PPA: https://launchpad.net/~ahasenack/+archive/ubuntu/samba-kb5006743-printing/

To post a comment you must log in.
Revision history for this message
Sergio Durigan Junior (sergiodj) wrote :

Thanks for the MP, Andreas.

LGTM modulo a small nit with the DEP-3 headers. +1

review: Approve
Revision history for this message
Andreas Hasenack (ahasenack) :
Revision history for this message
Andreas Hasenack (ahasenack) wrote :

Thanks, uploaded

$ dput ubuntu ../samba_4.13.17~dfsg-0ubuntu0.21.10.2_source.changes
D: Setting host argument.
Checking signature on .changes
gpg: ../samba_4.13.17~dfsg-0ubuntu0.21.10.2_source.changes: Valid signature from AC983EB5BF6BCBA9
Checking signature on .dsc
gpg: ../samba_4.13.17~dfsg-0ubuntu0.21.10.2.dsc: Valid signature from AC983EB5BF6BCBA9
Uploading to ubuntu (via ftp to upload.ubuntu.com):
  Uploading samba_4.13.17~dfsg-0ubuntu0.21.10.2.dsc: done.
  Uploading samba_4.13.17~dfsg-0ubuntu0.21.10.2.debian.tar.xz: done.
  Uploading samba_4.13.17~dfsg-0ubuntu0.21.10.2_source.buildinfo: done.
  Uploading samba_4.13.17~dfsg-0ubuntu0.21.10.2_source.changes: done.
Successfully uploaded packages.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
diff --git a/debian/changelog b/debian/changelog
index dd2dc84..556cf8c 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
1samba (2:4.13.17~dfsg-0ubuntu0.21.10.2) impish; urgency=medium
2
3 * d/p/lp-1951490-fix-printing-KB5006743.patch: Fix printing after
4 Windows 2021-10 Monthly Rollup patch (LP: #1951490)
5
6 -- Andreas Hasenack <andreas@canonical.com> Thu, 10 Mar 2022 10:52:15 -0300
7
1samba (2:4.13.17~dfsg-0ubuntu0.21.10.1) impish-security; urgency=medium8samba (2:4.13.17~dfsg-0ubuntu0.21.10.1) impish-security; urgency=medium
29
3 * Update to 4.13.17 as a security update10 * Update to 4.13.17 as a security update
diff --git a/debian/patches/lp-1951490-fix-printing-KB5006743.patch b/debian/patches/lp-1951490-fix-printing-KB5006743.patch
4new file mode 10064411new file mode 100644
index 0000000..c110345
--- /dev/null
+++ b/debian/patches/lp-1951490-fix-printing-KB5006743.patch
@@ -0,0 +1,226 @@
1From 9e3c363030dd3108d9658e87f7c4101d0b470c47 Mon Sep 17 00:00:00 2001
2From: Stefan Metzmacher <metze@samba.org>
3Date: Sat, 22 Jan 2022 01:08:26 +0100
4Subject: [PATCH] dcesrv_core: wrap gensec_*() calls in [un]become_root() calls
5
6This is important for the source3/rpc_server code as it might
7be called embedded in smbd and may not run as root with access
8to our private tdb/ldb files.
9
10Note this is only really needed for 4.15 and older, as
11we no longer run the rpc_server embedded in smbd,
12but we better be consistent for now.
13
14This should be able to fix the problem the printing no longer works
15on Windows 7 with 2021-10 monthly rollup patch (KB5006743).
16
17Windows uses NTLMSSP with privacy at the DCERPC layer on top
18of NCACN_NP (smb).
19
20BUG: https://bugzilla.samba.org/show_bug.cgi?id=14867
21
22Signed-off-by: Stefan Metzmacher <metze@samba.org>
23Reviewed-by: Andreas Schneider <asn@samba.org>
24(similar to commit 0651fa474cd68b18d8eb9bdc7c4ba5b847ba9ad9)
25---
26 librpc/rpc/dcesrv_auth.c | 6 ++++++
27 librpc/rpc/dcesrv_core.c | 18 ++++++++++++++++++
28 librpc/rpc/dcesrv_core.h | 2 ++
29 source3/rpc_server/rpc_config.c | 2 ++
30 source4/rpc_server/service_rpc.c | 10 ++++++++++
31 5 files changed, 38 insertions(+)
32
33Origin: upstream, https://git.samba.org/samba.git/?p=samba.git;a=commit;h=9e3c363030dd3108d9658e87f7c4101d0b470c47
34Bug: https://bugzilla.samba.org/show_bug.cgi?id=14867
35Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/samba/+bug/1951490
36Last-Update: 2022-03-10
37--- a/librpc/rpc/dcesrv_auth.c
38+++ b/librpc/rpc/dcesrv_auth.c
39@@ -81,6 +81,7 @@ static bool dcesrv_auth_prepare_gensec(s
40 {
41 struct dcesrv_connection *dce_conn = call->conn;
42 struct dcesrv_auth *auth = call->auth_state;
43+ struct dcesrv_context_callbacks *cb = &call->conn->dce_ctx->callbacks;
44 NTSTATUS status;
45
46 if (auth->auth_started) {
47@@ -129,9 +130,11 @@ static bool dcesrv_auth_prepare_gensec(s
48 auth->auth_level = call->in_auth_info.auth_level;
49 auth->auth_context_id = call->in_auth_info.auth_context_id;
50
51+ cb->auth.become_root();
52 status = call->conn->dce_ctx->callbacks.auth.gensec_prepare(auth,
53 call,
54 &auth->gensec_security);
55+ cb->auth.unbecome_root();
56 if (!NT_STATUS_IS_OK(status)) {
57 DEBUG(1, ("Failed to call samba_server_gensec_start %s\n",
58 nt_errstr(status)));
59@@ -324,6 +327,7 @@ bool dcesrv_auth_bind(struct dcesrv_call
60 NTSTATUS dcesrv_auth_complete(struct dcesrv_call_state *call, NTSTATUS status)
61 {
62 struct dcesrv_auth *auth = call->auth_state;
63+ struct dcesrv_context_callbacks *cb = &call->conn->dce_ctx->callbacks;
64 const char *pdu = "<unknown>";
65
66 switch (call->pkt.ptype) {
67@@ -354,9 +358,11 @@ NTSTATUS dcesrv_auth_complete(struct dce
68 return status;
69 }
70
71+ cb->auth.become_root();
72 status = gensec_session_info(auth->gensec_security,
73 auth,
74 &auth->session_info);
75+ cb->auth.unbecome_root();
76 if (!NT_STATUS_IS_OK(status)) {
77 DEBUG(1, ("Failed to establish session_info: %s\n",
78 nt_errstr(status)));
79--- a/librpc/rpc/dcesrv_core.c
80+++ b/librpc/rpc/dcesrv_core.c
81@@ -949,6 +949,7 @@ static NTSTATUS dcesrv_bind(struct dcesr
82 struct dcerpc_binding *ep_2nd_description = NULL;
83 const char *endpoint = NULL;
84 struct dcesrv_auth *auth = call->auth_state;
85+ struct dcesrv_context_callbacks *cb = &call->conn->dce_ctx->callbacks;
86 struct dcerpc_ack_ctx *ack_ctx_list = NULL;
87 struct dcerpc_ack_ctx *ack_features = NULL;
88 struct tevent_req *subreq = NULL;
89@@ -1153,9 +1154,11 @@ static NTSTATUS dcesrv_bind(struct dcesr
90 return dcesrv_auth_reply(call);
91 }
92
93+ cb->auth.become_root();
94 subreq = gensec_update_send(call, call->event_ctx,
95 auth->gensec_security,
96 call->in_auth_info.credentials);
97+ cb->auth.unbecome_root();
98 if (subreq == NULL) {
99 return NT_STATUS_NO_MEMORY;
100 }
101@@ -1170,10 +1173,13 @@ static void dcesrv_bind_done(struct teve
102 tevent_req_callback_data(subreq,
103 struct dcesrv_call_state);
104 struct dcesrv_connection *conn = call->conn;
105+ struct dcesrv_context_callbacks *cb = &call->conn->dce_ctx->callbacks;
106 NTSTATUS status;
107
108+ cb->auth.become_root();
109 status = gensec_update_recv(subreq, call,
110 &call->out_auth_info->credentials);
111+ cb->auth.unbecome_root();
112 TALLOC_FREE(subreq);
113
114 status = dcesrv_auth_complete(call, status);
115@@ -1231,6 +1237,7 @@ static NTSTATUS dcesrv_auth3(struct dces
116 {
117 struct dcesrv_connection *conn = call->conn;
118 struct dcesrv_auth *auth = call->auth_state;
119+ struct dcesrv_context_callbacks *cb = &call->conn->dce_ctx->callbacks;
120 struct tevent_req *subreq = NULL;
121 NTSTATUS status;
122
123@@ -1275,9 +1282,11 @@ static NTSTATUS dcesrv_auth3(struct dces
124 return NT_STATUS_OK;
125 }
126
127+ cb->auth.become_root();
128 subreq = gensec_update_send(call, call->event_ctx,
129 auth->gensec_security,
130 call->in_auth_info.credentials);
131+ cb->auth.unbecome_root();
132 if (subreq == NULL) {
133 return NT_STATUS_NO_MEMORY;
134 }
135@@ -1293,10 +1302,13 @@ static void dcesrv_auth3_done(struct tev
136 struct dcesrv_call_state);
137 struct dcesrv_connection *conn = call->conn;
138 struct dcesrv_auth *auth = call->auth_state;
139+ struct dcesrv_context_callbacks *cb = &call->conn->dce_ctx->callbacks;
140 NTSTATUS status;
141
142+ cb->auth.become_root();
143 status = gensec_update_recv(subreq, call,
144 &call->out_auth_info->credentials);
145+ cb->auth.unbecome_root();
146 TALLOC_FREE(subreq);
147
148 status = dcesrv_auth_complete(call, status);
149@@ -1568,6 +1580,7 @@ static NTSTATUS dcesrv_alter(struct dces
150 struct ncacn_packet *pkt = &call->ack_pkt;
151 uint32_t extra_flags = 0;
152 struct dcesrv_auth *auth = call->auth_state;
153+ struct dcesrv_context_callbacks *cb = &call->conn->dce_ctx->callbacks;
154 struct dcerpc_ack_ctx *ack_ctx_list = NULL;
155 struct tevent_req *subreq = NULL;
156 size_t i;
157@@ -1679,9 +1692,11 @@ static NTSTATUS dcesrv_alter(struct dces
158 return dcesrv_auth_reply(call);
159 }
160
161+ cb->auth.become_root();
162 subreq = gensec_update_send(call, call->event_ctx,
163 auth->gensec_security,
164 call->in_auth_info.credentials);
165+ cb->auth.unbecome_root();
166 if (subreq == NULL) {
167 return NT_STATUS_NO_MEMORY;
168 }
169@@ -1696,10 +1711,13 @@ static void dcesrv_alter_done(struct tev
170 tevent_req_callback_data(subreq,
171 struct dcesrv_call_state);
172 struct dcesrv_connection *conn = call->conn;
173+ struct dcesrv_context_callbacks *cb = &call->conn->dce_ctx->callbacks;
174 NTSTATUS status;
175
176+ cb->auth.become_root();
177 status = gensec_update_recv(subreq, call,
178 &call->out_auth_info->credentials);
179+ cb->auth.unbecome_root();
180 TALLOC_FREE(subreq);
181
182 status = dcesrv_auth_complete(call, status);
183--- a/librpc/rpc/dcesrv_core.h
184+++ b/librpc/rpc/dcesrv_core.h
185@@ -386,6 +386,8 @@ struct dcesrv_context_callbacks {
186 NTSTATUS (*gensec_prepare)(TALLOC_CTX *mem_ctx,
187 struct dcesrv_call_state *call,
188 struct gensec_security **out);
189+ void (*become_root)(void);
190+ void (*unbecome_root)(void);
191 } auth;
192 struct {
193 NTSTATUS (*find)(struct dcesrv_call_state *);
194--- a/source3/rpc_server/rpc_config.c
195+++ b/source3/rpc_server/rpc_config.c
196@@ -30,6 +30,8 @@
197 static struct dcesrv_context_callbacks srv_callbacks = {
198 .log.successful_authz = dcesrv_log_successful_authz,
199 .auth.gensec_prepare = dcesrv_auth_gensec_prepare,
200+ .auth.become_root = become_root,
201+ .auth.unbecome_root = unbecome_root,
202 .assoc_group.find = dcesrv_assoc_group_find,
203 };
204
205--- a/source4/rpc_server/service_rpc.c
206+++ b/source4/rpc_server/service_rpc.c
207@@ -40,9 +40,19 @@
208 #include "../libcli/named_pipe_auth/npa_tstream.h"
209 #include "smbd/process_model.h"
210
211+static void skip_become_root(void)
212+{
213+}
214+
215+static void skip_unbecome_root(void)
216+{
217+}
218+
219 struct dcesrv_context_callbacks srv_callbacks = {
220 .log.successful_authz = log_successful_dcesrv_authz_event,
221 .auth.gensec_prepare = dcesrv_gensec_prepare,
222+ .auth.become_root = skip_become_root,
223+ .auth.unbecome_root = skip_unbecome_root,
224 .assoc_group.find = dcesrv_assoc_group_find,
225 };
226
diff --git a/debian/patches/series b/debian/patches/series
index 0bdd339..7f61566 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -12,3 +12,4 @@ Rename-mdfind-to-mdsearch.patch
12ctdb-config-enable-syslog-by-default.patch12ctdb-config-enable-syslog-by-default.patch
13bug14918-1.patch13bug14918-1.patch
14bug14918-2.patch14bug14918-2.patch
15lp-1951490-fix-printing-KB5006743.patch

Subscribers

People subscribed via source and target branches