aboutsummaryrefslogtreecommitdiffstats
path: root/unmaintained/samba36/200-remove_printer_support.patch
blob: de567a7627911841759a81d369de2bb06a0af72f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
--- a/source3/rpc_server/rpc_ep_setup.c
+++ b/source3/rpc_server/rpc_ep_setup.c
@@ -1110,6 +1110,10 @@ bool dcesrv_ep_setup(struct tevent_conte
 					   "rpc_server",
 					   "spoolss",
 					   "embedded");
+#ifndef PRINTER_SUPPORT
+	if (1) {
+	} else
+#endif
 	if (StrCaseCmp(rpcsrv_type, "embedded") == 0) {
 		spoolss_cb.init         = spoolss_init_cb;
 		spoolss_cb.shutdown     = spoolss_shutdown_cb;
--- a/source3/rpcclient/rpcclient.c
+++ b/source3/rpcclient/rpcclient.c
@@ -624,7 +624,9 @@ static struct cmd_set *rpcclient_command
 	lsarpc_commands,
 	ds_commands,
 	samr_commands,
+#ifdef PRINTER_SUPPORT
 	spoolss_commands,
+#endif
 	netlogon_commands,
 	srvsvc_commands,
 	dfs_commands,
--- a/source3/printing/spoolssd.c
+++ b/source3/printing/spoolssd.c
@@ -165,6 +165,10 @@ void start_spoolssd(struct tevent_contex
 	NTSTATUS status;
 	int ret;
 
+#ifndef PRINTER_SUPPORT
+	return;
+#endif
+
 	DEBUG(1, ("Forking SPOOLSS Daemon\n"));
 
 	pid = sys_fork();
--- a/source3/utils/net_rpc.c
+++ b/source3/utils/net_rpc.c
@@ -7841,6 +7841,10 @@ int net_rpc_printer(struct net_context *
 		{NULL, NULL, 0, NULL, NULL}
 	};
 
+#ifndef PRINTER_SUPPORT
+	return 0;
+#endif
+
 	if (argc == 0) {
 		if (c->display_usage) {
 			d_printf(_("Usage:\n"));
--- a/source3/smbd/reply.c
+++ b/source3/smbd/reply.c
@@ -5208,7 +5208,11 @@ void reply_printopen(struct smb_request
 		return;
 	}
 
-	if (!CAN_PRINT(conn)) {
+
+#ifdef PRINTER_SUPPORT
+	if (!CAN_PRINT(conn))
+#endif
+	{
 		reply_nterror(req, NT_STATUS_ACCESS_DENIED);
 		END_PROFILE(SMBsplopen);
 		return;
@@ -5314,7 +5318,10 @@ void reply_printqueue(struct smb_request
 	   is really quite gross and only worked when there was only
 	   one printer - I think we should now only accept it if they
 	   get it right (tridge) */
-	if (!CAN_PRINT(conn)) {
+#ifdef PRINTER_SUPPORT
+	if (!CAN_PRINT(conn))
+#endif
+	{
 		reply_nterror(req, NT_STATUS_ACCESS_DENIED);
 		END_PROFILE(SMBsplretq);
 		return;
--- a/source3/smbd/lanman.c
+++ b/source3/smbd/lanman.c
@@ -784,6 +784,10 @@ static bool api_DosPrintQGetInfo(struct
 	union spoolss_JobInfo *job_info = NULL;
 	union spoolss_PrinterInfo printer_info;
 
+#ifndef PRINTER_SUPPORT
+	return False;
+#endif
+
 	if (!str1 || !str2 || !p) {
 		return False;
 	}
@@ -999,6 +1003,10 @@ static bool api_DosPrintQEnum(struct smb
 	union spoolss_DriverInfo *driver_info;
 	union spoolss_JobInfo **job_info;
 
+#ifndef PRINTER_SUPPORT
+	return False;
+#endif
+
 	if (!param_format || !output_format1 || !p) {
 		return False;
 	}
@@ -3105,6 +3113,10 @@ static bool api_RDosPrintJobDel(struct s
 	struct spoolss_DevmodeContainer devmode_ctr;
 	enum spoolss_JobControl command;
 
+#ifndef PRINTER_SUPPORT
+	return False;
+#endif
+
 	if (!str1 || !str2 || !p) {
 		return False;
 	}
@@ -3238,6 +3250,10 @@ static bool api_WPrintQueueCtrl(struct s
 	struct sec_desc_buf secdesc_ctr;
 	enum spoolss_PrinterControl command;
 
+#ifndef PRINTER_SUPPORT
+	return False;
+#endif
+
 	if (!str1 || !str2 || !QueueName) {
 		return False;
 	}
@@ -3404,6 +3420,10 @@ static bool api_PrintJobInfo(struct smbd
 	union spoolss_JobInfo info;
 	struct spoolss_SetJobInfo1 info1;
 
+#ifndef PRINTER_SUPPORT
+	return False;
+#endif
+
 	if (!str1 || !str2 || !p) {
 		return False;
 	}
@@ -4547,6 +4567,10 @@ static bool api_WPrintJobGetInfo(struct
 	struct spoolss_DevmodeContainer devmode_ctr;
 	union spoolss_JobInfo info;
 
+#ifndef PRINTER_SUPPORT
+	return False;
+#endif
+
 	if (!str1 || !str2 || !p) {
 		return False;
 	}
@@ -4685,6 +4709,10 @@ static bool api_WPrintJobEnumerate(struc
 	uint32_t count = 0;
 	union spoolss_JobInfo *info;
 
+#ifndef PRINTER_SUPPORT
+	return False;
+#endif
+
 	if (!str1 || !str2 || !p) {
 		return False;
 	}
@@ -4890,6 +4918,10 @@ static bool api_WPrintDestGetInfo(struct
 	struct spoolss_DevmodeContainer devmode_ctr;
 	union spoolss_PrinterInfo info;
 
+#ifndef PRINTER_SUPPORT
+	return False;
+#endif
+
 	if (!str1 || !str2 || !p) {
 		return False;
 	}
@@ -5026,6 +5058,10 @@ static bool api_WPrintDestEnum(struct sm
 	union spoolss_PrinterInfo *info;
 	uint32_t count;
 
+#ifndef PRINTER_SUPPORT
+	return False;
+#endif
+
 	if (!str1 || !str2 || !p) {
 		return False;
 	}
@@ -5129,6 +5165,10 @@ static bool api_WPrintDriverEnum(struct
 	int succnt;
 	struct pack_desc desc;
 
+#ifndef PRINTER_SUPPORT
+	return False;
+#endif
+
 	if (!str1 || !str2 || !p) {
 		return False;
 	}
@@ -5193,6 +5233,10 @@ static bool api_WPrintQProcEnum(struct s
 	int succnt;
 	struct pack_desc desc;
 
+#ifndef PRINTER_SUPPORT
+	return False;
+#endif
+
 	if (!str1 || !str2 || !p) {
 		return False;
 	}
@@ -5257,6 +5301,10 @@ static bool api_WPrintPortEnum(struct sm
 	int succnt;
 	struct pack_desc desc;
 
+#ifndef PRINTER_SUPPORT
+	return False;
+#endif
+
 	if (!str1 || !str2 || !p) {
 		return False;
 	}
--- a/source3/smbd/server_exit.c
+++ b/source3/smbd/server_exit.c
@@ -141,7 +141,9 @@ static void exit_server_common(enum serv
 		rpc_eventlog_shutdown();
 		rpc_ntsvcs_shutdown();
 		rpc_svcctl_shutdown();
+#ifdef PRINTER_SUPPORT
 		rpc_spoolss_shutdown();
+#endif
 
 		rpc_srvsvc_shutdown();
 		rpc_winreg_shutdown();
--- a/source3/smbd/open.c
+++ b/source3/smbd/open.c
@@ -1608,6 +1608,9 @@ static NTSTATUS open_file_ntcreate(conne
 		 * Most of the passed parameters are ignored.
 		 */
 
+#ifndef PRINTER_SUPPORT
+		return NT_STATUS_ACCESS_DENIED;
+#endif
 		if (pinfo) {
 			*pinfo = FILE_WAS_CREATED;
 		}
--- a/source3/smbd/close.c
+++ b/source3/smbd/close.c
@@ -643,6 +643,9 @@ static NTSTATUS close_normal_file(struct
 	status = ntstatus_keeperror(status, tmp);
 
 	if (fsp->print_file) {
+#ifndef PRINTER_SUPPORT
+		return NT_STATUS_OK;
+#endif
 		/* FIXME: return spool errors */
 		print_spool_end(fsp, close_type);
 		file_free(req, fsp);
--- a/source3/smbd/fileio.c
+++ b/source3/smbd/fileio.c
@@ -298,6 +298,10 @@ ssize_t write_file(struct smb_request *r
 		uint32_t t;
 		int ret;
 
+#ifndef PRINTER_SUPPORT
+		return -1;
+#endif
+
 		ret = print_spool_write(fsp, data, n, pos, &t);
 		if (ret) {
 			errno = ret;
--- a/source3/smbd/smb2_create.c
+++ b/source3/smbd/smb2_create.c
@@ -486,7 +486,10 @@ static struct tevent_req *smbd_smb2_crea
 		info = FILE_WAS_OPENED;
 	} else if (CAN_PRINT(smb1req->conn)) {
 		status = file_new(smb1req, smb1req->conn, &result);
-		if(!NT_STATUS_IS_OK(status)) {
+#ifdef PRINTER_SUPPORT
+		if(!NT_STATUS_IS_OK(status))
+#endif
+		{
 			tevent_req_nterror(req, status);
 			return tevent_req_post(req, ev);
 		}
--- a/source3/rpc_server/svcctl/srv_svcctl_nt.c
+++ b/source3/rpc_server/svcctl/srv_svcctl_nt.c
@@ -85,9 +85,11 @@ bool init_service_op_table( void )
 
 	/* add builtin services */
 
+#ifdef PRINTER_SUPPORT
 	svcctl_ops[i].name = talloc_strdup( svcctl_ops, "Spooler" );
 	svcctl_ops[i].ops  = &spoolss_svc_ops;
 	i++;
+#endif
 
 	svcctl_ops[i].name = talloc_strdup( svcctl_ops, "NETLOGON" );
 	svcctl_ops[i].ops  = &netlogon_svc_ops;
--- a/source3/librpc/rpc/rpc_common.c
+++ b/source3/librpc/rpc/rpc_common.c
@@ -113,9 +113,11 @@ static bool initialize_interfaces(void)
 	if (!smb_register_ndr_interface(&ndr_table_winreg)) {
 		return false;
 	}
+#ifdef PRINTER_SUPPORT
 	if (!smb_register_ndr_interface(&ndr_table_spoolss)) {
 		return false;
 	}
+#endif
 	if (!smb_register_ndr_interface(&ndr_table_netdfs)) {
 		return false;
 	}
--- a/source3/smbd/process.c
+++ b/source3/smbd/process.c
@@ -2423,8 +2423,10 @@ static bool housekeeping_fn(const struct
 
 	change_to_root_user();
 
+#ifdef PRINTER_SUPPORT
 	/* update printer queue caches if necessary */
 	update_monitored_printq_cache(sconn->msg_ctx);
+#endif
 
 	/* check if we need to reload services */
 	check_reload(sconn, time_mono(NULL));
--- a/source3/smbd/server.c
+++ b/source3/smbd/server.c
@@ -123,7 +123,9 @@ static void smb_pcap_updated(struct mess
 {
 	struct tevent_context *ev_ctx =
 		talloc_get_type_abort(private_data, struct tevent_context);
-
+#ifndef PRINTER_SUPPORT
+	return;
+#endif
 	DEBUG(10,("Got message saying pcap was updated. Reloading.\n"));
 	change_to_root_user();
 	reload_printers(ev_ctx, msg);
@@ -1277,6 +1279,7 @@ extern void build_options(bool screen);
 	 * The print backend init also migrates the printing tdb's,
 	 * this requires a winreg pipe.
 	 */
+#ifdef PRINTER_SUPPORT
 	if (!print_backend_init(smbd_messaging_context()))
 		exit(1);
 
@@ -1315,7 +1318,7 @@ extern void build_options(bool screen);
 				       smbd_messaging_context());
 		}
 	}
-
+#endif
 	if (!is_daemon) {
 		/* inetd mode */
 		TALLOC_FREE(frame);