summaryrefslogtreecommitdiff
path: root/source3/printing
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2001-04-18 05:12:46 +0000
committerJeremy Allison <jra@samba.org>2001-04-18 05:12:46 +0000
commit6f78636a56106c510545dc1c8218b3a90a486c67 (patch)
treef8f9bdb15d1cdb94f030a9b4bacc7bbfe0f21ad3 /source3/printing
parenta40fe7b47d269d294b1bbf5c22d9a6d6c9f81e17 (diff)
downloadsamba-6f78636a56106c510545dc1c8218b3a90a486c67.tar.gz
samba-6f78636a56106c510545dc1c8218b3a90a486c67.tar.bz2
samba-6f78636a56106c510545dc1c8218b3a90a486c67.zip
Removed mktemp from HEAD - same as done in 2.2.
Jeremy. (This used to be commit 121b59669fbcd1aaedb08011ff36169fc6561c55)
Diffstat (limited to 'source3/printing')
-rw-r--r--source3/printing/printfsp.c4
-rw-r--r--source3/printing/printing.c23
2 files changed, 9 insertions, 18 deletions
diff --git a/source3/printing/printfsp.c b/source3/printing/printfsp.c
index 6a8e4bea45..6545dc59c2 100644
--- a/source3/printing/printfsp.c
+++ b/source3/printing/printfsp.c
@@ -29,7 +29,7 @@ open a print file and setup a fsp for it. This is a wrapper around
print_job_start().
***************************************************************************/
-files_struct *print_fsp_open(connection_struct *conn,char *jobname)
+files_struct *print_fsp_open(connection_struct *conn)
{
int jobid;
SMB_STRUCT_STAT sbuf;
@@ -39,7 +39,7 @@ files_struct *print_fsp_open(connection_struct *conn,char *jobname)
if(!fsp)
return NULL;
- jobid = print_job_start(&current_user, SNUM(conn), jobname);
+ jobid = print_job_start(&current_user, SNUM(conn), "smb.prn");
if (jobid == -1) {
file_free(fsp);
return NULL;
diff --git a/source3/printing/printing.c b/source3/printing/printing.c
index 753d0f7f96..d98c7c4d4c 100644
--- a/source3/printing/printing.c
+++ b/source3/printing/printing.c
@@ -386,7 +386,7 @@ static void print_queue_update(int snum)
/* get the current queue using the appropriate interface */
ZERO_STRUCT(status);
- qcount = (*(current_printif->queue_get))(snum, &queue, &status);
+ qcount = (*(current_printif->queue_get))(snum, &queue, &status);
DEBUG(3, ("%d job%s in queue for %s\n", qcount, (qcount != 1) ?
"s" : "", printer_name));
@@ -575,7 +575,7 @@ static BOOL print_job_delete1(int jobid)
print_job_store(jobid, pjob);
if (pjob->spooled && pjob->sysjob != -1)
- result = (*(current_printif->job_delete))(snum, pjob);
+ result = (*(current_printif->job_delete))(snum, pjob);
/* Delete the tdb entry if the delete suceeded or the job hasn't
been spooled. */
@@ -667,7 +667,7 @@ BOOL print_job_pause(struct current_user *user, int jobid, int *errcode)
}
/* need to pause the spooled entry */
- ret = (*(current_printif->job_pause))(snum, pjob);
+ ret = (*(current_printif->job_pause))(snum, pjob);
if (ret != 0) {
*errcode = ERROR_INVALID_PARAMETER;
@@ -892,7 +892,6 @@ int print_job_start(struct current_user *user, int snum, char *jobname)
/* lock the database */
tdb_lock_bystring(tdb, "INFO/nextjob");
- next_jobnum:
next_jobid = tdb_fetch_int(tdb, "INFO/nextjob");
if (next_jobid == -1) next_jobid = 1;
@@ -906,18 +905,10 @@ int print_job_start(struct current_user *user, int snum, char *jobname)
tdb_store_int(tdb, "INFO/nextjob", jobid);
- /* we have a job entry - now create the spool file
-
- we unlink first to cope with old spool files and also to beat
- a symlink security hole - it allows us to use O_EXCL
- There may be old spool files owned by other users lying around.
- */
- slprintf(pjob.filename, sizeof(pjob.filename)-1, "%s/%s%d",
- path, PRINT_SPOOL_PREFIX, jobid);
- if (unlink(pjob.filename) == -1 && errno != ENOENT) {
- goto next_jobnum;
- }
- pjob.fd = sys_open(pjob.filename,O_WRONLY|O_CREAT|O_EXCL,0600);
+ /* we have a job entry - now create the spool file */
+ slprintf(pjob.filename, sizeof(pjob.filename)-1, "%s/%sXXXXXX",
+ path, PRINT_SPOOL_PREFIX);
+ pjob.fd = smb_mkstemp(pjob.filename);
if (pjob.fd == -1) {
if (errno == EACCES) {