summaryrefslogtreecommitdiff
path: root/source3/rpc_parse
diff options
context:
space:
mode:
Diffstat (limited to 'source3/rpc_parse')
-rw-r--r--source3/rpc_parse/parse_misc.c12
-rw-r--r--source3/rpc_parse/parse_prs.c20
-rw-r--r--source3/rpc_parse/parse_spoolss.c193
3 files changed, 224 insertions, 1 deletions
diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c
index d19fe47a0d..b12688d362 100644
--- a/source3/rpc_parse/parse_misc.c
+++ b/source3/rpc_parse/parse_misc.c
@@ -1380,3 +1380,15 @@ BOOL smb_io_unistr3(char *desc, UNISTR3 *name, prs_struct *ps, int depth)
return True;
}
+
+
+/*******************************************************************
+ Stream a uint64_struct
+ ********************************************************************/
+BOOL prs_uint64(char *name, prs_struct *ps, int depth, UINT64_S *data64)
+{
+ return prs_uint32(name, ps, depth+1, &data64->low) &&
+ prs_uint32(name, ps, depth+1, &data64->high);
+}
+
+
diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c
index 64c1590b7d..2edd080a0e 100644
--- a/source3/rpc_parse/parse_prs.c
+++ b/source3/rpc_parse/parse_prs.c
@@ -27,6 +27,25 @@ extern int DEBUGLEVEL;
/*******************************************************************
+dump a prs to a file
+ ********************************************************************/
+void prs_dump(char *name, int level, prs_struct *ps)
+{
+ int fd;
+ pstring fname;
+ if (DEBUGLEVEL < 50) return;
+ slprintf(fname,sizeof(fname), "/tmp/%s_%d.prs", name, level);
+ fd = open(fname, O_WRONLY|O_CREAT|O_EXCL, 0644);
+ if (fd != -1) {
+ write(fd, ps->data_p + ps->data_offset, ps->buffer_size - ps->data_offset);
+ close(fd);
+ DEBUG(0,("created %s\n", fname));
+ }
+}
+
+
+
+/*******************************************************************
debug output for parsing info.
XXXX side-effect of this function is to increase the debug depth XXXX
@@ -428,7 +447,6 @@ BOOL prs_uint32(char *name, prs_struct *ps, int depth, uint32 *data32)
return True;
}
-
/******************************************************************
Stream an array of uint8s. Length is number of uint8s.
********************************************************************/
diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c
index c5aba9aba7..62dbc16277 100644
--- a/source3/rpc_parse/parse_spoolss.c
+++ b/source3/rpc_parse/parse_spoolss.c
@@ -3575,6 +3575,146 @@ BOOL spool_io_printer_driver_info_level_3(char *desc, SPOOL_PRINTER_DRIVER_INFO_
/*******************************************************************
+parse a SPOOL_PRINTER_DRIVER_INFO_LEVEL_6 structure
+********************************************************************/
+BOOL spool_io_printer_driver_info_level_6(char *desc, SPOOL_PRINTER_DRIVER_INFO_LEVEL_6 **q_u,
+ prs_struct *ps, int depth)
+{
+ SPOOL_PRINTER_DRIVER_INFO_LEVEL_6 *il;
+
+ prs_debug(ps, depth, desc, "spool_io_printer_driver_info_level_6");
+ depth++;
+
+ /* reading */
+ if (UNMARSHALLING(ps)) {
+ il=(SPOOL_PRINTER_DRIVER_INFO_LEVEL_6 *)malloc(sizeof(SPOOL_PRINTER_DRIVER_INFO_LEVEL_6));
+ if(il == NULL)
+ return False;
+ ZERO_STRUCTP(il);
+ *q_u=il;
+ }
+ else {
+ il=*q_u;
+ }
+
+ if(!prs_align(ps))
+ return False;
+
+
+ /* parse the main elements the packet */
+
+ if(!prs_uint32("dummy1", ps, depth, &il->dummy1))
+ return False;
+ if(!prs_uint32("version", ps, depth, &il->version))
+ return False;
+ if(!prs_uint32("name_ptr", ps, depth, &il->name_ptr))
+ return False;
+ if(!prs_uint32("environment_ptr", ps, depth, &il->environment_ptr))
+ return False;
+ if(!prs_uint32("driverpath_ptr", ps, depth, &il->driverpath_ptr))
+ return False;
+ if(!prs_uint32("datafile_ptr", ps, depth, &il->datafile_ptr))
+ return False;
+ if(!prs_uint32("configfile_ptr", ps, depth, &il->configfile_ptr))
+ return False;
+ if(!prs_uint32("helpfile_ptr", ps, depth, &il->helpfile_ptr))
+ return False;
+ if(!prs_uint32("monitorname_ptr", ps, depth, &il->monitorname_ptr))
+ return False;
+ if(!prs_uint32("defaultdatatype_ptr", ps, depth, &il->defaultdatatype_ptr))
+ return False;
+ if(!prs_uint32("dependentfiles_len", ps, depth, &il->dependentfiles_len))
+ return False;
+ if(!prs_uint32("dependentfiles_ptr", ps, depth, &il->dependentfiles_ptr))
+ return False;
+ if(!prs_uint32("previousnames_len", ps, depth, &il->previousnames_len))
+ return False;
+ if(!prs_uint32("previousnames_ptr", ps, depth, &il->previousnames_ptr))
+ return False;
+ if(!smb_io_time("driverdate", &il->driverdate, ps, depth))
+ return False;
+ if(!prs_uint64("driverversion", ps, depth, &il->driverversion))
+ return False;
+ if(!prs_uint32("dummy4", ps, depth, &il->dummy4))
+ return False;
+ if(!prs_uint32("mfgname_ptr", ps, depth, &il->mfgname_ptr))
+ return False;
+ if(!prs_uint32("oemurl_ptr", ps, depth, &il->oemurl_ptr))
+ return False;
+ if(!prs_uint32("hardwareid_ptr", ps, depth, &il->hardwareid_ptr))
+ return False;
+ if(!prs_uint32("provider_ptr", ps, depth, &il->provider_ptr))
+ return False;
+
+ /* parse the structures in the packet */
+
+ if(!smb_io_unistr2("name", &il->name, il->name_ptr, ps, depth))
+ return False;
+ if(!prs_align(ps))
+ return False;
+ if(!smb_io_unistr2("environment", &il->environment, il->environment_ptr, ps, depth))
+ return False;
+ if(!prs_align(ps))
+ return False;
+ if(!smb_io_unistr2("driverpath", &il->driverpath, il->driverpath_ptr, ps, depth))
+ return False;
+ if(!prs_align(ps))
+ return False;
+ if(!smb_io_unistr2("datafile", &il->datafile, il->datafile_ptr, ps, depth))
+ return False;
+ if(!prs_align(ps))
+ return False;
+ if(!smb_io_unistr2("configfile", &il->configfile, il->configfile_ptr, ps, depth))
+ return False;
+ if(!prs_align(ps))
+ return False;
+ if(!smb_io_unistr2("helpfile", &il->helpfile, il->helpfile_ptr, ps, depth))
+ return False;
+ if(!prs_align(ps))
+ return False;
+ if(!smb_io_unistr2("monitorname", &il->monitorname, il->monitorname_ptr, ps, depth))
+ return False;
+ if(!prs_align(ps))
+ return False;
+ if(!smb_io_unistr2("defaultdatatype", &il->defaultdatatype, il->defaultdatatype_ptr, ps, depth))
+ return False;
+ if(!prs_align(ps))
+ return False;
+ if (il->dependentfiles_ptr) {
+ if(!smb_io_buffer5("dependentfiles", &il->dependentfiles, ps, depth))
+ return False;
+ if(!prs_align(ps))
+ return False;
+ }
+ if (il->previousnames_ptr) {
+ if(!smb_io_buffer5("previousnames", &il->previousnames, ps, depth))
+ return False;
+ if(!prs_align(ps))
+ return False;
+ }
+ if(!smb_io_unistr2("mfgname", &il->mfgname, il->mfgname_ptr, ps, depth))
+ return False;
+ if(!prs_align(ps))
+ return False;
+ if(!smb_io_unistr2("oemurl", &il->oemurl, il->oemurl_ptr, ps, depth))
+ return False;
+ if(!prs_align(ps))
+ return False;
+ if(!smb_io_unistr2("hardwareid", &il->hardwareid, il->hardwareid_ptr, ps, depth))
+ return False;
+ if(!prs_align(ps))
+ return False;
+ if(!smb_io_unistr2("provider", &il->provider, il->provider_ptr, ps, depth))
+ return False;
+ if(!prs_align(ps))
+ return False;
+
+
+ return True;
+}
+
+
+/*******************************************************************
convert a buffer of UNICODE strings null terminated
the buffer is terminated by a NULL
@@ -3680,6 +3820,13 @@ BOOL spool_io_printer_driver_info_level(char *desc, SPOOL_PRINTER_DRIVER_INFO_LE
if(!spool_io_printer_driver_info_level_3("", &(il->info_3), ps, depth))
return False;
break;
+ case 6:
+ if(!spool_io_printer_driver_info_level_6("", &(il->info_6), ps, depth))
+ return False;
+ break;
+ default:
+ prs_dump("spool_io_printer_driver_info_level", il->level, ps);
+ return False;
}
return True;
@@ -3770,6 +3917,52 @@ BOOL uni_2_asc_printer_driver_3(SPOOL_PRINTER_DRIVER_INFO_LEVEL_3 *uni,
return True;
}
+/*******************************************************************
+********************************************************************/
+BOOL uni_2_asc_printer_driver_6(SPOOL_PRINTER_DRIVER_INFO_LEVEL_6 *uni,
+ NT_PRINTER_DRIVER_INFO_LEVEL_6 **asc)
+{
+ NT_PRINTER_DRIVER_INFO_LEVEL_6 *d;
+
+ DEBUG(7,("uni_2_asc_printer_driver_6: Converting from UNICODE to ASCII\n"));
+
+ if (*asc==NULL)
+ {
+ *asc=(NT_PRINTER_DRIVER_INFO_LEVEL_6 *)malloc(sizeof(NT_PRINTER_DRIVER_INFO_LEVEL_6));
+ if(*asc == NULL)
+ return False;
+ ZERO_STRUCTP(*asc);
+ }
+
+ d=*asc;
+
+ d->version=uni->version;
+
+ unistr2_to_ascii(d->name, &(uni->name), sizeof(d->name)-1);
+ unistr2_to_ascii(d->environment, &(uni->environment), sizeof(d->environment)-1);
+ unistr2_to_ascii(d->driverpath, &(uni->driverpath), sizeof(d->driverpath)-1);
+ unistr2_to_ascii(d->datafile, &(uni->datafile), sizeof(d->datafile)-1);
+ unistr2_to_ascii(d->configfile, &(uni->configfile), sizeof(d->configfile)-1);
+ unistr2_to_ascii(d->helpfile, &(uni->helpfile), sizeof(d->helpfile)-1);
+ unistr2_to_ascii(d->monitorname, &(uni->monitorname), sizeof(d->monitorname)-1);
+ unistr2_to_ascii(d->defaultdatatype, &(uni->defaultdatatype), sizeof(d->defaultdatatype)-1);
+
+ DEBUGADD(8,( "version: %d\n", d->version));
+ DEBUGADD(8,( "name: %s\n", d->name));
+ DEBUGADD(8,( "environment: %s\n", d->environment));
+ DEBUGADD(8,( "driverpath: %s\n", d->driverpath));
+ DEBUGADD(8,( "datafile: %s\n", d->datafile));
+ DEBUGADD(8,( "configfile: %s\n", d->configfile));
+ DEBUGADD(8,( "helpfile: %s\n", d->helpfile));
+ DEBUGADD(8,( "monitorname: %s\n", d->monitorname));
+ DEBUGADD(8,( "defaultdatatype: %s\n", d->defaultdatatype));
+
+ uniarray_2_ascarray(&(uni->dependentfiles), &(d->dependentfiles) );
+ uniarray_2_ascarray(&(uni->previousnames), &(d->previousnames) );
+
+ return True;
+}
+
BOOL uni_2_asc_printer_info_2(const SPOOL_PRINTER_INFO_LEVEL_2 *uni,
NT_PRINTER_INFO_LEVEL_2 **asc)
{