summaryrefslogtreecommitdiff
path: root/source3/rpc_server
diff options
context:
space:
mode:
authorGerald Carter <jerry@samba.org>2002-08-30 10:47:34 +0000
committerGerald Carter <jerry@samba.org>2002-08-30 10:47:34 +0000
commitde3d0310e2622c068d6ae6fb4698752128068924 (patch)
tree4c07f687a778ec3b857464291caf6077df18cfb3 /source3/rpc_server
parentcfb5e91178eb8befdb00780a819f9c5cd3eee8e4 (diff)
downloadsamba-de3d0310e2622c068d6ae6fb4698752128068924.tar.gz
samba-de3d0310e2622c068d6ae6fb4698752128068924.tar.bz2
samba-de3d0310e2622c068d6ae6fb4698752128068924.zip
merge of phant0m key fix from APP_HEAD
(This used to be commit cb13d334a53f27713665570d85607d57eb407f9f)
Diffstat (limited to 'source3/rpc_server')
-rw-r--r--source3/rpc_server/srv_spoolss_nt.c91
1 files changed, 32 insertions, 59 deletions
diff --git a/source3/rpc_server/srv_spoolss_nt.c b/source3/rpc_server/srv_spoolss_nt.c
index de87954fea..d1f92aef13 100644
--- a/source3/rpc_server/srv_spoolss_nt.c
+++ b/source3/rpc_server/srv_spoolss_nt.c
@@ -5335,22 +5335,6 @@ static WERROR update_printer(pipes_struct *p, POLICY_HND *handle, uint32 level,
goto done;
}
-#if 0 /* JERRY */
-
- /*
- * Another one of those historical misunderstandings...
- * This is reminisent of a similar call we had in _spoolss_setprinterdata()
- * I'm leaving it here as a reminder. --jerry
- */
-
- if (nt_printer_info_level_equal(printer, old_printer)) {
- DEBUG(3, ("update_printer: printer info has not changed\n"));
- result = WERR_OK;
- goto done;
- }
-
-#endif
-
/* Check calling user has permission to update printer description */
if (Printer->access_granted != PRINTER_ACCESS_ADMINISTER) {
@@ -5369,49 +5353,22 @@ static WERROR update_printer(pipes_struct *p, POLICY_HND *handle, uint32 level,
}
/*
- * Set the DRIVER_INIT info in the tdb; trigger on magic value for the
- * DEVMODE.displayfrequency, which is not used for printer drivers. This
- * requires Win32 client code (see other notes elsewhere in the code).
+ * When a *new* driver is bound to a printer, the drivername is used to
+ * lookup previously saved driver initialization info, which is then
+ * bound to the printer, simulating what happens in the Windows arch.
*/
- if (printer->info_2->devmode &&
- printer->info_2->devmode->displayfrequency == MAGIC_DISPLAY_FREQUENCY)
- {
-
- DEBUG(10,("update_printer: Save printer driver init data\n"));
- printer->info_2->devmode->displayfrequency = 0;
-
- if (update_driver_init(*printer, 2)!=0) {
- DEBUG(10,("update_printer: error updating printer driver init DEVMODE\n"));
- result = WERR_ACCESS_DENIED;
- goto done;
- }
-
- /* we need to reset all driver init data for all printers
- bound to this driver */
-
- srv_spoolss_reset_printerdata( printer->info_2->drivername );
-
- }
- else
+ if (!strequal(printer->info_2->drivername, old_printer->info_2->drivername))
{
- /*
- * When a *new* driver is bound to a printer, the drivername is used to
- * lookup previously saved driver initialization info, which is then
- * bound to the printer, simulating what happens in the Windows arch.
- */
- if (!strequal(printer->info_2->drivername, old_printer->info_2->drivername))
+ if (!set_driver_init(printer, 2))
{
- if (!set_driver_init(printer, 2))
- {
- DEBUG(5,("update_printer: Error restoring driver initialization data for driver [%s]!\n",
- printer->info_2->drivername));
- }
-
- DEBUG(10,("update_printer: changing driver [%s]! Sending event!\n",
+ DEBUG(5,("update_printer: Error restoring driver initialization data for driver [%s]!\n",
printer->info_2->drivername));
-
- notify_printer_driver(snum, printer->info_2->drivername);
}
+
+ DEBUG(10,("update_printer: changing driver [%s]! Sending event!\n",
+ printer->info_2->drivername));
+
+ notify_printer_driver(snum, printer->info_2->drivername);
}
/* Update printer info */
@@ -6614,8 +6571,11 @@ static WERROR spoolss_addprinterex_level_2( pipes_struct *p, const UNISTR2 *uni_
*/
if (!devmode)
+ {
set_driver_init(printer, 2);
- else {
+ }
+ else
+ {
/* A valid devmode was included, convert and link it
*/
DEBUGADD(10, ("spoolss_addprinterex_level_2: devmode included, converting\n"));
@@ -6625,8 +6585,6 @@ static WERROR spoolss_addprinterex_level_2( pipes_struct *p, const UNISTR2 *uni_
return WERR_NOMEM;
}
- set_driver_init(printer, 2);
-
/* write the ASCII on disk */
err = mod_a_printer(*printer, 2);
if (!W_ERROR_IS_OK(err)) {
@@ -6925,7 +6883,7 @@ WERROR _spoolss_enumprinterdata(pipes_struct *p, SPOOL_Q_ENUMPRINTERDATA *q_u, S
uint32 idx = q_u->index;
uint32 in_value_len = q_u->valuesize;
uint32 in_data_len = q_u->datasize;
- uint32 *out_max_value_len= &r_u->valuesize;
+ uint32 *out_max_value_len = &r_u->valuesize;
uint16 **out_value = &r_u->value;
uint32 *out_value_len = &r_u->realvaluesize;
uint32 *out_type = &r_u->type;
@@ -7145,10 +7103,25 @@ WERROR _spoolss_setprinterdata( pipes_struct *p, SPOOL_Q_SETPRINTERDATA *q_u, SP
unistr2_to_ascii( valuename, value, sizeof(valuename)-1 );
- /* save the registry data */
+ /*
+ * When client side code sets a magic printer data key, detect it and save
+ * the current printer data and the magic key's data (its the DEVMODE) for
+ * future printer/driver initializations.
+ */
+ if ( (type == REG_BINARY) && strequal( valuename, PHANTOM_DEVMODE_KEY))
+ {
+ /* Set devmode and printer initialization info */
+ status = save_driver_init( printer, 2, data, real_len );
+ srv_spoolss_reset_printerdata( printer->info_2->drivername );
+ }
+ else
+ {
status = set_printer_dataex( printer, SPOOL_PRINTERDATA_KEY, valuename,
type, data, real_len );
+ if ( W_ERROR_IS_OK(status) )
+ status = mod_a_printer(*printer, 2);
+ }
done:
free_a_printer(&printer, 2);