summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source3/include/proto.h2
-rw-r--r--source3/printing/nt_printing.c313
2 files changed, 0 insertions, 315 deletions
diff --git a/source3/include/proto.h b/source3/include/proto.h
index 57a9ceebd3..66a4357172 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -4735,7 +4735,6 @@ int pack_devicemode(struct spoolss_DeviceMode *devmode, uint8 *buf, int buflen);
int unpack_devicemode(TALLOC_CTX *mem_ctx,
const uint8 *buf, int buflen,
struct spoolss_DeviceMode **devmode);
-uint32 del_a_printer(const char *sharename);
int add_new_printer_key( NT_PRINTER_DATA *data, const char *name );
int delete_printer_key( NT_PRINTER_DATA *data, const char *name );
int lookup_printerkey( NT_PRINTER_DATA *data, const char *name );
@@ -4746,7 +4745,6 @@ WERROR delete_printer_data( NT_PRINTER_INFO_LEVEL_2 *p2, const char *key, const
WERROR add_printer_data( NT_PRINTER_INFO_LEVEL_2 *p2, const char *key, const char *value,
uint32 type, uint8 *data, int real_len );
struct regval_blob* get_printer_data( NT_PRINTER_INFO_LEVEL_2 *p2, const char *key, const char *value );
-WERROR mod_a_printer(NT_PRINTER_INFO_LEVEL *printer, uint32 level);
uint32 free_a_printer(NT_PRINTER_INFO_LEVEL **pp_printer, uint32 level);
bool driver_info_ctr_to_info8(struct spoolss_AddDriverInfoCtr *r,
struct spoolss_DriverInfo8 *_info8);
diff --git a/source3/printing/nt_printing.c b/source3/printing/nt_printing.c
index 2cb2ce690a..9270226195 100644
--- a/source3/printing/nt_printing.c
+++ b/source3/printing/nt_printing.c
@@ -2050,175 +2050,6 @@ done:
}
/****************************************************************************
- Pack all values in all printer keys
- ***************************************************************************/
-
-static int pack_values(NT_PRINTER_DATA *data, uint8 *buf, int buflen)
-{
- int len = 0;
- int i, j;
- struct regval_blob *val;
- struct regval_ctr *val_ctr;
- char *path = NULL;
- int num_values;
-
- if ( !data )
- return 0;
-
- /* loop over all keys */
-
- for ( i=0; i<data->num_keys; i++ ) {
- val_ctr = data->keys[i].values;
- num_values = regval_ctr_numvals( val_ctr );
-
- /* pack the keyname followed by a empty value */
-
- len += tdb_pack(buf+len, buflen-len, "pPdB",
- &data->keys[i].name,
- data->keys[i].name,
- REG_NONE,
- 0,
- NULL);
-
- /* now loop over all values */
-
- for ( j=0; j<num_values; j++ ) {
- /* pathname should be stored as <key>\<value> */
-
- val = regval_ctr_specific_value( val_ctr, j );
- if (asprintf(&path, "%s\\%s",
- data->keys[i].name,
- regval_name(val)) < 0) {
- return -1;
- }
-
- len += tdb_pack(buf+len, buflen-len, "pPdB",
- val,
- path,
- regval_type(val),
- regval_size(val),
- regval_data_p(val) );
-
- DEBUG(8,("specific: [%s], len: %d\n", regval_name(val), regval_size(val)));
- SAFE_FREE(path);
- }
-
- }
-
- /* terminator */
-
- len += tdb_pack(buf+len, buflen-len, "p", NULL);
-
- return len;
-}
-
-
-/****************************************************************************
-****************************************************************************/
-static WERROR update_a_printer_2(NT_PRINTER_INFO_LEVEL_2 *info)
-{
- uint8 *buf;
- int buflen, len;
- int retlen;
- WERROR ret;
- TDB_DATA kbuf, dbuf;
-
- /*
- * in addprinter: no servername and the printer is the name
- * in setprinter: servername is \\server
- * and printer is \\server\\printer
- *
- * Samba manages only local printers.
- * we currently don't support things like i
- * path=\\other_server\printer
- *
- * We only store the printername, not \\server\printername
- */
-
- if ( info->servername[0] != '\0' ) {
- trim_string(info->printername, info->servername, NULL);
- trim_char(info->printername, '\\', '\0');
- info->servername[0]='\0';
- }
-
- /*
- * JFM: one day I'll forget.
- * below that's info->portname because that's the SAMBA sharename
- * and I made NT 'thinks' it's the portname
- * the info->sharename is the thing you can name when you add a printer
- * that's the short-name when you create shared printer for 95/98
- * So I've made a limitation in SAMBA: you can only have 1 printer model
- * behind a SAMBA share.
- */
-
- buf = NULL;
- buflen = 0;
-
- again:
- len = 0;
- len += tdb_pack(buf+len, buflen-len, "dddddddddddfffffPfffff",
- info->attributes,
- info->priority,
- info->default_priority,
- info->starttime,
- info->untiltime,
- info->status,
- info->cjobs,
- info->averageppm,
- info->changeid,
- info->c_setprinter,
- info->setuptime,
- info->servername,
- info->printername,
- info->sharename,
- info->portname,
- info->drivername,
- info->comment,
- info->location,
- info->sepfile,
- info->printprocessor,
- info->datatype,
- info->parameters);
-
- len += pack_devicemode(info->devmode, buf+len, buflen-len);
- retlen = pack_values( info->data, buf+len, buflen-len );
- if (retlen == -1) {
- ret = WERR_NOMEM;
- goto done;
- }
- len += retlen;
-
- if (buflen != len) {
- buf = (uint8 *)SMB_REALLOC(buf, len);
- if (!buf) {
- DEBUG(0,("update_a_printer_2: failed to enlarge buffer!\n"));
- ret = WERR_NOMEM;
- goto done;
- }
- buflen = len;
- goto again;
- }
-
- kbuf = make_printer_tdbkey(talloc_tos(), info->sharename );
-
- dbuf.dptr = buf;
- dbuf.dsize = len;
-
- ret = (tdb_store(tdb_printers, kbuf, dbuf, TDB_REPLACE) == 0? WERR_OK : WERR_NOMEM);
-
-done:
- if (!W_ERROR_IS_OK(ret))
- DEBUG(8, ("error updating printer to tdb on disk\n"));
-
- SAFE_FREE(buf);
-
- DEBUG(8,("packed printer [%s] with driver [%s] portname=[%s] len=%d\n",
- info->sharename, info->drivername, info->portname, len));
-
- return ret;
-}
-
-/****************************************************************************
Create and allocate a default devicemode.
****************************************************************************/
@@ -3467,150 +3298,6 @@ WERROR spoolss_map_to_os2_driver(TALLOC_CTX *mem_ctx, const char **pdrivername)
}
/****************************************************************************
- Debugging function, dump at level 6 the struct in the logs.
-****************************************************************************/
-static uint32 dump_a_printer(NT_PRINTER_INFO_LEVEL *printer, uint32 level)
-{
- uint32 result;
- NT_PRINTER_INFO_LEVEL_2 *info2;
-
- DEBUG(106,("Dumping printer at level [%d]\n", level));
-
- switch (level) {
- case 2:
- {
- if (printer->info_2 == NULL)
- result=5;
- else
- {
- info2=printer->info_2;
-
- DEBUGADD(106,("attributes:[%d]\n", info2->attributes));
- DEBUGADD(106,("priority:[%d]\n", info2->priority));
- DEBUGADD(106,("default_priority:[%d]\n", info2->default_priority));
- DEBUGADD(106,("starttime:[%d]\n", info2->starttime));
- DEBUGADD(106,("untiltime:[%d]\n", info2->untiltime));
- DEBUGADD(106,("status:[%d]\n", info2->status));
- DEBUGADD(106,("cjobs:[%d]\n", info2->cjobs));
- DEBUGADD(106,("averageppm:[%d]\n", info2->averageppm));
- DEBUGADD(106,("changeid:[%d]\n", info2->changeid));
- DEBUGADD(106,("c_setprinter:[%d]\n", info2->c_setprinter));
- DEBUGADD(106,("setuptime:[%d]\n", info2->setuptime));
-
- DEBUGADD(106,("servername:[%s]\n", info2->servername));
- DEBUGADD(106,("printername:[%s]\n", info2->printername));
- DEBUGADD(106,("sharename:[%s]\n", info2->sharename));
- DEBUGADD(106,("portname:[%s]\n", info2->portname));
- DEBUGADD(106,("drivername:[%s]\n", info2->drivername));
- DEBUGADD(106,("comment:[%s]\n", info2->comment));
- DEBUGADD(106,("location:[%s]\n", info2->location));
- DEBUGADD(106,("sepfile:[%s]\n", info2->sepfile));
- DEBUGADD(106,("printprocessor:[%s]\n", info2->printprocessor));
- DEBUGADD(106,("datatype:[%s]\n", info2->datatype));
- DEBUGADD(106,("parameters:[%s]\n", info2->parameters));
- result=0;
- }
- break;
- }
- default:
- DEBUGADD(106,("dump_a_printer: Level %u not implemented\n", (unsigned int)level ));
- result=1;
- break;
- }
-
- return result;
-}
-
-/****************************************************************************
- Update the changeid time.
- This is SO NASTY as some drivers need this to change, others need it
- static. This value will change every second, and I must hope that this
- is enough..... DON'T CHANGE THIS CODE WITHOUT A TEST MATRIX THE SIZE OF
- UTAH ! JRA.
-****************************************************************************/
-
-static uint32 rev_changeid(void)
-{
- struct timeval tv;
-
- get_process_uptime(&tv);
-
-#if 1 /* JERRY */
- /* Return changeid as msec since spooler restart */
- return tv.tv_sec * 1000 + tv.tv_usec / 1000;
-#else
- /*
- * This setting seems to work well but is too untested
- * to replace the above calculation. Left in for experiementation
- * of the reader --jerry (Tue Mar 12 09:15:05 CST 2002)
- */
- return tv.tv_sec * 10 + tv.tv_usec / 100000;
-#endif
-}
-
-
-/*
- * The function below are the high level ones.
- * only those ones must be called from the spoolss code.
- * JFM.
- */
-
-/****************************************************************************
- Modify a printer. This is called from SETPRINTERDATA/DELETEPRINTERDATA.
-****************************************************************************/
-
-WERROR mod_a_printer(NT_PRINTER_INFO_LEVEL *printer, uint32 level)
-{
- WERROR result;
-
- dump_a_printer(printer, level);
-
- switch (level) {
- case 2:
- {
- /*
- * Update the changestamp. Emperical tests show that the
- * ChangeID is always updated,but c_setprinter is
- * global spooler variable (not per printer).
- */
-
- /* ChangeID **must** be increasing over the lifetime
- of client's spoolss service in order for the
- client's cache to show updates */
-
- printer->info_2->changeid = rev_changeid();
-
- /*
- * Because one day someone will ask:
- * NT->NT An admin connection to a remote
- * printer show changes imeediately in
- * the properities dialog
- *
- * A non-admin connection will only show the
- * changes after viewing the properites page
- * 2 times. Seems to be related to a
- * race condition in the client between the spooler
- * updating the local cache and the Explorer.exe GUI
- * actually displaying the properties.
- *
- * This is fixed in Win2k. admin/non-admin
- * connections both display changes immediately.
- *
- * 14/12/01 --jerry
- */
-
- result=update_a_printer_2(printer->info_2);
- break;
- }
- default:
- result=WERR_UNKNOWN_LEVEL;
- break;
- }
-
- return result;
-}
-
-/****************************************************************************
Deletes a NT_PRINTER_INFO_LEVEL struct.
****************************************************************************/