summaryrefslogtreecommitdiff
path: root/source3/smbd
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2009-11-17 12:54:02 +0100
committerGünther Deschner <gd@samba.org>2009-11-23 12:19:11 +0100
commitec56895bdec90cc671a0d562749b3caf161dbdf8 (patch)
tree1021dd01905194f38b9c2b38f3b429033d3637a8 /source3/smbd
parent68cc1166d96ac81abce78a7eb60b7b86d0eb4eda (diff)
downloadsamba-ec56895bdec90cc671a0d562749b3caf161dbdf8.tar.gz
samba-ec56895bdec90cc671a0d562749b3caf161dbdf8.tar.bz2
samba-ec56895bdec90cc671a0d562749b3caf161dbdf8.zip
s3-printing: use spoolss types and structs while getting and deleting drivers.
Guenther
Diffstat (limited to 'source3/smbd')
-rw-r--r--source3/smbd/lanman.c61
1 files changed, 28 insertions, 33 deletions
diff --git a/source3/smbd/lanman.c b/source3/smbd/lanman.c
index 6fc72c27ea..074f7e2c37 100644
--- a/source3/smbd/lanman.c
+++ b/source3/smbd/lanman.c
@@ -646,18 +646,16 @@ static void fill_printq_info_52(connection_struct *conn, int snum,
{
int i;
fstring location;
- NT_PRINTER_DRIVER_INFO_LEVEL driver;
+ union spoolss_DriverInfo *driver = NULL;
NT_PRINTER_INFO_LEVEL *printer = NULL;
- ZERO_STRUCT(driver);
-
if ( !W_ERROR_IS_OK(get_a_printer( NULL, &printer, 2, lp_servicename(snum))) ) {
DEBUG(3,("fill_printq_info_52: Failed to lookup printer [%s]\n",
lp_servicename(snum)));
goto err;
}
- if ( !W_ERROR_IS_OK(get_a_printer_driver(&driver, 3, printer->info_2->drivername,
+ if (!W_ERROR_IS_OK(get_a_printer_driver(talloc_tos(), &driver, 3, printer->info_2->drivername,
"Windows 4.0", 0)) )
{
DEBUG(3,("fill_printq_info_52: Failed to lookup driver [%s]\n",
@@ -665,38 +663,38 @@ static void fill_printq_info_52(connection_struct *conn, int snum,
goto err;
}
- trim_string(driver.info_3->driverpath, "\\print$\\WIN40\\0\\", 0);
- trim_string(driver.info_3->datafile, "\\print$\\WIN40\\0\\", 0);
- trim_string(driver.info_3->helpfile, "\\print$\\WIN40\\0\\", 0);
+ trim_string((char *)driver->info3.driver_path, "\\print$\\WIN40\\0\\", 0);
+ trim_string((char *)driver->info3.data_file, "\\print$\\WIN40\\0\\", 0);
+ trim_string((char *)driver->info3.help_file, "\\print$\\WIN40\\0\\", 0);
PACKI(desc, "W", 0x0400); /* don't know */
- PACKS(desc, "z", driver.info_3->name); /* long printer name */
- PACKS(desc, "z", driver.info_3->driverpath); /* Driverfile Name */
- PACKS(desc, "z", driver.info_3->datafile); /* Datafile name */
- PACKS(desc, "z", driver.info_3->monitorname); /* language monitor */
+ PACKS(desc, "z", driver->info3.driver_name); /* long printer name */
+ PACKS(desc, "z", driver->info3.driver_path); /* Driverfile Name */
+ PACKS(desc, "z", driver->info3.data_file); /* Datafile name */
+ PACKS(desc, "z", driver->info3.monitor_name); /* language monitor */
fstrcpy(location, "\\\\%L\\print$\\WIN40\\0");
standard_sub_basic( "", "", location, sizeof(location)-1 );
PACKS(desc,"z", location); /* share to retrieve files */
- PACKS(desc,"z", driver.info_3->defaultdatatype); /* default data type */
- PACKS(desc,"z", driver.info_3->helpfile); /* helpfile name */
- PACKS(desc,"z", driver.info_3->driverpath); /* driver name */
+ PACKS(desc,"z", driver->info3.default_datatype); /* default data type */
+ PACKS(desc,"z", driver->info3.help_file); /* helpfile name */
+ PACKS(desc,"z", driver->info3.driver_path); /* driver name */
- DEBUG(3,("Printer Driver Name: %s:\n",driver.info_3->name));
- DEBUG(3,("Driver: %s:\n",driver.info_3->driverpath));
- DEBUG(3,("Data File: %s:\n",driver.info_3->datafile));
- DEBUG(3,("Language Monitor: %s:\n",driver.info_3->monitorname));
+ DEBUG(3,("Printer Driver Name: %s:\n",driver->info3.driver_name));
+ DEBUG(3,("Driver: %s:\n",driver->info3.driver_path));
+ DEBUG(3,("Data File: %s:\n",driver->info3.data_file));
+ DEBUG(3,("Language Monitor: %s:\n",driver->info3.monitor_name));
DEBUG(3,("Driver Location: %s:\n",location));
- DEBUG(3,("Data Type: %s:\n",driver.info_3->defaultdatatype));
- DEBUG(3,("Help File: %s:\n",driver.info_3->helpfile));
+ DEBUG(3,("Data Type: %s:\n",driver->info3.default_datatype));
+ DEBUG(3,("Help File: %s:\n",driver->info3.help_file));
PACKI(desc,"N",count); /* number of files to copy */
- for ( i=0; i<count && driver.info_3->dependentfiles && *driver.info_3->dependentfiles[i]; i++)
+ for ( i=0; i<count && driver->info3.dependent_files && *driver->info3.dependent_files[i]; i++)
{
- trim_string(driver.info_3->dependentfiles[i], "\\print$\\WIN40\\0\\", 0);
- PACKS(desc,"z",driver.info_3->dependentfiles[i]); /* driver files to copy */
- DEBUG(3,("Dependent File: %s:\n",driver.info_3->dependentfiles[i]));
+ trim_string((char *)driver->info3.dependent_files[i], "\\print$\\WIN40\\0\\", 0);
+ PACKS(desc,"z",driver->info3.dependent_files[i]); /* driver files to copy */
+ DEBUG(3,("Dependent File: %s:\n", driver->info3.dependent_files[i]));
}
/* sanity check */
@@ -717,8 +715,7 @@ done:
if ( printer )
free_a_printer( &printer, 2 );
- if ( driver.info_3 )
- free_a_printer_driver( driver, 3 );
+ free_a_printer_driver(driver);
}
@@ -807,7 +804,7 @@ static void fill_printq_info(connection_struct *conn, int snum, int uLevel,
static int get_printerdrivernumber(int snum)
{
int result = 0;
- NT_PRINTER_DRIVER_INFO_LEVEL driver;
+ union spoolss_DriverInfo *driver;
NT_PRINTER_INFO_LEVEL *printer = NULL;
ZERO_STRUCT(driver);
@@ -818,7 +815,7 @@ static int get_printerdrivernumber(int snum)
goto done;
}
- if ( !W_ERROR_IS_OK(get_a_printer_driver(&driver, 3, printer->info_2->drivername,
+ if (!W_ERROR_IS_OK(get_a_printer_driver(talloc_tos(), &driver, 3, printer->info_2->drivername,
"Windows 4.0", 0)) )
{
DEBUG(3,("get_printerdrivernumber: Failed to lookup driver [%s]\n",
@@ -827,15 +824,13 @@ static int get_printerdrivernumber(int snum)
}
/* count the number of files */
- while ( driver.info_3->dependentfiles && *driver.info_3->dependentfiles[result] )
- result++;
- \
+ while (driver->info3.dependent_files && *driver->info3.dependent_files[result])
+ result++;
done:
if ( printer )
free_a_printer( &printer, 2 );
- if ( driver.info_3 )
- free_a_printer_driver( driver, 3 );
+ free_a_printer_driver(driver);
return result;
}