summaryrefslogtreecommitdiffstats
path: root/source/printing
diff options
context:
space:
mode:
authorGerald Carter <jerry@samba.org>2004-08-31 15:11:41 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 10:52:32 -0500
commit7474c6a446037f3ca2546cb6984d800bfc524029 (patch)
tree986c0271e14f38c054c7f46fa4e8ecf6fa4fff59 /source/printing
parent30da4e777191c557226d5615cee5a9e28b198a8b (diff)
downloadsamba-7474c6a446037f3ca2546cb6984d800bfc524029.tar.gz
samba-7474c6a446037f3ca2546cb6984d800bfc524029.tar.xz
samba-7474c6a446037f3ca2546cb6984d800bfc524029.zip
r2133: Several fixes:
* BUG 1627: fix for NIS compiles on HPUX 11.00, AIX 4.3 and 5.1 patch from Olaf Flebbe <o.flebbe@science-computing.de>. Will need to watch this one in the build farm. * Fix bug found by rwf@loonybin.net where the PRINT_ATTRIBUTE_PUBLISHED was getting reset by attempts to sanitize the defined attributes (PRINTER_ATTRIBUTE_SAMBA) * Resolve name conflict on DEC OSF-5.1 (inspired by patch from Adharsh Praveen <rprav@india.hp.com>) * Work around parsing error in the print change notify code (not that the alignment bug is still there but reording the entries in the array works around it). * remove duplicate declaration of getprintprocdir from rpcclient.
Diffstat (limited to 'source/printing')
-rw-r--r--source/printing/notify.c13
-rw-r--r--source/printing/nt_printing.c3
-rw-r--r--source/printing/printing.c29
3 files changed, 25 insertions, 20 deletions
diff --git a/source/printing/notify.c b/source/printing/notify.c
index 8d5be136071..10b5f745287 100644
--- a/source/printing/notify.c
+++ b/source/printing/notify.c
@@ -243,18 +243,21 @@ static void send_spoolss_notify2_msg(SPOOLSS_NOTIFY_MSG *msg)
* as they will just cause flickering updates in the client.
*/
- if ((num_messages < 100) && (msg->type == JOB_NOTIFY_TYPE) &&
- (msg->field == JOB_NOTIFY_TOTAL_BYTES || msg->field == JOB_NOTIFY_TOTAL_PAGES)) {
+ if ((num_messages < 100) && (msg->type == JOB_NOTIFY_TYPE)
+ && (msg->field == JOB_NOTIFY_TOTAL_BYTES
+ || msg->field == JOB_NOTIFY_TOTAL_PAGES ))
+ {
- for (tmp_ptr = notify_queue_head; tmp_ptr; tmp_ptr = tmp_ptr->next) {
+ for (tmp_ptr = notify_queue_head; tmp_ptr; tmp_ptr = tmp_ptr->next)
+ {
if (tmp_ptr->msg->type == msg->type &&
tmp_ptr->msg->field == msg->field &&
tmp_ptr->msg->id == msg->id &&
tmp_ptr->msg->flags == msg->flags &&
strequal(tmp_ptr->msg->printer, msg->printer)) {
- DEBUG(5, ("send_spoolss_notify2_msg: replacing message 0x%02x/0x%02x for printer %s \
-in notify_queue\n", msg->type, msg->field, msg->printer));
+ DEBUG(5,("send_spoolss_notify2_msg: replacing message 0x%02x/0x%02x for "
+ "printer %s in notify_queue\n", msg->type, msg->field, msg->printer));
tmp_ptr->msg = msg;
return;
diff --git a/source/printing/nt_printing.c b/source/printing/nt_printing.c
index b54e1f738d9..c3551c9d90a 100644
--- a/source/printing/nt_printing.c
+++ b/source/printing/nt_printing.c
@@ -3337,7 +3337,8 @@ static WERROR get_a_printer_2(NT_PRINTER_INFO_LEVEL_2 **info_ptr, const char *sh
info.parameters);
/* Samba has to have shared raw drivers. */
- info.attributes = PRINTER_ATTRIBUTE_SAMBA;
+ info.attributes |= PRINTER_ATTRIBUTE_SAMBA;
+ info.attributes &= ~PRINTER_ATTRIBUTE_NOT_SAMBA;
/* Restore the stripped strings. */
slprintf(info.servername, sizeof(info.servername)-1, "\\\\%s", get_called_name());
diff --git a/source/printing/printing.c b/source/printing/printing.c
index 31cb0faa9b0..8b93a433115 100644
--- a/source/printing/printing.c
+++ b/source/printing/printing.c
@@ -442,22 +442,30 @@ static void pjob_store_notify(int snum, uint32 jobid, struct printjob *old_data,
if (!old_data)
new_job = True;
- /* Notify the job name first */
-
- if (new_job || !strequal(old_data->jobname, new_data->jobname))
- notify_job_name(snum, jobid, new_data->jobname);
-
/* Job attributes that can't be changed. We only send
notification for these on a new job. */
+ /* ACHTUNG! Due to a bug in Samba's spoolss parsing of the
+ NOTIFY_INFO_DATA buffer, we *have* to send the job submission
+ time first or else we'll end up with potential alignment
+ errors. I don't think the systemtime should be spooled as
+ a string, but this gets us around that error.
+ --jerry (i'll feel dirty for this) */
+
if (new_job) {
notify_job_submitted(snum, jobid, new_data->starttime);
notify_job_username(snum, jobid, new_data->user);
}
+ if (new_job || !strequal(old_data->jobname, new_data->jobname))
+ notify_job_name(snum, jobid, new_data->jobname);
+
/* Job attributes of a new job or attributes that can be
modified. */
+ if (new_job || !strequal(old_data->jobname, new_data->jobname))
+ notify_job_name(snum, jobid, new_data->jobname);
+
if (new_job || old_data->status != new_data->status)
notify_job_status(snum, jobid, map_to_spoolss_status(new_data->status));
@@ -575,26 +583,19 @@ void pjob_delete(int snum, uint32 jobid)
return;
if (!pjob) {
- DEBUG(5, ("pjob_delete(): we were asked to delete nonexistent job %u\n",
+ DEBUG(5, ("pjob_delete: we were asked to delete nonexistent job %u\n",
(unsigned int)jobid));
release_print_db(pdb);
return;
}
- /* Send a notification that a job has been deleted */
-
- job_status = map_to_spoolss_status(pjob->status);
-
/* We must cycle through JOB_STATUS_DELETING and
JOB_STATUS_DELETED for the port monitor to delete the job
properly. */
- job_status |= JOB_STATUS_DELETING;
+ job_status = JOB_STATUS_DELETING|JOB_STATUS_DELETED;
notify_job_status(snum, jobid, job_status);
- job_status |= JOB_STATUS_DELETED;
- notify_job_status(snum, jobid, job_status);
-
/* Remove from printing.tdb */
tdb_delete(pdb->tdb, print_key(jobid));