mirror of
https://github.com/samba-team/samba.git
synced 2025-08-03 04:22:09 +03:00
printing merge from HEAD
This commit is contained in:
@ -149,21 +149,17 @@ static BOOL parse_lpq_bsd(char *line,print_queue_struct *buf,BOOL first)
|
|||||||
StrnCpy(buf->fs_file,tok[FILETOK],sizeof(buf->fs_file)-1);
|
StrnCpy(buf->fs_file,tok[FILETOK],sizeof(buf->fs_file)-1);
|
||||||
|
|
||||||
if ((FILETOK + 1) != TOTALTOK) {
|
if ((FILETOK + 1) != TOTALTOK) {
|
||||||
int bufsize;
|
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
bufsize = sizeof(buf->fs_file) - strlen(buf->fs_file) - 1;
|
|
||||||
|
|
||||||
for (i = (FILETOK + 1); i < TOTALTOK; i++) {
|
for (i = (FILETOK + 1); i < TOTALTOK; i++) {
|
||||||
safe_strcat(buf->fs_file," ",bufsize);
|
/* FIXME: Using fstrcat rather than other means is a bit
|
||||||
safe_strcat(buf->fs_file,tok[i],bufsize - 1);
|
* inefficient; this might be a problem for enormous queues with
|
||||||
bufsize = sizeof(buf->fs_file) - strlen(buf->fs_file) - 1;
|
* many fields. */
|
||||||
if (bufsize <= 0) {
|
fstrcat(buf->fs_file, " ");
|
||||||
break;
|
fstrcat(buf->fs_file, tok[i]);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
/* Ensure null termination. */
|
/* Ensure null termination. */
|
||||||
buf->fs_file[sizeof(buf->fs_file)-1] = '\0';
|
fstrterminate(buf->fs_file);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef PRIOTOK
|
#ifdef PRIOTOK
|
||||||
@ -282,21 +278,17 @@ static BOOL parse_lpq_lprng(char *line,print_queue_struct *buf,BOOL first)
|
|||||||
StrnCpy(buf->fs_file,tokarr[LPRNG_FILETOK],sizeof(buf->fs_file)-1);
|
StrnCpy(buf->fs_file,tokarr[LPRNG_FILETOK],sizeof(buf->fs_file)-1);
|
||||||
|
|
||||||
if ((LPRNG_FILETOK + 1) != LPRNG_TOTALTOK) {
|
if ((LPRNG_FILETOK + 1) != LPRNG_TOTALTOK) {
|
||||||
int bufsize;
|
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
bufsize = sizeof(buf->fs_file) - strlen(buf->fs_file) - 1;
|
|
||||||
|
|
||||||
for (i = (LPRNG_FILETOK + 1); i < LPRNG_TOTALTOK; i++) {
|
for (i = (LPRNG_FILETOK + 1); i < LPRNG_TOTALTOK; i++) {
|
||||||
safe_strcat(buf->fs_file," ",bufsize);
|
/* FIXME: Using fstrcat rather than other means is a bit
|
||||||
safe_strcat(buf->fs_file,tokarr[i],bufsize - 1);
|
* inefficient; this might be a problem for enormous queues with
|
||||||
bufsize = sizeof(buf->fs_file) - strlen(buf->fs_file) - 1;
|
* many fields. */
|
||||||
if (bufsize <= 0) {
|
fstrcat(buf->fs_file, " ");
|
||||||
break;
|
fstrcat(buf->fs_file, tokarr[i]);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
/* Ensure null termination. */
|
/* Ensure null termination. */
|
||||||
buf->fs_file[sizeof(buf->fs_file)-1] = '\0';
|
fstrterminate(buf->fs_file);
|
||||||
}
|
}
|
||||||
|
|
||||||
return(True);
|
return(True);
|
||||||
|
@ -55,8 +55,8 @@ BOOL print_backend_init(void)
|
|||||||
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);
|
tdb = tdb_open_log(lock_path("printing.tdb"), 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0600);
|
||||||
if (!tdb) {
|
if (!tdb) {
|
||||||
DEBUG(0,("print_backend_init: Failed to open printing backend database. Error = [%s]\n",
|
DEBUG(0,("print_backend_init: Failed to open printing backend database %s\n",
|
||||||
tdb_errorstr(tdb)));
|
lock_path("printing.tdb") ));
|
||||||
return False;
|
return False;
|
||||||
}
|
}
|
||||||
local_pid = sys_getpid();
|
local_pid = sys_getpid();
|
||||||
@ -536,7 +536,10 @@ update the internal database from the system print queue for a queue
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
static void print_queue_update(int snum)
|
static void print_queue_update(int snum)
|
||||||
{
|
{
|
||||||
message_send_pid(background_lpq_updater_pid, MSG_PRINTER_UPDATE, &snum, sizeof(snum), False);
|
if (background_lpq_updater_pid > 0) {
|
||||||
|
message_send_pid(background_lpq_updater_pid, MSG_PRINTER_UPDATE,
|
||||||
|
&snum, sizeof(snum), False);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
|
@ -628,7 +628,6 @@ BOOL spoolss_io_devmode(char *desc, prs_struct *ps, int depth, DEVICEMODE *devmo
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
/* See the comments on the DEVMODE in the msdn GDI documentation */
|
/* See the comments on the DEVMODE in the msdn GDI documentation */
|
||||||
/* (WINVER >= 0x0400) */
|
|
||||||
case 0x0400:
|
case 0x0400:
|
||||||
case 0x0401:
|
case 0x0401:
|
||||||
if (!prs_uint32("icmmethod", ps, depth, &devmode->icmmethod))
|
if (!prs_uint32("icmmethod", ps, depth, &devmode->icmmethod))
|
||||||
@ -643,14 +642,10 @@ BOOL spoolss_io_devmode(char *desc, prs_struct *ps, int depth, DEVICEMODE *devmo
|
|||||||
return False;
|
return False;
|
||||||
if (!prs_uint32("reserved2", ps, depth, &devmode->reserved2))
|
if (!prs_uint32("reserved2", ps, depth, &devmode->reserved2))
|
||||||
return False;
|
return False;
|
||||||
|
|
||||||
/* (WINVER >= 0x0500) || (_WIN32_WINNT >= 0x0400) */
|
|
||||||
if (devmode->specversion == 0x401) {
|
|
||||||
if (!prs_uint32("panningwidth", ps, depth, &devmode->panningwidth))
|
if (!prs_uint32("panningwidth", ps, depth, &devmode->panningwidth))
|
||||||
return False;
|
return False;
|
||||||
if (!prs_uint32("panningheight", ps, depth, &devmode->panningheight))
|
if (!prs_uint32("panningheight", ps, depth, &devmode->panningheight))
|
||||||
return False;
|
return False;
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* log an error if we see something else */
|
/* log an error if we see something else */
|
||||||
@ -1726,12 +1721,19 @@ static uint32 size_of_relative_string(UNISTR *string)
|
|||||||
uint32 size=0;
|
uint32 size=0;
|
||||||
|
|
||||||
size=str_len_uni(string); /* the string length */
|
size=str_len_uni(string); /* the string length */
|
||||||
size=size+1; /* add the leading zero */
|
size=size+1; /* add the trailing zero */
|
||||||
size=size*2; /* convert in char */
|
size=size*2; /* convert in char */
|
||||||
/* Ensure size is 4 byte multiple (prs_align is being called...). */
|
|
||||||
size += ((4 - (size & 3)) & 3);
|
|
||||||
size=size+4; /* add the size of the ptr */
|
size=size+4; /* add the size of the ptr */
|
||||||
|
|
||||||
|
#if 0 /* JERRY */
|
||||||
|
/*
|
||||||
|
* Do not include alignment as Win2k does not align relative
|
||||||
|
* strings within a buffer --jerry
|
||||||
|
*/
|
||||||
|
/* Ensure size is 4 byte multiple (prs_align is being called...). */
|
||||||
|
/* size += ((4 - (size & 3)) & 3); */
|
||||||
|
#endif
|
||||||
|
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1759,32 +1761,6 @@ static uint32 size_of_systemtime(SYSTEMTIME *systime)
|
|||||||
return (sizeof(SYSTEMTIME) +4);
|
return (sizeof(SYSTEMTIME) +4);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*******************************************************************
|
|
||||||
* write a UNICODE string.
|
|
||||||
* used by all the RPC structs passing a buffer
|
|
||||||
********************************************************************/
|
|
||||||
|
|
||||||
static BOOL spoolss_smb_io_unistr(char *desc, UNISTR *uni, prs_struct *ps, int depth)
|
|
||||||
{
|
|
||||||
if (uni == NULL)
|
|
||||||
return False;
|
|
||||||
|
|
||||||
prs_debug(ps, depth, desc, "spoolss_smb_io_unistr");
|
|
||||||
depth++;
|
|
||||||
|
|
||||||
/* there should be no align here as it can mess up
|
|
||||||
parsing a NEW_BUFFER->prs */
|
|
||||||
#if 0 /* JERRY */
|
|
||||||
if (!prs_align(ps))
|
|
||||||
return False;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (!prs_unistr("unistr", ps, depth, uni))
|
|
||||||
return False;
|
|
||||||
|
|
||||||
return True;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*******************************************************************
|
/*******************************************************************
|
||||||
* write a UNICODE string and its relative pointer.
|
* write a UNICODE string and its relative pointer.
|
||||||
* used by all the RPC structs passing a buffer
|
* used by all the RPC structs passing a buffer
|
||||||
@ -1816,8 +1792,14 @@ static BOOL smb_io_relstr(char *desc, NEW_BUFFER *buffer, int depth, UNISTR *str
|
|||||||
buffer->string_at_end -= (size_of_relative_string(string) - 4);
|
buffer->string_at_end -= (size_of_relative_string(string) - 4);
|
||||||
if(!prs_set_offset(ps, buffer->string_at_end))
|
if(!prs_set_offset(ps, buffer->string_at_end))
|
||||||
return False;
|
return False;
|
||||||
|
#if 0 /* JERRY */
|
||||||
|
/*
|
||||||
|
* Win2k does not align strings in a buffer
|
||||||
|
* Tested against WinNT 4.0 SP 6a & 2k SP2 --jerry
|
||||||
|
*/
|
||||||
if (!prs_align(ps))
|
if (!prs_align(ps))
|
||||||
return False;
|
return False;
|
||||||
|
#endif
|
||||||
buffer->string_at_end = prs_offset(ps);
|
buffer->string_at_end = prs_offset(ps);
|
||||||
|
|
||||||
/* write the string */
|
/* write the string */
|
||||||
@ -1844,7 +1826,7 @@ static BOOL smb_io_relstr(char *desc, NEW_BUFFER *buffer, int depth, UNISTR *str
|
|||||||
return False;
|
return False;
|
||||||
|
|
||||||
/* read the string */
|
/* read the string */
|
||||||
if (!spoolss_smb_io_unistr(desc, string, ps, depth))
|
if (!smb_io_unistr(desc, string, ps, depth))
|
||||||
return False;
|
return False;
|
||||||
|
|
||||||
if(!prs_set_offset(ps, old_offset))
|
if(!prs_set_offset(ps, old_offset))
|
||||||
@ -1901,7 +1883,7 @@ static BOOL smb_io_relarraystr(char *desc, NEW_BUFFER *buffer, int depth, uint16
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* write the string */
|
/* write the string */
|
||||||
if (!spoolss_smb_io_unistr(desc, &chaine, ps, depth)) {
|
if (!smb_io_unistr(desc, &chaine, ps, depth)) {
|
||||||
SAFE_FREE(chaine.buffer);
|
SAFE_FREE(chaine.buffer);
|
||||||
return False;
|
return False;
|
||||||
}
|
}
|
||||||
@ -1940,7 +1922,7 @@ static BOOL smb_io_relarraystr(char *desc, NEW_BUFFER *buffer, int depth, uint16
|
|||||||
return False;
|
return False;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
if (!spoolss_smb_io_unistr(desc, &chaine, ps, depth))
|
if (!smb_io_unistr(desc, &chaine, ps, depth))
|
||||||
return False;
|
return False;
|
||||||
|
|
||||||
l_chaine=str_len_uni(&chaine);
|
l_chaine=str_len_uni(&chaine);
|
||||||
@ -5032,11 +5014,6 @@ BOOL make_spoolss_q_addprinterdriver(TALLOC_CTX *mem_ctx,
|
|||||||
make_spoolss_driver_info_3(mem_ctx, &q_u->info.info_3, info->info3);
|
make_spoolss_driver_info_3(mem_ctx, &q_u->info.info_3, info->info3);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* info level 6 is supported by WinME and Win2k */
|
|
||||||
case 6:
|
|
||||||
/* WRITEME!! will add later --jerry */
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
DEBUG(0,("make_spoolss_q_addprinterdriver: Unknown info level [%d]\n", level));
|
DEBUG(0,("make_spoolss_q_addprinterdriver: Unknown info level [%d]\n", level));
|
||||||
break;
|
break;
|
||||||
|
@ -1451,11 +1451,7 @@ struct api_struct api_spoolss_cmds[] =
|
|||||||
{"SPOOLSS_SETPRINTERDATAEX", SPOOLSS_SETPRINTERDATAEX, api_spoolss_setprinterdataex },
|
{"SPOOLSS_SETPRINTERDATAEX", SPOOLSS_SETPRINTERDATAEX, api_spoolss_setprinterdataex },
|
||||||
{"SPOOLSS_ENUMPRINTERKEY", SPOOLSS_ENUMPRINTERKEY, api_spoolss_enumprinterkey },
|
{"SPOOLSS_ENUMPRINTERKEY", SPOOLSS_ENUMPRINTERKEY, api_spoolss_enumprinterkey },
|
||||||
{"SPOOLSS_ENUMPRINTERDATAEX", SPOOLSS_ENUMPRINTERDATAEX, api_spoolss_enumprinterdataex },
|
{"SPOOLSS_ENUMPRINTERDATAEX", SPOOLSS_ENUMPRINTERDATAEX, api_spoolss_enumprinterdataex },
|
||||||
#if 0
|
|
||||||
/* Disabled because it doesn't fix the bug I am looking at but it would be
|
|
||||||
a shame to throw away the code. -tpot */
|
|
||||||
{"SPOOLSS_GETPRINTPROCESSORDIRECTORY",SPOOLSS_GETPRINTPROCESSORDIRECTORY,api_spoolss_getprintprocessordirectory},
|
{"SPOOLSS_GETPRINTPROCESSORDIRECTORY",SPOOLSS_GETPRINTPROCESSORDIRECTORY,api_spoolss_getprintprocessordirectory},
|
||||||
#endif
|
|
||||||
{ NULL, 0, NULL }
|
{ NULL, 0, NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -5084,7 +5084,7 @@ static WERROR update_printer(pipes_struct *p, POLICY_HND *handle, uint32 level,
|
|||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (info->info_2->devmode_ptr != 0) {
|
if (devmode) {
|
||||||
/* we have a valid devmode
|
/* we have a valid devmode
|
||||||
convert it and link it*/
|
convert it and link it*/
|
||||||
|
|
||||||
@ -7807,13 +7807,7 @@ static WERROR getprintprocessordirectory_level_1(UNISTR2 *name,
|
|||||||
if((info=(PRINTPROCESSOR_DIRECTORY_1 *)malloc(sizeof(PRINTPROCESSOR_DIRECTORY_1))) == NULL)
|
if((info=(PRINTPROCESSOR_DIRECTORY_1 *)malloc(sizeof(PRINTPROCESSOR_DIRECTORY_1))) == NULL)
|
||||||
return WERR_NOMEM;
|
return WERR_NOMEM;
|
||||||
|
|
||||||
/* Not sure what to return here - are UNC names valid here?.
|
pstrcpy(path, "C:\\WINNT\\System32\\spool\\PRTPROCS\\W32X86");
|
||||||
Windows returns the string: C:\WINNT\System32\spool\PRTPROCS\W32X86
|
|
||||||
which is pretty bogus for a RPC. */
|
|
||||||
|
|
||||||
slprintf(path, sizeof(path)-1, "\\\\%s\\print$\\%s", get_called_name(), short_archi);
|
|
||||||
|
|
||||||
DEBUG(4,("print processor directory: [%s]\n", path));
|
|
||||||
|
|
||||||
fill_printprocessordirectory_1(info, path);
|
fill_printprocessordirectory_1(info, path);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user