diff options
author | Andrew Tridgell <tridge@samba.org> | 2000-05-12 14:28:46 +0000 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2000-05-12 14:28:46 +0000 |
commit | 0806cf75ff96dee6715610bd61e21cde08fa1c61 (patch) | |
tree | 7a13945b6c11b42a9ce6c1f4c41469bab96a8ab2 /source3/printing | |
parent | d55b849d7740aee9795a8ded94d3a2db5b94cc02 (diff) | |
download | samba-0806cf75ff96dee6715610bd61e21cde08fa1c61.tar.gz samba-0806cf75ff96dee6715610bd61e21cde08fa1c61.tar.bz2 samba-0806cf75ff96dee6715610bd61e21cde08fa1c61.zip |
added spool_io_printer_driver_info_level_6()
thsi function and the associated header structure were autogenerated
using a little awk based code geerator I wroe ths evening. I'll commit
that next ...
(This used to be commit 974813f0d4afb6c14ed27c48ab24b19932557f9f)
Diffstat (limited to 'source3/printing')
-rw-r--r-- | source3/printing/nt_printing.c | 77 |
1 files changed, 76 insertions, 1 deletions
diff --git a/source3/printing/nt_printing.c b/source3/printing/nt_printing.c index c70ed20998..3e15082f21 100644 --- a/source3/printing/nt_printing.c +++ b/source3/printing/nt_printing.c @@ -381,6 +381,75 @@ static uint32 add_a_printer_driver_3(NT_PRINTER_DRIVER_INFO_LEVEL_3 *driver) /**************************************************************************** ****************************************************************************/ +static uint32 add_a_printer_driver_6(NT_PRINTER_DRIVER_INFO_LEVEL_6 *driver) +{ + int fd; + pstring file; + fstring architecture; + fstring driver_name; + char **dependentfiles; + + /* create a file in the dir lp_nt_driver_file */ + /* with the full printer DRIVER name */ + /* eg: "/usr/local/samba/lib/NTdriver_HP LaserJet 6MP" */ + /* each name is really defining an *unique* printer model */ + /* I don't want to mangle the name to find it back when enumerating */ + + /* il faut substituer les / par 1 autre caractere d'abord */ + /* dans le nom de l'imprimante par un # ???*/ + + StrnCpy(driver_name, driver->name, sizeof(driver_name)-1); + + all_string_sub(driver_name, "/", "#", 0); + + get_short_archi(architecture, driver->environment); + + slprintf(file, sizeof(file)-1, "%s/NTdriver_%s_%s", + lp_nt_drivers_file(), architecture, driver_name); + + unlink(file); + if((fd = sys_open(file, O_WRONLY|O_CREAT|O_TRUNC|O_EXCL, 0644)) == -1) + { + DEBUG(0, ("add_a_printer_driver_3: Cannot create driver file [%s]. Error was %s\n", file, strerror(errno) )); + return(2); + } + + /* + * cversion must be 2. + * when adding a printer ON the SERVER + * rpcAddPrinterDriver defines it to zero + * which is wrong !!! + * + * JFM, 4/14/99 + */ + driver->version=2; + + fdprintf(fd, "version: %d\n", driver->version); + fdprintf(fd, "name: %s\n", driver->name); + fdprintf(fd, "environment: %s\n", driver->environment); + fdprintf(fd, "driverpath: %s\n", driver->driverpath); + fdprintf(fd, "datafile: %s\n", driver->datafile); + fdprintf(fd, "configfile: %s\n", driver->configfile); + fdprintf(fd, "helpfile: %s\n", driver->helpfile); + fdprintf(fd, "monitorname: %s\n", driver->monitorname); + fdprintf(fd, "defaultdatatype: %s\n", driver->defaultdatatype); + + /* and the dependants files */ + + dependentfiles=driver->dependentfiles; + + while ( **dependentfiles != '\0' ) + { + fdprintf(fd, "dependentfile: %s\n", *dependentfiles); + dependentfiles++; + } + + close(fd); + return(0); +} + +/**************************************************************************** +****************************************************************************/ static uint32 get_a_printer_driver_3(NT_PRINTER_DRIVER_INFO_LEVEL_3 **info_ptr, fstring in_prt, fstring in_arch) { char **lines; @@ -1307,6 +1376,12 @@ uint32 add_a_printer_driver(NT_PRINTER_DRIVER_INFO_LEVEL driver, uint32 level) success=add_a_printer_driver_3(driver.info_3); break; } + + case 6: + { + success=add_a_printer_driver_6(driver.info_6); + break; + } default: success=1; break; @@ -1335,7 +1410,7 @@ uint32 get_a_printer_driver(NT_PRINTER_DRIVER_INFO_LEVEL *driver, uint32 level, break; } - dump_a_printer_driver(*driver, level); + if (success == 0) dump_a_printer_driver(*driver, level); return (success); } |