diff options
author | Gerald Carter <jerry@samba.org> | 2002-06-24 19:51:23 +0000 |
---|---|---|
committer | Gerald Carter <jerry@samba.org> | 2002-06-24 19:51:23 +0000 |
commit | 900fb62238be30cdc87bfd2bede6fdff611ebae5 (patch) | |
tree | cb5073f32d4faf1a3eee3392da04b3b09424d10f /source3/printing | |
parent | 24b67730bf7bbf4414df99129a3cc20aa93dc0da (diff) | |
download | samba-900fb62238be30cdc87bfd2bede6fdff611ebae5.tar.gz samba-900fb62238be30cdc87bfd2bede6fdff611ebae5.tar.bz2 samba-900fb62238be30cdc87bfd2bede6fdff611ebae5.zip |
printing merge from SAMBA_2_2. Ther server code looks to be in sync now.
Mostly formatting and s/free/SAFE_FREE/g changes with the two exceptions
being
* John driver init changes
* Tim's printer enumeration bug fix
(This used to be commit f7536762863811f96364e8acd3716bdb7d665bbf)
Diffstat (limited to 'source3/printing')
-rw-r--r-- | source3/printing/nt_printing.c | 19 | ||||
-rw-r--r-- | source3/printing/pcap.c | 22 | ||||
-rw-r--r-- | source3/printing/print_cups.c | 2 | ||||
-rw-r--r-- | source3/printing/printing.c | 20 |
4 files changed, 34 insertions, 29 deletions
diff --git a/source3/printing/nt_printing.c b/source3/printing/nt_printing.c index ecf873c1ba..08d5ea430a 100644 --- a/source3/printing/nt_printing.c +++ b/source3/printing/nt_printing.c @@ -2838,7 +2838,7 @@ WERROR mod_a_printer(NT_PRINTER_INFO_LEVEL printer, uint32 level) Initialize printer devmode & data with previously saved driver init values. ****************************************************************************/ -static uint32 set_driver_init_2(NT_PRINTER_INFO_LEVEL_2 *info_ptr) +static BOOL set_driver_init_2(NT_PRINTER_INFO_LEVEL_2 *info_ptr) { int len = 0; pstring key; @@ -2891,9 +2891,14 @@ static uint32 set_driver_init_2(NT_PRINTER_INFO_LEVEL_2 *info_ptr) * NT/2k does not change out the entire DeviceMode of a printer * when changing the driver. Only the driverextra, private, & * driverversion fields. --jerry (Thu Mar 14 08:58:43 CST 2002) + * + * Later e4xamination revealed that Windows NT/2k does reset the + * the printer's device mode, bit **only** when you change a + * property of the device mode such as the page orientation. + * --jerry */ -#if 0 /* JERRY */ +#if 1 /* JERRY */ /* * Bind the saved DEVMODE to the new the printer. @@ -2945,19 +2950,19 @@ static uint32 set_driver_init_2(NT_PRINTER_INFO_LEVEL_2 *info_ptr) is bound to the new printer. ****************************************************************************/ -uint32 set_driver_init(NT_PRINTER_INFO_LEVEL *printer, uint32 level) +BOOL set_driver_init(NT_PRINTER_INFO_LEVEL *printer, uint32 level) { - uint32 result; + BOOL result = False; switch (level) { case 2: - { result=set_driver_init_2(printer->info_2); break; - } + default: - result=1; + DEBUG(0,("set_driver_init: Programmer's error! Unknown driver_init level [%d]\n", + level)); break; } diff --git a/source3/printing/pcap.c b/source3/printing/pcap.c index 920c6f354e..01e03c7c6b 100644 --- a/source3/printing/pcap.c +++ b/source3/printing/pcap.c @@ -111,7 +111,7 @@ static void ScanQconfig_fn(char *psz,void (*fn)(char *, char *)) iEtat = 0; /* scan qconfig file for searching <printername>: */ - for (;(line = fgets_slash(NULL,sizeof(pstring),pfile)); free(line)) + for (;(line = fgets_slash(NULL,sizeof(pstring),pfile)); SAFE_FREE(line)) { if (*line == '*' || *line == 0) continue; @@ -181,7 +181,7 @@ static BOOL ScanQconfig(char *psz,char *pszPrintername) if ((pfile = x_fopen(psz, O_RDONLY, 0)) == NULL) { DEBUG(0,( "Unable to open qconfig file %s for read!\n", psz)); - free(pName); + SAFE_FREE(pName); return(False); } slprintf(pName, iLg + 9, "%s:",pszPrintername); @@ -189,7 +189,7 @@ static BOOL ScanQconfig(char *psz,char *pszPrintername) /*DEBUG(3,( " Looking for entry %s\n",pName));*/ iEtat = 0; /* scan qconfig file for searching <printername>: */ - for (;(line = fgets_slash(NULL,sizeof(pstring),pfile)); free(line)) + for (;(line = fgets_slash(NULL,sizeof(pstring),pfile)); SAFE_FREE(line)) { if (*line == '*' || *line == 0) continue; @@ -208,8 +208,8 @@ static BOOL ScanQconfig(char *psz,char *pszPrintername) { /* name is found without stanza device */ /* probably a good printer ??? */ - free (line); - free(pName); + SAFE_FREE (line); + SAFE_FREE(pName); fclose(pfile); return(True); } @@ -222,15 +222,15 @@ static BOOL ScanQconfig(char *psz,char *pszPrintername) else if (strlocate(line,"device")) { /* it's a good virtual printer */ - free (line); - free(pName); + SAFE_FREE (line); + SAFE_FREE(pName); fclose(pfile); return(True); } break; } } - free (pName); + SAFE_FREE (pName); x_fclose(pfile); return(False); } @@ -288,7 +288,7 @@ BOOL pcap_printername_ok(char *pszPrintername, char *pszPrintcapname) return(False); } - for (;(line = fgets_slash(NULL,sizeof(pstring),pfile)); free(line)) + for (;(line = fgets_slash(NULL,sizeof(pstring),pfile)); SAFE_FREE(line)) { if (*line == '#' || *line == 0) continue; @@ -307,7 +307,7 @@ BOOL pcap_printername_ok(char *pszPrintername, char *pszPrintcapname) { /* normalise the case */ pstrcpy(pszPrintername,p); - free(line); + SAFE_FREE(line); x_fclose(pfile); return(True); } @@ -369,7 +369,7 @@ void pcap_printer_fn(void (*fn)(char *, char *)) return; } - for (;(line = fgets_slash(NULL,sizeof(pstring),pfile)); free(line)) + for (;(line = fgets_slash(NULL,sizeof(pstring),pfile)); SAFE_FREE(line)) { if (*line == '#' || *line == 0) continue; diff --git a/source3/printing/print_cups.c b/source3/printing/print_cups.c index b5315e10b2..51ebb739a3 100644 --- a/source3/printing/print_cups.c +++ b/source3/printing/print_cups.c @@ -824,7 +824,7 @@ cups_queue_get(int snum, print_queue_struct **q, print_status_struct *status) ippDelete(response); httpClose(http); - free (queue); + SAFE_FREE(queue); return (0); } diff --git a/source3/printing/printing.c b/source3/printing/printing.c index 47fc019d64..aa9df5e47f 100644 --- a/source3/printing/printing.c +++ b/source3/printing/printing.c @@ -52,7 +52,8 @@ BOOL print_backend_init(void) { char *sversion = "INFO/version"; - if (tdb && local_pid == sys_getpid()) return True; + if (tdb && local_pid == sys_getpid()) + return True; tdb = tdb_open_log(lock_path("printing.tdb"), 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0600); if (!tdb) { DEBUG(0,("print_backend_init: Failed to open printing backend database %s\n", @@ -108,7 +109,7 @@ static struct printjob *print_job_find(int jobid) return NULL; memcpy(&pjob, ret.dptr, sizeof(pjob)); - free(ret.dptr); + SAFE_FREE(ret.dptr); return &pjob; } @@ -291,7 +292,7 @@ static pid_t get_updating_pid(fstring printer_name) return (pid_t)-1; memcpy(&updating_pid, data.dptr, sizeof(pid_t)); - free(data.dptr); + SAFE_FREE(data.dptr); if (process_exists(updating_pid)) return updating_pid; @@ -568,10 +569,9 @@ BOOL print_job_exists(int jobid) return tdb_exists(tdb, print_key(jobid)); } - /**************************************************************************** - Work out which service a jobid is for - note that we have to look up by queue name to ensure that it works for + Work out which service a jobid is for. + Note that we have to look up by queue name to ensure that it works for other than the process that started the job. ****************************************************************************/ @@ -922,7 +922,7 @@ static int get_queue_status(int snum, print_status_struct *status) if (data.dsize == sizeof(print_status_struct)) { memcpy(status, data.dptr, sizeof(print_status_struct)); } - free(data.dptr); + SAFE_FREE(data.dptr); } return status->qcount; } @@ -968,7 +968,7 @@ static int get_total_jobs(int snum) } /*************************************************************************** -start spooling a job - return the jobid + Start spooling a job - return the jobid. ***************************************************************************/ int print_job_start(struct current_user *user, int snum, char *jobname) @@ -1116,7 +1116,7 @@ to open spool file %s.\n", pjob.filename)); } /**************************************************************************** - Update the number of pages spooled to jobid. + Update the number of pages spooled to jobid ****************************************************************************/ void print_job_endpage(int jobid) @@ -1330,7 +1330,7 @@ int print_queue_status(int snum, if (data.dsize == sizeof(*status)) { memcpy(status, data.dptr, sizeof(*status)); } - free(data.dptr); + SAFE_FREE(data.dptr); } /* |