summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2002-09-04 23:40:49 +0000
committerJeremy Allison <jra@samba.org>2002-09-04 23:40:49 +0000
commit8828e2ea3c668aab6cda1b4be9a7e4ce1c23ca81 (patch)
tree6d8cff20dd2f1f4ed76187a555b675c2d0f74a6f
parent65047aee7fefefaecded9772184a54c046ab1784 (diff)
downloadsamba-8828e2ea3c668aab6cda1b4be9a7e4ce1c23ca81.tar.gz
samba-8828e2ea3c668aab6cda1b4be9a7e4ce1c23ca81.tar.xz
samba-8828e2ea3c668aab6cda1b4be9a7e4ce1c23ca81.zip
Added better error code on out of space. Removed total jobs check - not
applicable any more. Jeremy.
-rw-r--r--source/include/doserr.h13
-rw-r--r--source/printing/printing.c49
-rw-r--r--source/rpc_server/srv_spoolss_nt.c7
3 files changed, 16 insertions, 53 deletions
diff --git a/source/include/doserr.h b/source/include/doserr.h
index 135d799596c..93936463e68 100644
--- a/source/include/doserr.h
+++ b/source/include/doserr.h
@@ -148,17 +148,20 @@
/* these are win32 error codes. There are only a few places where
these matter for Samba, primarily in the NT printing code */
#define WERR_OK W_ERROR(0)
+#define WERR_BADFUNC W_ERROR(1)
#define WERR_BADFILE W_ERROR(2)
#define WERR_ACCESS_DENIED W_ERROR(5)
#define WERR_BADFID W_ERROR(6)
-#define WERR_BADFUNC W_ERROR(1)
-#define WERR_INSUFFICIENT_BUFFER W_ERROR(122)
+#define WERR_NOMEM W_ERROR(8)
+#define WERR_GENERAL_FAILURE W_ERROR(31)
+#define WERR_NOT_SUPPORTED W_ERROR(50)
+#define WERR_PRINTQ_FULL W_ERROR(61)
+#define WERR_NO_SPOOL_SPACE W_ERROR(62)
#define WERR_NO_SUCH_SHARE W_ERROR(67)
#define WERR_ALREADY_EXISTS W_ERROR(80)
-#define WERR_INVALID_PARAM W_ERROR(87)
-#define WERR_NOT_SUPPORTED W_ERROR(50)
#define WERR_BAD_PASSWORD W_ERROR(86)
-#define WERR_NOMEM W_ERROR(8)
+#define WERR_INVALID_PARAM W_ERROR(87)
+#define WERR_INSUFFICIENT_BUFFER W_ERROR(122)
#define WERR_INVALID_NAME W_ERROR(123)
#define WERR_UNKNOWN_LEVEL W_ERROR(124)
#define WERR_OBJECT_PATH_INVALID W_ERROR(161)
diff --git a/source/printing/printing.c b/source/printing/printing.c
index 0dacfe820cf..c6a210d0188 100644
--- a/source/printing/printing.c
+++ b/source/printing/printing.c
@@ -1265,42 +1265,6 @@ 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.
-****************************************************************************/
-
-static int get_total_jobs(void)
-{
- int total_jobs = 0;
- int snum;
- int services = lp_numservices();
-
- for (snum = 0; snum < services; snum++) {
- struct tdb_print_db *pdb;
- int jobs;
-
- if (!lp_print_ok(snum))
- continue;
-
- pdb = get_print_db_byname(lp_const_servicename(snum));
- if (!pdb)
- continue;
-
- /* make sure the database is up to date */
- if (print_cache_expired(snum))
- print_queue_update(snum);
-
- jobs = tdb_fetch_int32(pdb->tdb, "INFO/total_jobs");
- if (jobs > 0)
- total_jobs += jobs;
- release_print_db(pdb);
- }
- return total_jobs;
-}
-#endif /* JRATEST */
-
/***************************************************************************
Start spooling a job - return the jobid.
***************************************************************************/
@@ -1364,17 +1328,6 @@ 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",
- njobs, lp_totalprintjobs() ));
- release_print_db(pdb);
- errno = ENOSPC;
- return (uint32)-1;
- }
-#endif /* JRATEST */
-
/* create the database entry */
ZERO_STRUCT(pjob);
pjob.pid = local_pid;
@@ -1445,7 +1398,7 @@ to open spool file %s.\n", pjob.filename));
goto fail;
}
- pjob_store(snum, jobid, &pjob, False);
+ pjob_store(snum, jobid, &pjob, True);
release_print_db(pdb);
diff --git a/source/rpc_server/srv_spoolss_nt.c b/source/rpc_server/srv_spoolss_nt.c
index a20fa615fdb..02360574759 100644
--- a/source/rpc_server/srv_spoolss_nt.c
+++ b/source/rpc_server/srv_spoolss_nt.c
@@ -5159,6 +5159,13 @@ WERROR _spoolss_writeprinter(pipes_struct *p, SPOOL_Q_WRITEPRINTER *q_u, SPOOL_R
return WERR_BADFID;
(*buffer_written) = print_job_write(snum, Printer->jobid, (char *)buffer, buffer_size);
+ if (*buffer_written == -1) {
+ r_u->buffer_written = 0;
+ if (errno == ENOSPC)
+ return WERR_NO_SPOOL_SPACE;
+ else
+ return WERR_ACCESS_DENIED;
+ }
r_u->buffer_written = q_u->buffer_size2;