You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
openwrt/package/network/services/samba36/patches/200-remove_printer_support....

357 lines
8.6 KiB
Diff

--- 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
@@ -153,6 +153,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
@@ -7791,6 +7791,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
@@ -5194,7 +5194,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;
@@ -5300,7 +5304,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;
}
@@ -3350,6 +3358,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;
}
@@ -3483,6 +3495,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;
}
@@ -3649,6 +3665,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;
}
@@ -4792,6 +4812,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;
}
@@ -4930,6 +4954,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;
}
@@ -5135,6 +5163,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;
}
@@ -5271,6 +5303,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;
}
@@ -5374,6 +5410,10 @@ static bool api_WPrintDriverEnum(struct
int succnt;
struct pack_desc desc;
+#ifndef PRINTER_SUPPORT
+ return False;
+#endif
+
if (!str1 || !str2 || !p) {
return False;
}
@@ -5438,6 +5478,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;
}
@@ -5502,6 +5546,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
@@ -142,7 +142,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
@@ -1556,6 +1556,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
@@ -638,6 +638,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
@@ -485,7 +485,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
@@ -2475,8 +2475,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
@@ -126,7 +126,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);
@@ -1211,8 +1213,10 @@ extern void build_options(bool screen);
if (!W_ERROR_IS_OK(registry_init_full()))
exit(1);
+#ifdef PRINTER_SUPPORT
if (!print_backend_init(smbd_messaging_context()))
exit(1);
+#endif
/* Open the share_info.tdb here, so we don't have to open
after the fork on every single connection. This is a small
@@ -1256,6 +1260,7 @@ extern void build_options(bool screen);
exit(1);
}
+#ifdef PRINTER_SUPPORT
/* Publish nt printers, this requires a working winreg pipe */
pcap_cache_reload(server_event_context(), smbd_messaging_context(),
&reload_printers);
@@ -1284,6 +1289,7 @@ extern void build_options(bool screen);
smbd_messaging_context());
}
}
+#endif
if (!is_daemon) {
/* inetd mode */