1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-25 23:21:54 +03:00

s3-spoolss: remove unused DEVICEMODE parsing and header.

Guenther
This commit is contained in:
Günther Deschner 2009-03-17 16:41:16 +01:00
parent 5778a36357
commit f19faa0e76
3 changed files with 0 additions and 234 deletions

View File

@ -5828,7 +5828,6 @@ bool sec_io_desc_buf(const char *desc, SEC_DESC_BUF **ppsdb, prs_struct *ps, int
/* The following definitions come from rpc_parse/parse_spoolss.c */
bool spoolss_io_devmode(const char *desc, prs_struct *ps, int depth, DEVICEMODE *devmode);
uint32 spoolss_size_printer_enum_values(PRINTER_ENUM_VALUES *p);
bool make_spoolss_buffer5(TALLOC_CTX *mem_ctx, BUFFER5 *buf5, uint32 len, uint16 *src);
bool make_spoolss_q_enumprinterdataex(SPOOL_Q_ENUMPRINTERDATAEX *q_u,

View File

@ -189,50 +189,6 @@
#define DRIVER_MAX_VERSION 4
/*
* Devicemode structure
*/
typedef struct devicemode
{
UNISTR devicename;
uint16 specversion;
uint16 driverversion;
uint16 size;
uint16 driverextra;
uint32 fields;
uint16 orientation;
uint16 papersize;
uint16 paperlength;
uint16 paperwidth;
uint16 scale;
uint16 copies;
uint16 defaultsource;
uint16 printquality;
uint16 color;
uint16 duplex;
uint16 yresolution;
uint16 ttoption;
uint16 collate;
UNISTR formname;
uint16 logpixels;
uint32 bitsperpel;
uint32 pelswidth;
uint32 pelsheight;
uint32 displayflags;
uint32 displayfrequency;
uint32 icmmethod;
uint32 icmintent;
uint32 mediatype;
uint32 dithertype;
uint32 reserved1;
uint32 reserved2;
uint32 panningwidth;
uint32 panningheight;
uint8 *dev_private;
}
DEVICEMODE;
/********************************************/
typedef struct printer_enum_values

View File

@ -26,195 +26,6 @@
#undef DBGC_CLASS
#define DBGC_CLASS DBGC_RPC_PARSE
/*******************************************************************
* read or write a DEVICEMODE struct.
* on reading allocate memory for the private member
********************************************************************/
#define DM_NUM_OPTIONAL_FIELDS 8
bool spoolss_io_devmode(const char *desc, prs_struct *ps, int depth, DEVICEMODE *devmode)
{
int available_space; /* size of the device mode left to parse */
/* only important on unmarshalling */
int i = 0;
uint16 *unistr_buffer;
int j;
struct optional_fields {
fstring name;
uint32* field;
} opt_fields[DM_NUM_OPTIONAL_FIELDS] = {
{ "icmmethod", NULL },
{ "icmintent", NULL },
{ "mediatype", NULL },
{ "dithertype", NULL },
{ "reserved1", NULL },
{ "reserved2", NULL },
{ "panningwidth", NULL },
{ "panningheight", NULL }
};
/* assign at run time to keep non-gcc compilers happy */
opt_fields[0].field = &devmode->icmmethod;
opt_fields[1].field = &devmode->icmintent;
opt_fields[2].field = &devmode->mediatype;
opt_fields[3].field = &devmode->dithertype;
opt_fields[4].field = &devmode->reserved1;
opt_fields[5].field = &devmode->reserved2;
opt_fields[6].field = &devmode->panningwidth;
opt_fields[7].field = &devmode->panningheight;
prs_debug(ps, depth, desc, "spoolss_io_devmode");
depth++;
if (UNMARSHALLING(ps)) {
devmode->devicename.buffer = PRS_ALLOC_MEM(ps, uint16, MAXDEVICENAME);
if (devmode->devicename.buffer == NULL)
return False;
unistr_buffer = devmode->devicename.buffer;
}
else {
/* devicename is a static sized string but the buffer we set is not */
unistr_buffer = PRS_ALLOC_MEM(ps, uint16, MAXDEVICENAME);
memset( unistr_buffer, 0x0, MAXDEVICENAME );
for ( j=0; devmode->devicename.buffer[j]; j++ )
unistr_buffer[j] = devmode->devicename.buffer[j];
}
if (!prs_uint16uni(True,"devicename", ps, depth, unistr_buffer, MAXDEVICENAME))
return False;
if (!prs_uint16("specversion", ps, depth, &devmode->specversion))
return False;
if (!prs_uint16("driverversion", ps, depth, &devmode->driverversion))
return False;
if (!prs_uint16("size", ps, depth, &devmode->size))
return False;
if (!prs_uint16("driverextra", ps, depth, &devmode->driverextra))
return False;
if (!prs_uint32("fields", ps, depth, &devmode->fields))
return False;
if (!prs_uint16("orientation", ps, depth, &devmode->orientation))
return False;
if (!prs_uint16("papersize", ps, depth, &devmode->papersize))
return False;
if (!prs_uint16("paperlength", ps, depth, &devmode->paperlength))
return False;
if (!prs_uint16("paperwidth", ps, depth, &devmode->paperwidth))
return False;
if (!prs_uint16("scale", ps, depth, &devmode->scale))
return False;
if (!prs_uint16("copies", ps, depth, &devmode->copies))
return False;
if (!prs_uint16("defaultsource", ps, depth, &devmode->defaultsource))
return False;
if (!prs_uint16("printquality", ps, depth, &devmode->printquality))
return False;
if (!prs_uint16("color", ps, depth, &devmode->color))
return False;
if (!prs_uint16("duplex", ps, depth, &devmode->duplex))
return False;
if (!prs_uint16("yresolution", ps, depth, &devmode->yresolution))
return False;
if (!prs_uint16("ttoption", ps, depth, &devmode->ttoption))
return False;
if (!prs_uint16("collate", ps, depth, &devmode->collate))
return False;
if (UNMARSHALLING(ps)) {
devmode->formname.buffer = PRS_ALLOC_MEM(ps, uint16, MAXDEVICENAME);
if (devmode->formname.buffer == NULL)
return False;
unistr_buffer = devmode->formname.buffer;
}
else {
/* devicename is a static sized string but the buffer we set is not */
unistr_buffer = PRS_ALLOC_MEM(ps, uint16, MAXDEVICENAME);
memset( unistr_buffer, 0x0, MAXDEVICENAME );
for ( j=0; devmode->formname.buffer[j]; j++ )
unistr_buffer[j] = devmode->formname.buffer[j];
}
if (!prs_uint16uni(True, "formname", ps, depth, unistr_buffer, MAXDEVICENAME))
return False;
if (!prs_uint16("logpixels", ps, depth, &devmode->logpixels))
return False;
if (!prs_uint32("bitsperpel", ps, depth, &devmode->bitsperpel))
return False;
if (!prs_uint32("pelswidth", ps, depth, &devmode->pelswidth))
return False;
if (!prs_uint32("pelsheight", ps, depth, &devmode->pelsheight))
return False;
if (!prs_uint32("displayflags", ps, depth, &devmode->displayflags))
return False;
if (!prs_uint32("displayfrequency", ps, depth, &devmode->displayfrequency))
return False;
/*
* every device mode I've ever seen on the wire at least has up
* to the displayfrequency field. --jerry (05-09-2002)
*/
/* add uint32's + uint16's + two UNICODE strings */
available_space = devmode->size - (sizeof(uint32)*6 + sizeof(uint16)*18 + sizeof(uint16)*64);
/* Sanity check - we only have uint32's left tp parse */
if ( available_space && ((available_space % sizeof(uint32)) != 0) ) {
DEBUG(0,("spoolss_io_devmode: available_space [%d] no in multiple of 4 bytes (size = %d)!\n",
available_space, devmode->size));
DEBUG(0,("spoolss_io_devmode: please report to samba-technical@samba.org!\n"));
return False;
}
/*
* Conditional parsing. Assume that the DeviceMode has been
* zero'd by the caller.
*/
while ((available_space > 0) && (i < DM_NUM_OPTIONAL_FIELDS))
{
DEBUG(11, ("spoolss_io_devmode: [%d] bytes left to parse in devmode\n", available_space));
if (!prs_uint32(opt_fields[i].name, ps, depth, opt_fields[i].field))
return False;
available_space -= sizeof(uint32);
i++;
}
/* Sanity Check - we should no available space at this point unless
MS changes the device mode structure */
if (available_space) {
DEBUG(0,("spoolss_io_devmode: I've parsed all I know and there is still stuff left|\n"));
DEBUG(0,("spoolss_io_devmode: available_space = [%d], devmode_size = [%d]!\n",
available_space, devmode->size));
DEBUG(0,("spoolss_io_devmode: please report to samba-technical@samba.org!\n"));
return False;
}
if (devmode->driverextra!=0) {
if (UNMARSHALLING(ps)) {
devmode->dev_private=PRS_ALLOC_MEM(ps, uint8, devmode->driverextra);
if(devmode->dev_private == NULL)
return False;
DEBUG(7,("spoolss_io_devmode: allocated memory [%d] for dev_private\n",devmode->driverextra));
}
DEBUG(7,("spoolss_io_devmode: parsing [%d] bytes of dev_private\n",devmode->driverextra));
if (!prs_uint8s(False, "dev_private", ps, depth,
devmode->dev_private, devmode->driverextra))
return False;
}
return True;
}
/*******************************************************************
* return the length of a uint32 (obvious, but the code is clean)
********************************************************************/