summaryrefslogtreecommitdiffstats
path: root/source
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2002-01-24 23:04:29 +0000
committerJeremy Allison <jra@samba.org>2002-01-24 23:04:29 +0000
commit639c72e61c95de52c4059673ceaeedaa2bc0563d (patch)
tree60cad5c9fcfd96c8209dbc1af169632956fed583 /source
parentb7cc8d71aee293359378b3a1e3ddcdde5d40f472 (diff)
downloadsamba-639c72e61c95de52c4059673ceaeedaa2bc0563d.tar.gz
samba-639c72e61c95de52c4059673ceaeedaa2bc0563d.tar.xz
samba-639c72e61c95de52c4059673ceaeedaa2bc0563d.zip
A *disgusting* hack to make some driver initialisation work. Not as bad
as the older srvsvc hack - but close.... Jeremy.
Diffstat (limited to 'source')
-rw-r--r--source/rpc_server/srv_pipe_hnd.c29
1 files changed, 28 insertions, 1 deletions
diff --git a/source/rpc_server/srv_pipe_hnd.c b/source/rpc_server/srv_pipe_hnd.c
index 0b0936356a6..65725bc2baa 100644
--- a/source/rpc_server/srv_pipe_hnd.c
+++ b/source/rpc_server/srv_pipe_hnd.c
@@ -35,6 +35,18 @@ static int pipes_open;
#define MAX_OPEN_PIPES 2048
#endif
+/*
+ * Sometimes I can't decide if I hate Windows printer driver
+ * writers more than I hate the Windows spooler service driver
+ * writers. This gets around a combination of bugs in the spooler
+ * and the HP 8500 PCL driver that causes a spooler spin. JRA.
+ */
+
+#ifndef MAX_OPEN_SPOOLSS_PIPES
+#define MAX_OPEN_SPOOLSS_PIPES 20
+#endif
+static int current_spoolss_pipes_open;
+
static pipes_struct *Pipes;
static struct bitmap *bmap;
@@ -126,11 +138,20 @@ pipes_struct *open_rpc_pipe_p(char *pipe_name,
int i;
pipes_struct *p;
static int next_pipe;
+ BOOL is_spoolss_pipe = False;
DEBUG(4,("Open pipe requested %s (pipes_open=%d)\n",
pipe_name, pipes_open));
-
+ if (strstr(pipe_name, "spoolss"))
+ is_spoolss_pipe = True;
+
+ if (is_spoolss_pipe && current_spoolss_pipes_open >= MAX_OPEN_SPOOLSS_PIPES) {
+ DEBUG(10,("open_rpc_pipe_p: spooler bug workaround. Denying open on pipe %s\n",
+ pipe_name ));
+ return NULL;
+ }
+
/* not repeating pipe numbers makes it easier to track things in
log files and prevents client bugs where pipe numbers are reused
over connection restarts */
@@ -243,6 +264,9 @@ pipes_struct *open_rpc_pipe_p(char *pipe_name,
for (p = Pipes; p; p = p->next)
DEBUG(5,("open pipes: name %s pnum=%x\n", p->name, p->pnum));
+ if (is_spoolss_pipe)
+ current_spoolss_pipes_open++;
+
return chain_p;
}
@@ -906,6 +930,9 @@ BOOL close_rpc_pipe_hnd(pipes_struct *p, connection_struct *conn)
return False;
}
+ if (strstr(p->name, "spoolss"))
+ current_spoolss_pipes_open--;
+
prs_mem_free(&p->out_data.rdata);
prs_mem_free(&p->in_data.data);