summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2000-05-24 06:34:47 +0000
committerAndrew Tridgell <tridge@samba.org>2000-05-24 06:34:47 +0000
commit722c86a38f72fb8b114a1d89aed23f262d00b6c6 (patch)
tree727871ae037889cdb7777ad31d67681970273d6c /source3
parent68239f38fd27c6426aa4a042b0993c6efee2ea1d (diff)
downloadsamba-722c86a38f72fb8b114a1d89aed23f262d00b6c6.tar.gz
samba-722c86a38f72fb8b114a1d89aed23f262d00b6c6.tar.bz2
samba-722c86a38f72fb8b114a1d89aed23f262d00b6c6.zip
a fairly big change in spoolss.
got rid of the forms, drivers and printers files in the nt drivers directory and instead use a single tdb note that this is _not_ all finished. (This used to be commit 537cd6dff057df481fb208121ce4396fc76c2a06)
Diffstat (limited to 'source3')
-rw-r--r--source3/rpc_server/srv_spoolss_nt.c30
1 files changed, 14 insertions, 16 deletions
diff --git a/source3/rpc_server/srv_spoolss_nt.c b/source3/rpc_server/srv_spoolss_nt.c
index da808f1b57..dc24c3bc31 100644
--- a/source3/rpc_server/srv_spoolss_nt.c
+++ b/source3/rpc_server/srv_spoolss_nt.c
@@ -2456,7 +2456,7 @@ static void construct_printer_driver_info_2(DRIVER_INFO_2 *info, int snum, fstri
*
* convert an array of ascii string to a UNICODE string
********************************************************************/
-static void init_unistr_array(uint16 **uni_array, char **char_array, char *where)
+static void init_unistr_array(uint16 **uni_array, fstring *char_array, char *where)
{
int i=0;
int j=0;
@@ -2466,7 +2466,8 @@ static void init_unistr_array(uint16 **uni_array, char **char_array, char *where
DEBUG(6,("init_unistr_array\n"));
*uni_array=NULL;
- for (v=char_array[i]; *v!='\0'; v=char_array[i]) {
+ while (1) {
+ v = char_array[i];
snprintf(line, sizeof(line)-1, "%s%s", where, v);
DEBUGADD(6,("%d:%s:%d\n", i, line, strlen(line)));
if((*uni_array=Realloc(*uni_array, (j+strlen(line)+2)*sizeof(uint16))) == NULL) {
@@ -2476,9 +2477,12 @@ static void init_unistr_array(uint16 **uni_array, char **char_array, char *where
ascii_to_unistr((char *)(*uni_array+j), line , 2*strlen(line));
j+=strlen(line)+1;
i++;
+ if (strlen(v) == 0) break;
}
- (*uni_array)[j]=0x0000;
+ if (*uni_array) {
+ (*uni_array)[j]=0x0000;
+ }
DEBUGADD(6,("last one:done\n"));
}
@@ -2614,27 +2618,21 @@ static uint32 getprinterdriver2_level2(fstring servername, fstring architecture,
****************************************************************************/
static uint32 getprinterdriver2_level3(fstring servername, fstring architecture, int snum, NEW_BUFFER *buffer, uint32 offered, uint32 *needed)
{
- DRIVER_INFO_3 *info=NULL;
-
- if((info=(DRIVER_INFO_3 *)malloc(sizeof(DRIVER_INFO_3)))==NULL)
- return ERROR_NOT_ENOUGH_MEMORY;
-
- construct_printer_driver_info_3(info, snum, servername, architecture);
+ DRIVER_INFO_3 info;
+
+ ZERO_STRUCT(info);
+
+ construct_printer_driver_info_3(&info, snum, servername, architecture);
/* check the required size. */
- *needed += spoolss_size_printer_driver_info_3(info);
+ *needed += spoolss_size_printer_driver_info_3(&info);
if (!alloc_buffer_size(buffer, *needed)) {
- safe_free(info);
return ERROR_INSUFFICIENT_BUFFER;
}
/* fill the buffer with the structures */
- new_smb_io_printer_driver_info_3("", buffer, info, 0);
-
- /* clear memory */
- safe_free(info->dependentfiles);
- safe_free(info);
+ new_smb_io_printer_driver_info_3("", buffer, &info, 0);
if (*needed > offered)
return ERROR_INSUFFICIENT_BUFFER;