summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGerald Carter <jerry@samba.org>2002-09-11 19:29:02 +0000
committerGerald Carter <jerry@samba.org>2002-09-11 19:29:02 +0000
commit88b1f6810b27717146643de96e56cee60ea11b0a (patch)
treecac6dfb97345e36106bed846224e820f86e3a8f2
parentc989eaf48d18ed7547880a57a934690dc2519e90 (diff)
downloadsamba-88b1f6810b27717146643de96e56cee60ea11b0a.tar.gz
samba-88b1f6810b27717146643de96e56cee60ea11b0a.tar.bz2
samba-88b1f6810b27717146643de96e56cee60ea11b0a.zip
merge from APP_HEAD for GetJob()
(This used to be commit 3524a4a348686ae5144a744696606123e4a66622)
-rw-r--r--source3/rpc_server/srv_spoolss_nt.c38
1 files changed, 23 insertions, 15 deletions
diff --git a/source3/rpc_server/srv_spoolss_nt.c b/source3/rpc_server/srv_spoolss_nt.c
index ae5f132508..bcba89c2cc 100644
--- a/source3/rpc_server/srv_spoolss_nt.c
+++ b/source3/rpc_server/srv_spoolss_nt.c
@@ -8027,8 +8027,6 @@ static WERROR getjob_level_1(print_queue_struct *queue, int count, int snum, uin
fill_job_info_1(info_1, &(queue[i-1]), i, snum);
- SAFE_FREE(queue);
-
*needed += spoolss_size_job_info_1(info_1);
if (!alloc_buffer_size(buffer, *needed)) {
@@ -8067,12 +8065,14 @@ static WERROR getjob_level_2(print_queue_struct *queue, int count, int snum, uin
goto done;
}
- for (i=0; i<count && found==False; i++) {
- if (queue[i].job==(int)jobid)
- found=True;
+ for ( i=0; i<count && found==False; i++ )
+ {
+ if (queue[i].job == (int)jobid)
+ found = True;
}
- if (found==False) {
+ if ( !found )
+ {
/* NT treats not found as bad param... yet another bad
choice */
ret = WERR_INVALID_PARAM;
@@ -8082,7 +8082,8 @@ static WERROR getjob_level_2(print_queue_struct *queue, int count, int snum, uin
ret = get_a_printer(&ntprinter, 2, lp_servicename(snum));
if (!W_ERROR_IS_OK(ret))
goto done;
- if (construct_dev_mode(snum) == NULL) {
+
+ if (!(devmode = construct_dev_mode(snum)) ) {
ret = WERR_NOMEM;
goto done;
}
@@ -8108,7 +8109,6 @@ static WERROR getjob_level_2(print_queue_struct *queue, int count, int snum, uin
done:
/* Cleanup allocated memory */
- SAFE_FREE(queue);
free_job_info_2(info_2); /* Also frees devmode */
SAFE_FREE(info_2);
free_a_printer(&ntprinter, 2);
@@ -8127,10 +8127,11 @@ WERROR _spoolss_getjob( pipes_struct *p, SPOOL_Q_GETJOB *q_u, SPOOL_R_GETJOB *r_
NEW_BUFFER *buffer = NULL;
uint32 offered = q_u->offered;
uint32 *needed = &r_u->needed;
+ WERROR wstatus = WERR_OK;
int snum;
int count;
- print_queue_struct *queue=NULL;
+ print_queue_struct *queue = NULL;
print_status_struct prt_status;
/* that's an [in out] buffer */
@@ -8139,7 +8140,7 @@ WERROR _spoolss_getjob( pipes_struct *p, SPOOL_Q_GETJOB *q_u, SPOOL_R_GETJOB *r_
DEBUG(5,("spoolss_getjob\n"));
- *needed=0;
+ *needed = 0;
if (!get_printer_snum(p, handle, &snum))
return WERR_BADFID;
@@ -8149,15 +8150,22 @@ WERROR _spoolss_getjob( pipes_struct *p, SPOOL_Q_GETJOB *q_u, SPOOL_R_GETJOB *r_
DEBUGADD(4,("count:[%d], prt_status:[%d], [%s]\n",
count, prt_status.status, prt_status.message));
- switch (level) {
+ switch ( level ) {
case 1:
- return getjob_level_1(queue, count, snum, jobid, buffer, offered, needed);
+ wstatus = getjob_level_1(queue, count, snum, jobid,
+ buffer, offered, needed);
+ break;
case 2:
- return getjob_level_2(queue, count, snum, jobid, buffer, offered, needed);
+ wstatus = getjob_level_2(queue, count, snum, jobid,
+ buffer, offered, needed);
+ break;
default:
- SAFE_FREE(queue);
- return WERR_UNKNOWN_LEVEL;
+ wstatus = WERR_UNKNOWN_LEVEL;
+ break;
}
+
+ SAFE_FREE(queue);
+ return wstatus;
}
/********************************************************************