summaryrefslogtreecommitdiff
path: root/source3/printing
diff options
context:
space:
mode:
authorJean-François Micouleau <jfm@samba.org>2000-07-12 14:10:40 +0000
committerJean-François Micouleau <jfm@samba.org>2000-07-12 14:10:40 +0000
commit5813ecff99431c3529cd45f3b579ef16e72a46f0 (patch)
tree0b7f5e6685894a48d15b743c2247f96ce4850830 /source3/printing
parent8edb4966aeb8a8df6e5e348085450b6686bdc879 (diff)
downloadsamba-5813ecff99431c3529cd45f3b579ef16e72a46f0.tar.gz
samba-5813ecff99431c3529cd45f3b579ef16e72a46f0.tar.bz2
samba-5813ecff99431c3529cd45f3b579ef16e72a46f0.zip
- The printers are indexed by the sharename in both get_a_printer() and
add_a_printer() now. - correctly unpack the private part of a devmode and remove a memleak - correctly retrieve the pair(value,data) for getprinterdata - handle null devicemode in printer_info_2 I still have some bugs but I'm not crashing anymore NT4SP6 d/c build :-) J.F. (This used to be commit 493f7d11acf753ba24c88e6cbb73d86a8595a66a)
Diffstat (limited to 'source3/printing')
-rw-r--r--source3/printing/nt_printing.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/source3/printing/nt_printing.c b/source3/printing/nt_printing.c
index bdc9e54a07..4e250d43c0 100644
--- a/source3/printing/nt_printing.c
+++ b/source3/printing/nt_printing.c
@@ -677,7 +677,7 @@ static uint32 add_a_printer_2(NT_PRINTER_INFO_LEVEL_2 *info)
slprintf(key, sizeof(key), "%s%s",
- PRINTERS_PREFIX, info->portname);
+ PRINTERS_PREFIX, info->sharename);
kbuf.dptr = key;
kbuf.dsize = strlen(key)+1;
@@ -686,10 +686,13 @@ static uint32 add_a_printer_2(NT_PRINTER_INFO_LEVEL_2 *info)
ret = tdb_store(tdb, kbuf, dbuf, TDB_REPLACE);
+ if (ret == -1)
+ DEBUG(8, ("error updating printer to tdb on disk\n"));
+
safe_free(buf);
- DEBUG(8,("packed printer [%s] with printprocessor [%s] parameters=[%s] len=%d\n",
- info->portname, info->printprocessor, info->parameters, len));
+ DEBUG(8,("packed printer [%s] with driver [%s] portname=[%s] len=%d\n",
+ info->portname, info->drivername, info->portname, len));
return ret;
}
@@ -974,17 +977,14 @@ static int unpack_devicemode(NT_DEVICEMODE **nt_devmode, char *buf, int buflen)
&devmode.panningheight,
&devmode.private);
- if (devmode.private) {
- devmode.private = (uint8 *)malloc(devmode.driverextra);
- if (!devmode.private) return 2;
- len += tdb_unpack(buf+len, buflen-len, "B",
- devmode.driverextra,
- devmode.private);
- }
+ if (devmode.private)
+ len += tdb_unpack(buf+len, buflen-len, "B", &devmode.driverextra, &devmode.private);
*nt_devmode = (NT_DEVICEMODE *)memdup(&devmode, sizeof(devmode));
- DEBUG(8,("Unpacked devicemode [%s]\n", devmode.formname));
+ DEBUG(8,("Unpacked devicemode [%s](%s)\n", devmode.devicename, devmode.formname));
+ if (devmode.private)
+ DEBUG(8,("with a private section of %d bytes\n", devmode.driverextra));
return len;
}
@@ -1128,8 +1128,8 @@ static uint32 get_a_printer_2(NT_PRINTER_INFO_LEVEL_2 **info_ptr, fstring sharen
safe_free(dbuf.dptr);
*info_ptr=memdup(&info, sizeof(info));
- DEBUG(9,("Unpacked printprocessor for [%s] of [%s]\n",
- sharename, info.printprocessor));
+ DEBUG(9,("Unpacked printer [%s] running drier [%s]\n",
+ sharename, info.drivername));
return 0;
@@ -1414,8 +1414,7 @@ BOOL get_specific_param_by_index(NT_PRINTER_INFO_LEVEL printer, uint32 level, ui
param=printer.info_2->specific;
- while (param != NULL && i <= param_index)
- {
+ while (param != NULL && i < param_index) {
param=param->next;
i++;
}
@@ -1429,6 +1428,7 @@ BOOL get_specific_param_by_index(NT_PRINTER_INFO_LEVEL printer, uint32 level, ui
*data=(uint8 *)malloc(param->data_len*sizeof(uint8));
if(*data == NULL)
return False;
+ ZERO_STRUCTP(*data);
memcpy(*data, param->data, param->data_len);
*len=param->data_len;
return True;