summaryrefslogtreecommitdiff
path: root/source3/printing
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2002-09-04 19:13:06 +0000
committerJeremy Allison <jra@samba.org>2002-09-04 19:13:06 +0000
commita1aafce4dc69b4bc4967ce9b70550ee3ecfab43b (patch)
treecb9d0440971ec41211f7de1dc095b90469961d97 /source3/printing
parent65029365ba9e2df821a57173c7532e4cbc7b06e9 (diff)
downloadsamba-a1aafce4dc69b4bc4967ce9b70550ee3ecfab43b.tar.gz
samba-a1aafce4dc69b4bc4967ce9b70550ee3ecfab43b.tar.bz2
samba-a1aafce4dc69b4bc4967ce9b70550ee3ecfab43b.zip
Add bcast_msg_flags to connection struct. Allows sender to filter when
sending broadcast messages. Also initial cut-down of printing notify messages (not yet finished). Jeremy. (This used to be commit aca333719695b278843c59e1c6eb07d6655fd59c)
Diffstat (limited to 'source3/printing')
-rw-r--r--source3/printing/printing.c30
1 files changed, 18 insertions, 12 deletions
diff --git a/source3/printing/printing.c b/source3/printing/printing.c
index f3ee1a0d63..0dacfe820c 100644
--- a/source3/printing/printing.c
+++ b/source3/printing/printing.c
@@ -460,7 +460,7 @@ static void pjob_store_notify(int snum, uint32 jobid, struct printjob *old_data,
Store a job structure back to the database.
****************************************************************************/
-static BOOL pjob_store(int snum, uint32 jobid, struct printjob *pjob)
+static BOOL pjob_store(int snum, uint32 jobid, struct printjob *pjob, BOOL donotify)
{
TDB_DATA old_data, new_data;
BOOL ret;
@@ -483,7 +483,7 @@ static BOOL pjob_store(int snum, uint32 jobid, struct printjob *pjob)
/* Send notify updates for what has changed */
- if (ret && (old_data.dsize == 0 || old_data.dsize == sizeof(*pjob))) {
+ if (donotify && ret && (old_data.dsize == 0 || old_data.dsize == sizeof(*pjob))) {
pjob_store_notify(
snum, jobid, (struct printjob *)old_data.dptr,
(struct printjob *)new_data.dptr);
@@ -581,7 +581,7 @@ static void print_unix_job(int snum, print_queue_struct *q)
fstrcpy(pj.user, q->fs_user);
fstrcpy(pj.queuename, lp_const_servicename(snum));
- pjob_store(snum, jobid, &pj);
+ pjob_store(snum, jobid, &pj, True);
}
@@ -868,7 +868,7 @@ static void print_queue_update(int snum)
pjob->sysjob = queue[i].job;
pjob->status = queue[i].status;
- pjob_store(snum, jobid, pjob);
+ pjob_store(snum, jobid, pjob, True);
}
/* now delete any queued entries that don't appear in the
@@ -977,7 +977,7 @@ BOOL print_job_set_name(int snum, uint32 jobid, char *name)
return False;
fstrcpy(pjob->jobname, name);
- return pjob_store(snum, jobid, pjob);
+ return pjob_store(snum, jobid, pjob, True);
}
/****************************************************************************
@@ -1009,7 +1009,7 @@ static BOOL print_job_delete1(int snum, uint32 jobid)
/* Set the tdb entry to be deleting. */
pjob->status = LPQ_DELETING;
- pjob_store(snum, jobid, pjob);
+ pjob_store(snum, jobid, pjob, True);
if (pjob->spooled && pjob->sysjob != -1)
result = (*(current_printif->job_delete))(snum, pjob);
@@ -1172,7 +1172,7 @@ int print_job_write(int snum, uint32 jobid, const char *buf, int size)
return_code = write(pjob->fd, buf, size);
if (return_code>0) {
pjob->size += size;
- pjob_store(snum, jobid, pjob);
+ pjob_store(snum, jobid, pjob, True);
}
return return_code;
}
@@ -1265,6 +1265,7 @@ int print_queue_length(int snum, print_status_struct *pstatus)
return len;
}
+#if 0 /* JRATEST */
/****************************************************************************
Determine the number of jobs in all queues. This is very expensive. Don't
call ! JRA.
@@ -1298,6 +1299,7 @@ static int get_total_jobs(void)
}
return total_jobs;
}
+#endif /* JRATEST */
/***************************************************************************
Start spooling a job - return the jobid.
@@ -1362,6 +1364,7 @@ uint32 print_job_start(struct current_user *user, int snum, char *jobname)
return (uint32)-1;
}
+#if 0 /* JRATEST */
/* Insure the maximum print jobs in the system is not violated */
if (lp_totalprintjobs() && get_total_jobs() > lp_totalprintjobs()) {
DEBUG(3, ("print_job_start: number of jobs (%d) larger than max printjobs per system (%d).\n",
@@ -1370,6 +1373,7 @@ uint32 print_job_start(struct current_user *user, int snum, char *jobname)
errno = ENOSPC;
return (uint32)-1;
}
+#endif /* JRATEST */
/* create the database entry */
ZERO_STRUCT(pjob);
@@ -1407,7 +1411,7 @@ uint32 print_job_start(struct current_user *user, int snum, char *jobname)
if (!print_job_exists(snum, jobid))
break;
}
- if (jobid == next_jobid || !pjob_store(snum, jobid, &pjob)) {
+ if (jobid == next_jobid || !pjob_store(snum, jobid, &pjob, False)) {
DEBUG(3, ("print_job_start: either jobid (%d)==next_jobid(%d) or pjob_store failed.\n",
jobid, next_jobid ));
jobid = -1;
@@ -1420,6 +1424,9 @@ uint32 print_job_start(struct current_user *user, int snum, char *jobname)
goto fail;
}
+ /* We've finished with the INFO/nextjob lock. */
+ tdb_unlock_bystring(pdb->tdb, "INFO/nextjob");
+
/* we have a job entry - now create the spool file */
slprintf(pjob.filename, sizeof(pjob.filename)-1, "%s/%s%.8u.XXXXXX",
path, PRINT_SPOOL_PREFIX, (unsigned int)jobid);
@@ -1438,9 +1445,8 @@ to open spool file %s.\n", pjob.filename));
goto fail;
}
- pjob_store(snum, jobid, &pjob);
+ pjob_store(snum, jobid, &pjob, False);
- tdb_unlock_bystring(pdb->tdb, "INFO/nextjob");
release_print_db(pdb);
/*
@@ -1481,7 +1487,7 @@ void print_job_endpage(int snum, uint32 jobid)
return;
pjob->page_count++;
- pjob_store(snum, jobid, pjob);
+ pjob_store(snum, jobid, pjob, True);
}
/****************************************************************************
@@ -1539,7 +1545,7 @@ BOOL print_job_end(int snum, uint32 jobid, BOOL normal_close)
pjob->spooled = True;
pjob->status = LPQ_QUEUED;
- pjob_store(snum, jobid, pjob);
+ pjob_store(snum, jobid, pjob, True);
/* make sure the database is up to date */
if (print_cache_expired(snum))