summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2000-06-29 00:52:40 +0000
committerJeremy Allison <jra@samba.org>2000-06-29 00:52:40 +0000
commit774b06ee212ee764fb2e17c1f366d0de552c07cc (patch)
tree2fbe91f19a15052415c022e4a7d6d56dbbbf3775 /source3
parent8980d53e7ccd85769357c45183b8670123489fb5 (diff)
downloadsamba-774b06ee212ee764fb2e17c1f366d0de552c07cc.tar.gz
samba-774b06ee212ee764fb2e17c1f366d0de552c07cc.tar.bz2
samba-774b06ee212ee764fb2e17c1f366d0de552c07cc.zip
Tidy up current spool code - added some JRATEST ifdefs to allow
experimentation with what is making spoolss.exe crash - may be removed later. Jeremy. (This used to be commit f3fe384dc39ce49c639a7adf35179a50cb86abf0)
Diffstat (limited to 'source3')
-rw-r--r--source3/printing/nt_printing.c2
-rw-r--r--source3/rpc_parse/parse_spoolss.c22
-rw-r--r--source3/rpc_server/srv_spoolss_nt.c33
3 files changed, 29 insertions, 28 deletions
diff --git a/source3/printing/nt_printing.c b/source3/printing/nt_printing.c
index 30743a4113..d599d167ec 100644
--- a/source3/printing/nt_printing.c
+++ b/source3/printing/nt_printing.c
@@ -1115,7 +1115,7 @@ static uint32 get_a_printer_2(NT_PRINTER_INFO_LEVEL_2 **info_ptr, fstring sharen
len += unpack_devicemode(&info.devmode,dbuf.dptr+len, dbuf.dsize-len);
len += unpack_specifics(&info.specific,dbuf.dptr+len, dbuf.dsize-len);
-#if 0 /* JRATEST */
+#if 1 /* JRATEST */
nt_printing_getsec(sharename, &info.secdesc_buf);
#endif /* JRATEST */
diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c
index 0c12623e47..de20b684cc 100644
--- a/source3/rpc_parse/parse_spoolss.c
+++ b/source3/rpc_parse/parse_spoolss.c
@@ -823,9 +823,9 @@ BOOL spoolss_io_r_getprinterdata(char *desc, SPOOL_R_GETPRINTERDATA *r_u, prs_st
if (!prs_align(ps))
return False;
- if (!prs_uint32("type", ps, depth, &(r_u->type)))
+ if (!prs_uint32("type", ps, depth, &r_u->type))
return False;
- if (!prs_uint32("size", ps, depth, &(r_u->size)))
+ if (!prs_uint32("size", ps, depth, &r_u->size))
return False;
if (!prs_uint8s(False,"data", ps, depth, r_u->data, r_u->size))
@@ -834,9 +834,9 @@ BOOL spoolss_io_r_getprinterdata(char *desc, SPOOL_R_GETPRINTERDATA *r_u, prs_st
if (!prs_align(ps))
return False;
- if (!prs_uint32("needed", ps, depth, &(r_u->needed)))
+ if (!prs_uint32("needed", ps, depth, &r_u->needed))
return False;
- if (!prs_uint32("status", ps, depth, &(r_u->status)))
+ if (!prs_uint32("status", ps, depth, &r_u->status))
return False;
return True;
@@ -2844,7 +2844,7 @@ BOOL spoolss_io_r_getprinter(char *desc, SPOOL_R_GETPRINTER *r_u, prs_struct *ps
if (!prs_align(ps))
return False;
-
+
if (!prs_uint32("needed", ps, depth, &r_u->needed))
return False;
@@ -4545,18 +4545,18 @@ BOOL spoolss_io_q_setprinterdata(char *desc, SPOOL_Q_SETPRINTERDATA *q_u, prs_st
if(!prs_align(ps))
return False;
- if(!smb_io_pol_hnd("printer handle", &(q_u->handle), ps, depth))
+ if(!smb_io_pol_hnd("printer handle", &q_u->handle, ps, depth))
return False;
- if(!smb_io_unistr2("", &(q_u->value), True, ps, depth))
+ if(!smb_io_unistr2("", &q_u->value, True, ps, depth))
return False;
if(!prs_align(ps))
return False;
- if(!prs_uint32("type", ps, depth, &(q_u->type)))
+ if(!prs_uint32("type", ps, depth, &q_u->type))
return False;
- if(!prs_uint32("max_len", ps, depth, &(q_u->max_len)))
+ if(!prs_uint32("max_len", ps, depth, &q_u->max_len))
return False;
switch (q_u->type)
@@ -4575,7 +4575,7 @@ BOOL spoolss_io_q_setprinterdata(char *desc, SPOOL_Q_SETPRINTERDATA *q_u, prs_st
break;
}
- if(!prs_uint32("real_len", ps, depth, &(q_u->real_len)))
+ if(!prs_uint32("real_len", ps, depth, &q_u->real_len))
return False;
return True;
@@ -4595,7 +4595,7 @@ BOOL spoolss_io_r_setprinterdata(char *desc, SPOOL_R_SETPRINTERDATA *r_u, prs_st
if(!prs_align(ps))
return False;
- if(!prs_uint32("status", ps, depth, &(r_u->status)))
+ if(!prs_uint32("status", ps, depth, &r_u->status))
return False;
return True;
diff --git a/source3/rpc_server/srv_spoolss_nt.c b/source3/rpc_server/srv_spoolss_nt.c
index cd5f829a83..7259ccc428 100644
--- a/source3/rpc_server/srv_spoolss_nt.c
+++ b/source3/rpc_server/srv_spoolss_nt.c
@@ -1356,8 +1356,7 @@ static BOOL construct_notify_printer_info(SPOOL_NOTIFY_INFO *info, int snum, SPO
if (get_a_printer(&printer, 2, lp_servicename(snum))!=0)
return False;
- for(field_num=0; field_num<option_type->count; field_num++)
- {
+ for(field_num=0; field_num<option_type->count; field_num++) {
field = option_type->fields[field_num];
DEBUGADD(4,("notify [%d]: type [%x], field [%x]\n", field_num, type, field));
@@ -1367,7 +1366,7 @@ static BOOL construct_notify_printer_info(SPOOL_NOTIFY_INFO *info, int snum, SPO
if((info->data=Realloc(info->data, (info->count+1)*sizeof(SPOOL_NOTIFY_INFO_DATA))) == NULL) {
return False;
}
- current_data=&(info->data[info->count]);
+ current_data=&info->data[info->count];
construct_info_data(current_data, type, field, id);
notify_info_data_table[j].fn(snum, current_data, queue, printer);
@@ -1474,8 +1473,7 @@ static uint32 printserver_notify_info(const POLICY_HND *hnd, SPOOL_NOTIFY_INFO *
info->data=NULL;
info->count=0;
- for (i=0; i<option->count; i++)
- {
+ for (i=0; i<option->count; i++) {
option_type=&(option->ctr.type[i]);
if (option_type->type!=PRINTER_NOTIFY_TYPE)
@@ -1495,8 +1493,7 @@ static uint32 printserver_notify_info(const POLICY_HND *hnd, SPOOL_NOTIFY_INFO *
DEBUGADD(1,("info->version:[%d], info->flags:[%d], info->count:[%d]\n", info->version, info->flags, info->count));
DEBUGADD(1,("num\ttype\tfield\tres\tid\tsize\tenc_type\n"));
- for (i=0; i<info->count; i++)
- {
+ for (i=0; i<info->count; i++) {
DEBUGADD(1,("[%d]\t[%d]\t[%d]\t[%d]\t[%d]\t[%d]\t[%d]\n",
i, info->data[i].type, info->data[i].field, info->data[i].reserved,
info->data[i].id, info->data[i].size, info->data[i].enc_type));
@@ -1533,9 +1530,8 @@ static uint32 printer_notify_info(const POLICY_HND *hnd, SPOOL_NOTIFY_INFO *info
get_printer_snum(hnd, &snum);
- for (i=0; i<option->count; i++)
- {
- option_type=&(option->ctr.type[i]);
+ for (i=0; i<option->count; i++) {
+ option_type=&option->ctr.type[i];
switch ( option_type->type ) {
case PRINTER_NOTIFY_TYPE:
@@ -1547,7 +1543,7 @@ static uint32 printer_notify_info(const POLICY_HND *hnd, SPOOL_NOTIFY_INFO *info
memset(&status, 0, sizeof(status));
count = print_queue_status(snum, &queue, &status);
for (j=0; j<count; j++)
- construct_notify_jobs_info(&(queue[j]), info, snum, option_type, queue[j].job);
+ construct_notify_jobs_info(&queue[j], info, snum, option_type, queue[j].job);
safe_free(queue);
break;
}
@@ -1561,8 +1557,7 @@ static uint32 printer_notify_info(const POLICY_HND *hnd, SPOOL_NOTIFY_INFO *info
DEBUGADD(1,("info->version:[%d], info->flags:[%d], info->count:[%d]\n", info->version, info->flags, info->count));
DEBUGADD(1,("num\ttype\tfield\tres\tid\tsize\tenc_type\n"));
- for (i=0; i<info->count; i++)
- {
+ for (i=0; i<info->count; i++) {
DEBUGADD(1,("[%d]\t[%d]\t[%d]\t[%d]\t[%d]\t[%d]\t[%d]\n",
i, info->data[i].type, info->data[i].field, info->data[i].reserved,
info->data[i].id, info->data[i].size, info->data[i].enc_type));
@@ -2150,7 +2145,7 @@ static BOOL enum_all_printers_info_2(fstring servername, NEW_BUFFER *buffer, uin
if((printers=Realloc(printers, (*returned +1)*sizeof(PRINTER_INFO_2))) == NULL)
return ERROR_NOT_ENOUGH_MEMORY;
DEBUG(4,("ReAlloced memory for [%d] PRINTER_INFO_2\n", *returned));
- memcpy(&(printers[*returned]), &current_prt, sizeof(PRINTER_INFO_2));
+ memcpy(&printers[*returned], &current_prt, sizeof(PRINTER_INFO_2));
(*returned)++;
}
}
@@ -4119,7 +4114,7 @@ uint32 _spoolss_enumprinterdata(const POLICY_HND *handle, uint32 idx,
if (!get_printer_snum(handle, &snum))
return ERROR_INVALID_HANDLE;
- if (get_a_printer(&printer, 2, lp_servicename(snum)) != 0x0)
+ if (get_a_printer(&printer, 2, lp_servicename(snum)) != 0)
return ERROR_INVALID_HANDLE;
/*
@@ -4182,6 +4177,9 @@ uint32 _spoolss_enumprinterdata(const POLICY_HND *handle, uint32 idx,
return ERROR_NOT_ENOUGH_MEMORY;
}
*out_value_len = (uint32)dos_PutUniCode((char *)*out_value, value, in_value_len, True);
+#if 1 /* JRATEST */
+ *out_max_value_len=(*out_value_len/sizeof(uint16));
+#endif /* JRATEST */
*out_type=type;
@@ -4191,8 +4189,11 @@ uint32 _spoolss_enumprinterdata(const POLICY_HND *handle, uint32 idx,
safe_free(data);
return ERROR_NOT_ENOUGH_MEMORY;
}
- memcpy(*data_out, data, data_len);
+ memcpy(*data_out, data, (size_t)data_len);
*out_data_len=data_len;
+#if 1 /* JRATEST */
+ *out_max_data_len=data_len;
+#endif /* JRATEST */
safe_free(data);