2000-11-15 00:56:32 +03:00
/*
2002-07-15 14:35:28 +04:00
Unix SMB / Netbios implementation .
Version 1.9 .
2000-03-10 20:12:24 +03:00
SMB parameters and setup
Copyright ( C ) Andrew Tridgell 1992 - 2000 ,
Copyright ( C ) Jean Francois Micouleau 1998 - 2000.
2000-11-15 00:56:32 +03:00
2000-03-10 20:12:24 +03:00
This program is free software ; you can redistribute it and / or modify
it under the terms of the GNU General Public License as published by
2007-07-09 23:25:36 +04:00
the Free Software Foundation ; either version 3 of the License , or
2000-03-10 20:12:24 +03:00
( at your option ) any later version .
2000-11-15 00:56:32 +03:00
2000-03-10 20:12:24 +03:00
This program is distributed in the hope that it will be useful ,
but WITHOUT ANY WARRANTY ; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the
GNU General Public License for more details .
2000-11-15 00:56:32 +03:00
2000-03-10 20:12:24 +03:00
You should have received a copy of the GNU General Public License
2007-07-10 04:52:41 +04:00
along with this program . If not , see < http : //www.gnu.org/licenses/>.
2000-03-10 20:12:24 +03:00
*/
2000-03-10 00:45:16 +03:00
# ifndef NT_PRINTING_H_
# define NT_PRINTING_H_
2010-05-10 18:41:10 +04:00
# include "client.h"
2011-04-30 02:09:09 +04:00
# include "../librpc/gen_ndr/spoolss.h"
2010-05-10 18:41:10 +04:00
2000-08-01 04:41:19 +04:00
# ifndef SAMBA_PRINTER_PORT_NAME
# define SAMBA_PRINTER_PORT_NAME "Samba Printer Port"
2000-11-15 00:56:32 +03:00
# endif
2000-08-01 04:41:19 +04:00
2000-10-25 21:56:38 +04:00
/* DOS header format */
# define DOS_HEADER_SIZE 64
# define DOS_HEADER_MAGIC_OFFSET 0
# define DOS_HEADER_MAGIC 0x5A4D
# define DOS_HEADER_LFANEW_OFFSET 60
/* New Executable format (Win or OS/2 1.x segmented) */
# define NE_HEADER_SIZE 64
# define NE_HEADER_SIGNATURE_OFFSET 0
# define NE_HEADER_SIGNATURE 0x454E
# define NE_HEADER_TARGET_OS_OFFSET 54
# define NE_HEADER_TARGOS_WIN 0x02
# define NE_HEADER_MINOR_VER_OFFSET 62
# define NE_HEADER_MAJOR_VER_OFFSET 63
/* Portable Executable format */
2007-03-19 20:45:13 +03:00
# define PE_HEADER_SIZE 24
2000-10-25 21:56:38 +04:00
# define PE_HEADER_SIGNATURE_OFFSET 0
# define PE_HEADER_SIGNATURE 0x00004550
# define PE_HEADER_MACHINE_OFFSET 4
# define PE_HEADER_MACHINE_I386 0x14c
2000-11-15 00:56:32 +03:00
# define PE_HEADER_NUMBER_OF_SECTIONS 6
2007-03-19 20:45:13 +03:00
# define PE_HEADER_OPTIONAL_HEADER_SIZE 20
2000-11-15 00:56:32 +03:00
# define PE_HEADER_SECT_HEADER_SIZE 40
# define PE_HEADER_SECT_NAME_OFFSET 0
# define PE_HEADER_SECT_SIZE_DATA_OFFSET 16
# define PE_HEADER_SECT_PTR_DATA_OFFSET 20
/* Microsoft file version format */
# define VS_SIGNATURE "VS_VERSION_INFO"
# define VS_MAGIC_VALUE 0xfeef04bd
# define VS_MAJOR_OFFSET 8
# define VS_MINOR_OFFSET 12
# define VS_VERSION_INFO_UNICODE_SIZE (sizeof(VS_SIGNATURE)*2+4+VS_MINOR_OFFSET+4) /* not true size! */
# define VS_VERSION_INFO_SIZE (sizeof(VS_SIGNATURE)+4+VS_MINOR_OFFSET+4) /* not true size! */
# define VS_NE_BUF_SIZE 4096 /* Must be > 2*VS_VERSION_INFO_SIZE */
2000-10-25 21:56:38 +04:00
2002-07-15 14:35:28 +04:00
/* Notify spoolss clients that something has changed. The
2015-05-01 05:22:21 +03:00
notification data is either stored in two uint32_t values or a
2002-07-15 14:35:28 +04:00
variable length array . */
# define SPOOLSS_NOTIFY_MSG_UNIX_JOBID 0x0001 /* Job id is unix */
2002-09-25 19:19:00 +04:00
typedef struct spoolss_notify_msg {
2002-07-15 14:35:28 +04:00
fstring printer ; /* Name of printer notified */
2015-05-01 05:22:21 +03:00
uint32_t type ; /* Printer or job notify */
uint32_t field ; /* Notify field changed */
uint32_t id ; /* Job id */
uint32_t len ; /* Length of data, 0 for two uint32_t value */
uint32_t flags ;
2002-07-15 14:35:28 +04:00
union {
2015-05-01 05:22:21 +03:00
uint32_t value [ 2 ] ;
2002-07-15 14:35:28 +04:00
char * data ;
} notify ;
2002-09-25 19:19:00 +04:00
} SPOOLSS_NOTIFY_MSG ;
typedef struct {
fstring printername ;
2015-05-01 05:22:21 +03:00
uint32_t num_msgs ;
2002-09-25 19:19:00 +04:00
SPOOLSS_NOTIFY_MSG * msgs ;
} SPOOLSS_NOTIFY_MSG_GROUP ;
typedef struct {
TALLOC_CTX * ctx ;
2015-05-01 05:22:21 +03:00
uint32_t num_groups ;
2002-09-25 19:19:00 +04:00
SPOOLSS_NOTIFY_MSG_GROUP * msg_groups ;
} SPOOLSS_NOTIFY_MSG_CTR ;
2002-07-15 14:35:28 +04:00
2009-03-17 14:48:46 +03:00
/*
* The printer attributes .
* I # defined all of them ( grabbed form MSDN )
* I ' m only using :
* ( SHARED | NETWORK | RAW_ONLY )
* RAW_ONLY _MUST_ be present otherwise NT will send an EMF file
*/
# define PRINTER_ATTRIBUTE_SAMBA (PRINTER_ATTRIBUTE_RAW_ONLY|\
PRINTER_ATTRIBUTE_SHARED | \
PRINTER_ATTRIBUTE_LOCAL )
# define PRINTER_ATTRIBUTE_NOT_SAMBA (PRINTER_ATTRIBUTE_NETWORK)
2009-03-17 19:17:18 +03:00
# define DRIVER_ANY_VERSION 0xffffffff
# define DRIVER_MAX_VERSION 4
2009-05-12 16:15:01 +04:00
struct print_architecture_table_node {
const char * long_archi ;
const char * short_archi ;
int version ;
} ;
2010-05-11 13:14:55 +04:00
bool nt_printing_init ( struct messaging_context * msg_ctx ) ;
2010-05-10 18:41:10 +04:00
const char * get_short_archi ( const char * long_archi ) ;
2013-09-26 15:24:15 +04:00
WERROR print_access_check ( const struct auth_session_info * server_info ,
struct messaging_context * msg_ctx , int snum ,
int access_type ) ;
2010-05-10 18:41:10 +04:00
2014-12-18 20:23:11 +03:00
WERROR nt_printer_guid_retrieve ( TALLOC_CTX * mem_ctx , const char * printer ,
struct GUID * pguid ) ;
2014-12-18 18:13:27 +03:00
WERROR nt_printer_guid_store ( struct messaging_context * msg_ctx ,
const char * printer , struct GUID guid ) ;
2013-05-29 12:43:33 +04:00
WERROR nt_printer_guid_get ( TALLOC_CTX * mem_ctx ,
const struct auth_session_info * session_info ,
struct messaging_context * msg_ctx ,
const char * printer , struct GUID * guid ) ;
2010-05-10 18:41:10 +04:00
WERROR nt_printer_publish ( TALLOC_CTX * mem_ctx ,
2011-07-18 07:06:47 +04:00
const struct auth_session_info * server_info ,
2010-08-08 16:35:50 +04:00
struct messaging_context * msg_ctx ,
2010-05-10 18:41:10 +04:00
struct spoolss_PrinterInfo2 * pinfo2 ,
int action ) ;
bool is_printer_published ( TALLOC_CTX * mem_ctx ,
2011-07-18 07:06:47 +04:00
const struct auth_session_info * server_info ,
2010-08-08 16:39:40 +04:00
struct messaging_context * msg_ctx ,
2012-02-10 16:45:24 +04:00
const char * servername ,
const char * printer ,
2010-05-10 18:41:10 +04:00
struct spoolss_PrinterInfo2 * * info2 ) ;
2010-08-08 16:37:47 +04:00
WERROR check_published_printers ( struct messaging_context * msg_ctx ) ;
2010-05-11 13:14:55 +04:00
2011-07-28 19:12:24 +04:00
struct dcerpc_binding_handle ;
2010-05-10 18:41:10 +04:00
bool printer_driver_in_use ( TALLOC_CTX * mem_ctx ,
2011-07-28 13:34:08 +04:00
struct dcerpc_binding_handle * b ,
2010-05-10 18:41:10 +04:00
const struct spoolss_DriverInfo8 * r ) ;
bool printer_driver_files_in_use ( TALLOC_CTX * mem_ctx ,
2011-07-28 13:36:50 +04:00
struct dcerpc_binding_handle * b ,
2010-05-10 18:41:10 +04:00
struct spoolss_DriverInfo8 * r ) ;
2011-07-18 07:06:47 +04:00
bool delete_driver_files ( const struct auth_session_info * server_info ,
2010-05-10 18:41:10 +04:00
const struct spoolss_DriverInfo8 * r ) ;
2011-07-18 07:06:47 +04:00
WERROR move_driver_to_download_area ( struct auth_session_info * session_info ,
2016-11-15 16:29:29 +03:00
struct spoolss_AddDriverInfoCtr * r ,
const char * driver_directory ) ;
2010-05-10 18:41:10 +04:00
WERROR clean_up_driver_struct ( TALLOC_CTX * mem_ctx ,
2011-07-18 07:06:47 +04:00
struct auth_session_info * session_info ,
2016-11-15 16:29:29 +03:00
struct spoolss_AddDriverInfoCtr * r ,
uint32_t flags ,
const char * * driver_directory ) ;
2010-05-10 18:41:10 +04:00
2010-05-11 13:14:55 +04:00
void map_printer_permissions ( struct security_descriptor * sd ) ;
void map_job_permissions ( struct security_descriptor * sd ) ;
2011-07-18 07:06:47 +04:00
bool print_time_access_check ( const struct auth_session_info * server_info ,
2010-08-08 16:29:39 +04:00
struct messaging_context * msg_ctx ,
2010-05-11 13:14:55 +04:00
const char * servicename ) ;
void nt_printer_remove ( TALLOC_CTX * mem_ctx ,
2011-07-18 07:06:47 +04:00
const struct auth_session_info * server_info ,
2010-08-08 16:31:14 +04:00
struct messaging_context * msg_ctx ,
2010-05-11 13:14:55 +04:00
const char * printer ) ;
2012-02-07 14:41:54 +04:00
void nt_printer_add ( TALLOC_CTX * mem_ctx ,
const struct auth_session_info * server_info ,
struct messaging_context * msg_ctx ,
const char * printer ) ;
2010-05-11 13:14:55 +04:00
2000-03-10 00:45:16 +03:00
# endif /* NT_PRINTING_H_ */