summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2009-02-10 23:34:35 +0100
committerGünther Deschner <gd@samba.org>2009-02-14 01:42:00 +0100
commit9992827838d2f02226d91eaf67d68d2aa5adf265 (patch)
treedd0c82727cf80d8787e28b1a7b9c54838c38d625 /source3
parentcba40f65212814ddf7ccdcfdf92f799785a6ad4e (diff)
downloadsamba-9992827838d2f02226d91eaf67d68d2aa5adf265.tar.gz
samba-9992827838d2f02226d91eaf67d68d2aa5adf265.tar.bz2
samba-9992827838d2f02226d91eaf67d68d2aa5adf265.zip
s3-spoolss: add printer_info2_to_nt_printer_info2 and convert_printer_info_new.
Guenther
Diffstat (limited to 'source3')
-rw-r--r--source3/rpc_server/srv_spoolss_nt.c67
1 files changed, 67 insertions, 0 deletions
diff --git a/source3/rpc_server/srv_spoolss_nt.c b/source3/rpc_server/srv_spoolss_nt.c
index ef02dcfa26..aec5e66a15 100644
--- a/source3/rpc_server/srv_spoolss_nt.c
+++ b/source3/rpc_server/srv_spoolss_nt.c
@@ -1754,6 +1754,73 @@ static bool convert_printer_info(const SPOOL_PRINTER_INFO_LEVEL *uni,
return False;
}
+/****************************************************************************
+****************************************************************************/
+
+static bool printer_info2_to_nt_printer_info2(struct spoolss_SetPrinterInfo2 *r,
+ NT_PRINTER_INFO_LEVEL_2 *d)
+{
+ DEBUG(7,("printer_info2_to_nt_printer_info2\n"));
+
+ if (!r || !d) {
+ return false;
+ }
+
+ d->attributes = r->attributes;
+ d->priority = r->priority;
+ d->default_priority = r->defaultpriority;
+ d->starttime = r->starttime;
+ d->untiltime = r->untiltime;
+ d->status = r->status;
+ d->cjobs = r->cjobs;
+
+ fstrcpy(d->servername, r->servername);
+ fstrcpy(d->printername, r->printername);
+ fstrcpy(d->sharename, r->sharename);
+ fstrcpy(d->portname, r->portname);
+ fstrcpy(d->drivername, r->drivername);
+ slprintf(d->comment, sizeof(d->comment)-1, "%s", r->comment);
+ fstrcpy(d->location, r->location);
+ fstrcpy(d->sepfile, r->sepfile);
+ fstrcpy(d->printprocessor, r->printprocessor);
+ fstrcpy(d->datatype, r->datatype);
+ fstrcpy(d->parameters, r->parameters);
+
+ return true;
+}
+
+/****************************************************************************
+****************************************************************************/
+
+static bool convert_printer_info_new(struct spoolss_SetPrinterInfoCtr *info_ctr,
+ NT_PRINTER_INFO_LEVEL *printer)
+{
+ bool ret;
+
+ switch (info_ctr->level) {
+ case 2:
+ /* allocate memory if needed. Messy because
+ convert_printer_info is used to update an existing
+ printer or build a new one */
+
+ if (!printer->info_2) {
+ printer->info_2 = TALLOC_ZERO_P(printer, NT_PRINTER_INFO_LEVEL_2);
+ if (!printer->info_2) {
+ DEBUG(0,("convert_printer_info_new: "
+ "talloc() failed!\n"));
+ return false;
+ }
+ }
+
+ ret = printer_info2_to_nt_printer_info2(info_ctr->info.info2,
+ printer->info_2);
+ printer->info_2->setuptime = time(NULL);
+ return ret;
+ }
+
+ return false;
+}
+
static bool convert_printer_driver_info(const SPOOL_PRINTER_DRIVER_INFO_LEVEL *uni,
NT_PRINTER_DRIVER_INFO_LEVEL *printer, uint32 level)
{