summaryrefslogtreecommitdiff
path: root/source/printing
diff options
context:
space:
mode:
authorGerald Carter <jerry@samba.org>2004-09-01 21:03:29 +0000
committerGerald Carter <jerry@samba.org>2004-09-01 21:03:29 +0000
commit78ae4f9378cfc7e884a054088cbd088a2b18a6c8 (patch)
tree2890a157de50551a67e2655620fc82440ed36e1e /source/printing
parentf6eda18efebe9fc559aeb63d06505b5505cd9b41 (diff)
downloadsamba-78ae4f9378cfc7e884a054088cbd088a2b18a6c8.tar.gz
r2176: syncing necessary changes for 3.0.7
svn merge -r 1942:1946 $SVNURL/branches/SAMBA_3_0 svn merge -r 1946:1948 $SVNURL/branches/SAMBA_3_0 svn merge -r 1948:1964 $SVNURL/branches/SAMBA_3_0 svn merge -r 1967:1968 $SVNURL/branches/SAMBA_3_0 svn merge -r 1980:2001 $SVNURL/branches/SAMBA_3_0 svn merge -r 2001:2006 $SVNURL/branches/SAMBA_3_0 svn merge -r 2006:2007 $SVNURL/branches/SAMBA_3_0 svn merge -r 2007:2009 $SVNURL/branches/SAMBA_3_0 svn merge -r 2009:2013 $SVNURL/branches/SAMBA_3_0 svn merge -r 2013:2014 $SVNURL/branches/SAMBA_3_0 svn merge -r 2014:2015 $SVNURL/branches/SAMBA_3_0 svn merge -r 2015:2016 $SVNURL/branches/SAMBA_3_0 svn merge -r 2016:2018 $SVNURL/branches/SAMBA_3_0 svn merge -r 2022:2023 $SVNURL/branches/SAMBA_3_0 svn merge -r 2026:2027 $SVNURL/branches/SAMBA_3_0 svn merge -r 2057:2068 $SVNURL/branches/SAMBA_3_0 svn merge -r 2068:2070 $SVNURL/branches/SAMBA_3_0 svn merge -r 2076:2077 $SVNURL/branches/SAMBA_3_0 svn merge -r 2080:2082 $SVNURL/branches/SAMBA_3_0 svn merge -r 2082:2083 $SVNURL/branches/SAMBA_3_0 svn merge -r 2083:2086 $SVNURL/branches/SAMBA_3_0 svn merge -r 2086:2090 $SVNURL/branches/SAMBA_3_0 svn merge -r 2090:2091 $SVNURL/branches/SAMBA_3_0 svn merge -r 2091:2093 $SVNURL/branches/SAMBA_3_0 svn merge -r 2093:2111 $SVNURL/branches/SAMBA_3_0 svn merge -r 2116:2131 $SVNURL/branches/SAMBA_3_0 svn merge -r 2131:2133 $SVNURL/branches/SAMBA_3_0 svn merge -r 2133:2135 $SVNURL/branches/SAMBA_3_0 svn merge -r 2150:2152 $SVNURL/branches/SAMBA_3_0 svn merge -r 2147:2150 $SVNURL/branches/SAMBA_3_0 svn merge -r 2155:2157 $SVNURL/branches/SAMBA_3_0 svn merge -r 2163:2175 $SVNURL/branches/SAMBA_3_0
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
-rw-r--r--source/printing/printing_db.c2
4 files changed, 27 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 8c0302b4300..7850924aacb 100644
--- a/source/printing/nt_printing.c
+++ b/source/printing/nt_printing.c
@@ -3335,7 +3335,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));
diff --git a/source/printing/printing_db.c b/source/printing/printing_db.c
index 9efb3e8eadf..d45ad1cff79 100644
--- a/source/printing/printing_db.c
+++ b/source/printing/printing_db.c
@@ -37,6 +37,8 @@ struct tdb_print_db *get_print_db_byname(const char *printername)
pstring printdb_path;
BOOL done_become_root = False;
+ SMB_ASSERT(printername != NULL);
+
for (p = print_db_head, last_entry = print_db_head; p; p = p->next) {
/* Ensure the list terminates... JRA. */
SMB_ASSERT(p->next != print_db_head);