[SCM] Samba Shared Repository - branch v3-6-test updated
Karolin Seeger
kseeger at samba.org
Tue Jul 12 13:01:27 MDT 2011
The branch, v3-6-test has been updated
via 9a555e0 s3-waf: split out LIBCLI_WINREG_INTERNAL as LIBCLI_WINREG was pulling in rpc server code in undesired places.
via 1822df1 s3-printing: remove tdb migration invalid printer name checks
via ec0c13d s3-printing: fill info2_mask in printer migration
via d967d1b s3-printing: make sure to first migrate the printers then the security descriptor.
via 4fc35a5 s3-printing: remove spoolss pipe from migration library, only using winreg finally.
via 8ca35cd s3-printing: use winreg interface for migration, instead of spoolss.
via 5bab224 s3-printing: safe a ton of roundtrips by reusing existing winreg binding_handles.
via 7c0ab14 s3-printing: use winreg_internal functions.
via 77ccfc6 s3-printing: add winreg_internal functions.
via 6bc8403 s3-printing: add winreg_printer_binding_handle and remove most of srv_spoolss_util.c.
via 3c29f9b s3-printing: add rpc_client/cli_winreg_spoolss.c
via d53dbd8 s3-waf: make LIBCLI_SPOOLSS a shared library
via dd21eaa s3-printing: move spoolss_create_default_devmode/secdesc to init_spoolss.h
via 2e86c3f s3-printing: move driver_info_ctr_to_info8 to init_spoolss.h
via b039a96 s3-printing: move os2 related functions to printing/nt_printing_os2.c.
via b1aca06 s3-printing: open up a winreg pipe handle for the migration code.
via 35de817 s3-net: use printing_migrate library, and eliminate duplicate code.
via cb1368f s3-printing: split out printing migration code into a smaller library.
via d24c4ef s3-printing: skip migration of non-existent printers
via 8245aca s3-printing: fill devicemode size in migrate_printer()
via f1196b1 s3-waf: stop building smbtortre4.
from 75785cc WHATSNEW: Add changes since rc2.
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-6-test
- Log -----------------------------------------------------------------
commit 9a555e0271c333d1e33a9f2df435166aa8c6dfde
Author: Günther Deschner <gd at samba.org>
Date: Fri Jul 8 17:17:17 2011 +0200
s3-waf: split out LIBCLI_WINREG_INTERNAL as LIBCLI_WINREG was pulling in rpc server code in undesired places.
Andreas, please check.
Guenther
Autobuild-User: Günther Deschner <gd at samba.org>
Autobuild-Date: Fri Jul 8 18:34:44 CEST 2011 on sn-devel-104
(cherry picked from commit f4add4fbf545313f5d24e0d9e5c9eb0f8fac630a)
Conflicts:
source3/rpc_server/wscript_build
source3/wscript_build
The last 21 patches address bug #8214 (printer driver upgrade fails, causing
smbd to exit on startup).
commit 1822df19e764bce37a4b2c7e212a2bb0c61d1d13
Author: David Disseldorp <ddiss at suse.de>
Date: Tue Jul 5 15:04:02 2011 +0200
s3-printing: remove tdb migration invalid printer name checks
WERR_INVALID_PRINTER_NAME only needed to be handled when printing tdb
migration used spoolss, with winreg such errors are no longer possible.
Signed-off-by: Günther Deschner <gd at samba.org>
Autobuild-User: Günther Deschner <gd at samba.org>
Autobuild-Date: Thu Jul 7 19:15:34 CEST 2011 on sn-devel-104
(cherry picked from commit e5955903fdc5ed6f8660b72db0716d4da25c711c)
commit ec0c13d05962e0e3d92dee811667e2dc6bfa67fc
Author: David Disseldorp <ddiss at suse.de>
Date: Tue Jul 5 11:34:47 2011 +0200
s3-printing: fill info2_mask in printer migration
Also fix possibly uninitialised status return from
printing_tdb_migrate_printer().
(cherry picked from commit 5dd8185d852afc3843253c9471326677f8816a77)
commit d967d1b9ac902cd750cc9c43ecce9481c444504b
Author: Günther Deschner <gd at samba.org>
Date: Tue Jul 5 14:01:40 2011 +0200
s3-printing: make sure to first migrate the printers then the security descriptor.
Guenther
Pair-Programmed-With: David Disseldorp <ddiss at suse.de>
(cherry picked from commit cfc3b6e5f79f253e83dfbd13d47b671deb5801b3)
commit 4fc35a5cc9db162a6df7b09e70686caaaa6c352c
Author: Günther Deschner <gd at samba.org>
Date: Tue Jul 5 02:33:23 2011 +0200
s3-printing: remove spoolss pipe from migration library, only using winreg finally.
Guenther
Pair-Programmed-With: David Disseldorp <ddiss at suse.de>
(cherry picked from commit 57bbb32c64db1027e2b9ae1aef7f5f3b33ae3882)
commit 8ca35cd86041d197f3bf377cc0afabe5e2cd4ceb
Author: Günther Deschner <gd at samba.org>
Date: Mon Jul 4 19:47:07 2011 +0200
s3-printing: use winreg interface for migration, instead of spoolss.
Guenther
Pair-Programmed-With: David Disseldorp <ddiss at suse.de>
(cherry picked from commit 8f3d5f5333a61922c4ea7ff1e1d244978958e857)
Conflicts:
source3/printing/nt_printing_migrate.c
commit 5bab2244e5893ae6f470299b4efcabd54dc23fcc
Author: Günther Deschner <gd at samba.org>
Date: Tue Jul 5 00:55:35 2011 +0200
s3-printing: safe a ton of roundtrips by reusing existing winreg binding_handles.
Guenther
Pair-Programmed-With: David Disseldorp <ddiss at suse.de>
(cherry picked from commit 72b1f8be5619ed778c4aa0b967f6a4f34d7e9de8)
Conflicts:
source3/rpc_server/spoolss/srv_spoolss_nt.c
commit 7c0ab14cc21c47193e7198a01e5ae16052c8d0f9
Author: Günther Deschner <gd at samba.org>
Date: Tue Jul 5 00:16:03 2011 +0200
s3-printing: use winreg_internal functions.
Guenther
Pair-Programmed-With: David Disseldorp <ddiss at suse.de>
(cherry picked from commit 0a1ec73b965f66977a90fb7febb3b56b52ebab20)
Conflicts:
source3/rpc_server/spoolss/srv_spoolss_nt.c
commit 77ccfc6f41ca615911d49039046502fcf8e23cee
Author: Günther Deschner <gd at samba.org>
Date: Tue Jul 5 00:16:47 2011 +0200
s3-printing: add winreg_internal functions.
Guenther
Pair-Programmed-With: David Disseldorp <ddiss at suse.de>
(cherry picked from commit ada5380d2090179fc57eee66e2b46788f4944db0)
Conflicts:
source3/rpc_server/spoolss/srv_spoolss_nt.c
source3/rpc_server/spoolss/srv_spoolss_util.c
commit 6bc840366b9c421f742467ef337c8703a8d365ea
Author: Günther Deschner <gd at samba.org>
Date: Mon Jul 4 20:09:54 2011 +0200
s3-printing: add winreg_printer_binding_handle and remove most of srv_spoolss_util.c.
Guenther
Pair-Programmed-With: David Disseldorp <ddiss at suse.de>
(cherry picked from commit a762eda519c995214c041170e2615c5c51b2a2b1)
Conflicts:
source3/rpc_server/spoolss/srv_spoolss_util.c
commit 3c29f9b015809840aaf4de75186536f6f5e91bd9
Author: Günther Deschner <gd at samba.org>
Date: Mon Jul 4 19:47:29 2011 +0200
s3-printing: add rpc_client/cli_winreg_spoolss.c
Guenther
Pair-Programmed-With: David Disseldorp <ddiss at suse.de>
(cherry picked from commit f2be8378b92669092f8444df038f769fc9312ff4)
commit d53dbd8e66b45195c4879a4bb1b9a659b4bf4f99
Author: Günther Deschner <gd at samba.org>
Date: Tue Jul 5 11:29:37 2011 +0200
s3-waf: make LIBCLI_SPOOLSS a shared library
Guenther
Pair-Programmed-With: David Disseldorp <ddiss at suse.de>
(cherry picked from commit a0fc64a88ee6f1f45d4c2b95d6773eccab50ebb4)
commit dd21eaa11c919935f959941aefbba454a272119b
Author: Günther Deschner <gd at samba.org>
Date: Tue Jul 5 02:15:35 2011 +0200
s3-printing: move spoolss_create_default_devmode/secdesc to init_spoolss.h
Guenther
Pair-Programmed-With: David Disseldorp <ddiss at suse.de>
(cherry picked from commit 43cf3a28dc539351da8a316e0e52a8292ec40cc7)
commit 2e86c3ffac47bdb43ddc0012d96bd4d489658774
Author: Günther Deschner <gd at samba.org>
Date: Tue Jul 5 02:12:24 2011 +0200
s3-printing: move driver_info_ctr_to_info8 to init_spoolss.h
Guenther
Pair-Programmed-With: David Disseldorp <ddiss at suse.de>
(cherry picked from commit 74e416031b2fc5d9c6af30f692d5b73cb1942cf4)
commit b039a965488aba0e8d31abe0a389e6ddef99d8b9
Author: Günther Deschner <gd at samba.org>
Date: Tue Jul 5 01:24:48 2011 +0200
s3-printing: move os2 related functions to printing/nt_printing_os2.c.
Guenther
Pair-Programmed-With: David Disseldorp <ddiss at suse.de>
(cherry picked from commit dd5375b4a1798c856fa9c104baa36c137d664b9d)
Conflicts:
source3/rpc_server/spoolss/srv_spoolss_util.c
commit b1aca06b1823601a5942ead53ed66ca95bd3b8c4
Author: Günther Deschner <gd at samba.org>
Date: Fri Jul 1 15:39:11 2011 +0200
s3-printing: open up a winreg pipe handle for the migration code.
Guenther
Autobuild-User: Günther Deschner <gd at samba.org>
Autobuild-Date: Mon Jul 4 15:06:41 CEST 2011 on sn-devel-104
(cherry picked from commit ff94539f276bdef73bd12c67bff1f34e697ccbfc)
commit 35de817734fec9dcb0197c20b9c308df2ac7dccc
Author: Günther Deschner <gd at samba.org>
Date: Fri Jul 1 15:02:26 2011 +0200
s3-net: use printing_migrate library, and eliminate duplicate code.
Guenther
Autobuild-User: Günther Deschner <gd at samba.org>
Autobuild-Date: Fri Jul 1 17:57:09 CEST 2011 on sn-devel-104
(cherry picked from commit bafd7212eb4c82e86874b2f80ddf5c04b2d180b9)
Conflicts:
source3/utils/net_printing.c
commit cb1368f19148b30c515f0632fdeb32ef127fa0c7
Author: Günther Deschner <gd at samba.org>
Date: Fri Jul 1 14:57:32 2011 +0200
s3-printing: split out printing migration code into a smaller library.
Guenther
(cherry picked from commit e02abd6c83708f297b1985bb1bdc7d5dfbc924b2)
Conflicts:
source3/printing/nt_printing_migrate.c
source3/wscript_build
commit d24c4ef87ff02975cdb024e01b067107c60050cc
Author: David Disseldorp <ddiss at suse.de>
Date: Wed Jun 15 14:59:49 2011 +0200
s3-printing: skip migration of non-existent printers
Skip tdb migration of printer and security descriptor entries which
refer to non-existent printers.
Signed-off-by: Günther Deschner <gd at samba.org>
Autobuild-User: Günther Deschner <gd at samba.org>
Autobuild-Date: Thu Jun 30 10:54:23 CEST 2011 on sn-devel-104
(cherry picked from commit c9e3f6ab02bdc354a9b656f62744ee66fe9e9e67)
commit 8245acab26a83a006d04626f15d5a47dcb71053e
Author: David Disseldorp <ddiss at suse.de>
Date: Wed Jun 15 12:46:55 2011 +0200
s3-printing: fill devicemode size in migrate_printer()
Signed-off-by: Günther Deschner <gd at samba.org>
(cherry picked from commit a36ce0735ff6cad8124bd63a056a71d9495b238c)
commit f1196b1edc30549d36cc1d8a66541d79a65f31ce
Author: Günther Deschner <gd at samba.org>
Date: Thu May 12 14:33:15 2011 +0200
s3-waf: stop building smbtortre4.
Guenther
Autobuild-User: Günther Deschner <gd at samba.org>
Autobuild-Date: Thu May 12 15:35:02 CEST 2011 on sn-devel-104
(cherry picked from commit c1ac023b588e1ca676cbbf542ca6f93aa199ad32)
-----------------------------------------------------------------------
Summary of changes:
source3/Makefile.in | 7 +-
source3/include/nt_printing.h | 12 -
source3/printing/nt_printing.c | 443 +--
source3/printing/nt_printing_ads.c | 20 +-
source3/printing/nt_printing_migrate.c | 482 +--
source3/printing/nt_printing_migrate.h | 21 +-
source3/printing/nt_printing_migrate_internal.c | 255 ++
...ng_migrate.h => nt_printing_migrate_internal.h} | 6 +-
source3/printing/nt_printing_os2.c | 165 +
.../{nt_printing_migrate.h => nt_printing_os2.h} | 12 +-
source3/printing/spoolssd.c | 2 +-
.../cli_winreg_spoolss.c} | 284 +-
.../cli_winreg_spoolss.h} | 118 +-
source3/rpc_client/init_spoolss.c | 264 ++
source3/rpc_client/init_spoolss.h | 9 +
source3/rpc_server/rpc_ep_setup.c | 2 +-
source3/rpc_server/spoolss/srv_spoolss_nt.c | 382 +-
source3/rpc_server/spoolss/srv_spoolss_util.c | 4369 ++------------------
source3/rpc_server/spoolss/srv_spoolss_util.h | 687 +---
source3/rpc_server/wscript_build | 6 +-
source3/utils/net_printing.c | 446 +--
source3/wscript_build | 34 +-
22 files changed, 1626 insertions(+), 6400 deletions(-)
create mode 100644 source3/printing/nt_printing_migrate_internal.c
copy source3/printing/{nt_printing_migrate.h => nt_printing_migrate_internal.h} (87%)
create mode 100644 source3/printing/nt_printing_os2.c
copy source3/printing/{nt_printing_migrate.h => nt_printing_os2.h} (74%)
copy source3/{rpc_server/spoolss/srv_spoolss_util.c => rpc_client/cli_winreg_spoolss.c} (93%)
copy source3/{rpc_server/spoolss/srv_spoolss_util.h => rpc_client/cli_winreg_spoolss.h} (81%)
Changeset truncated at 500 lines:
diff --git a/source3/Makefile.in b/source3/Makefile.in
index 485de6a..c2b4a3a 100644
--- a/source3/Makefile.in
+++ b/source3/Makefile.in
@@ -346,7 +346,9 @@ LIBNDR_XATTR_OBJ = librpc/gen_ndr/ndr_xattr.o \
LIBCLI_SPOOLSS_OBJ = librpc/gen_ndr/ndr_spoolss_c.o \
rpc_client/cli_spoolss.o \
- rpc_client/init_spoolss.o
+ rpc_client/init_spoolss.o \
+ rpc_client/cli_winreg_spoolss.o \
+ printing/nt_printing_os2.o
LIBCLI_EVENTLOG_OBJ = librpc/gen_ndr/ndr_eventlog_c.o
@@ -948,6 +950,7 @@ PRINTBACKEND_OBJ = printing/printing.o \
printing/nt_printing.o \
printing/nt_printing_tdb.o \
printing/nt_printing_migrate.o \
+ printing/nt_printing_migrate_internal.o \
printing/nt_printing_ads.o \
librpc/gen_ndr/ndr_ntprinting.o \
../librpc/ndr/ndr_ntprinting.o \
@@ -1185,7 +1188,7 @@ NET_OBJ1 = utils/net.o utils/net_ads.o utils/net_help.o \
rpc_client/init_samr.o \
registry/reg_parse.o registry/reg_format.o \
registry/reg_parse_internal.o registry/reg_import.o \
- lib/cbuf.o lib/srprs.o
+ lib/cbuf.o lib/srprs.o printing/nt_printing_migrate.o
# these are not processed by make proto
NET_OBJ2 = utils/net_registry_util.o utils/net_help_common.o
diff --git a/source3/include/nt_printing.h b/source3/include/nt_printing.h
index ad6262e..4f85159 100644
--- a/source3/include/nt_printing.h
+++ b/source3/include/nt_printing.h
@@ -126,15 +126,6 @@ struct print_architecture_table_node {
bool nt_printing_init(struct messaging_context *msg_ctx);
-WERROR spoolss_create_default_devmode(TALLOC_CTX *mem_ctx,
- const char *devicename,
- struct spoolss_DeviceMode **devmode);
-
-WERROR spoolss_create_default_secdesc(TALLOC_CTX *mem_ctx,
- struct spoolss_security_descriptor **secdesc);
-
-WERROR spoolss_map_to_os2_driver(TALLOC_CTX *mem_ctx, const char **pdrivername);
-
const char *get_short_archi(const char *long_archi);
bool print_access_check(const struct auth_serversupplied_info *server_info,
@@ -155,9 +146,6 @@ bool is_printer_published(TALLOC_CTX *mem_ctx,
WERROR check_published_printers(struct messaging_context *msg_ctx);
-bool driver_info_ctr_to_info8(struct spoolss_AddDriverInfoCtr *r,
- struct spoolss_DriverInfo8 *_info8);
-
bool printer_driver_in_use(TALLOC_CTX *mem_ctx,
const struct auth_serversupplied_info *server_info,
struct messaging_context *msg_ctx,
diff --git a/source3/printing/nt_printing.c b/source3/printing/nt_printing.c
index 6d4bebb..d6b8bb1 100644
--- a/source3/printing/nt_printing.c
+++ b/source3/printing/nt_printing.c
@@ -32,6 +32,7 @@
#include "auth.h"
#include "messages.h"
#include "rpc_server/spoolss/srv_spoolss_nt.h"
+#include "rpc_client/cli_winreg_spoolss.h"
/* Map generic permissions to printer object specific permissions */
@@ -1168,410 +1169,6 @@ WERROR move_driver_to_download_area(struct auth_serversupplied_info *session_inf
}
/****************************************************************************
- Create and allocate a default devicemode.
-****************************************************************************/
-
-WERROR spoolss_create_default_devmode(TALLOC_CTX *mem_ctx,
- const char *devicename,
- struct spoolss_DeviceMode **devmode)
-{
- struct spoolss_DeviceMode *dm;
- char *dname;
-
- dm = talloc_zero(mem_ctx, struct spoolss_DeviceMode);
- if (dm == NULL) {
- return WERR_NOMEM;
- }
-
- dname = talloc_asprintf(dm, "%s", devicename);
- if (dname == NULL) {
- return WERR_NOMEM;
- }
- if (strlen(dname) > MAXDEVICENAME) {
- dname[MAXDEVICENAME] = '\0';
- }
- dm->devicename = dname;
-
- dm->formname = talloc_strdup(dm, "Letter");
- if (dm->formname == NULL) {
- return WERR_NOMEM;
- }
-
- dm->specversion = DMSPEC_NT4_AND_ABOVE;
- dm->driverversion = 0x0400;
- dm->size = 0x00DC;
- dm->__driverextra_length = 0;
- dm->fields = DEVMODE_FORMNAME |
- DEVMODE_TTOPTION |
- DEVMODE_PRINTQUALITY |
- DEVMODE_DEFAULTSOURCE |
- DEVMODE_COPIES |
- DEVMODE_SCALE |
- DEVMODE_PAPERSIZE |
- DEVMODE_ORIENTATION;
- dm->orientation = DMORIENT_PORTRAIT;
- dm->papersize = DMPAPER_LETTER;
- dm->paperlength = 0;
- dm->paperwidth = 0;
- dm->scale = 0x64;
- dm->copies = 1;
- dm->defaultsource = DMBIN_FORMSOURCE;
- dm->printquality = DMRES_HIGH; /* 0x0258 */
- dm->color = DMRES_MONOCHROME;
- dm->duplex = DMDUP_SIMPLEX;
- dm->yresolution = 0;
- dm->ttoption = DMTT_SUBDEV;
- dm->collate = DMCOLLATE_FALSE;
- dm->icmmethod = 0;
- dm->icmintent = 0;
- dm->mediatype = 0;
- dm->dithertype = 0;
-
- dm->logpixels = 0;
- dm->bitsperpel = 0;
- dm->pelswidth = 0;
- dm->pelsheight = 0;
- dm->displayflags = 0;
- dm->displayfrequency = 0;
- dm->reserved1 = 0;
- dm->reserved2 = 0;
- dm->panningwidth = 0;
- dm->panningheight = 0;
-
- dm->driverextra_data.data = NULL;
- dm->driverextra_data.length = 0;
-
- *devmode = dm;
- return WERR_OK;
-}
-
-WERROR spoolss_create_default_secdesc(TALLOC_CTX *mem_ctx,
- struct spoolss_security_descriptor **secdesc)
-{
- struct security_ace ace[7]; /* max number of ace entries */
- int i = 0;
- uint32_t sa;
- struct security_acl *psa = NULL;
- struct security_descriptor *psd = NULL;
- struct dom_sid adm_sid;
- size_t sd_size;
-
- /* Create an ACE where Everyone is allowed to print */
-
- sa = PRINTER_ACE_PRINT;
- init_sec_ace(&ace[i++], &global_sid_World, SEC_ACE_TYPE_ACCESS_ALLOWED,
- sa, SEC_ACE_FLAG_CONTAINER_INHERIT);
-
- /* Add the domain admins group if we are a DC */
-
- if ( IS_DC ) {
- struct dom_sid domadmins_sid;
-
- sid_compose(&domadmins_sid, get_global_sam_sid(),
- DOMAIN_RID_ADMINS);
-
- sa = PRINTER_ACE_FULL_CONTROL;
- init_sec_ace(&ace[i++], &domadmins_sid,
- SEC_ACE_TYPE_ACCESS_ALLOWED, sa,
- SEC_ACE_FLAG_OBJECT_INHERIT | SEC_ACE_FLAG_INHERIT_ONLY);
- init_sec_ace(&ace[i++], &domadmins_sid, SEC_ACE_TYPE_ACCESS_ALLOWED,
- sa, SEC_ACE_FLAG_CONTAINER_INHERIT);
- }
- else if (secrets_fetch_domain_sid(lp_workgroup(), &adm_sid)) {
- sid_append_rid(&adm_sid, DOMAIN_RID_ADMINISTRATOR);
-
- sa = PRINTER_ACE_FULL_CONTROL;
- init_sec_ace(&ace[i++], &adm_sid,
- SEC_ACE_TYPE_ACCESS_ALLOWED, sa,
- SEC_ACE_FLAG_OBJECT_INHERIT | SEC_ACE_FLAG_INHERIT_ONLY);
- init_sec_ace(&ace[i++], &adm_sid, SEC_ACE_TYPE_ACCESS_ALLOWED,
- sa, SEC_ACE_FLAG_CONTAINER_INHERIT);
- }
-
- /* add BUILTIN\Administrators as FULL CONTROL */
-
- sa = PRINTER_ACE_FULL_CONTROL;
- init_sec_ace(&ace[i++], &global_sid_Builtin_Administrators,
- SEC_ACE_TYPE_ACCESS_ALLOWED, sa,
- SEC_ACE_FLAG_OBJECT_INHERIT | SEC_ACE_FLAG_INHERIT_ONLY);
- init_sec_ace(&ace[i++], &global_sid_Builtin_Administrators,
- SEC_ACE_TYPE_ACCESS_ALLOWED,
- sa, SEC_ACE_FLAG_CONTAINER_INHERIT);
-
- /* add BUILTIN\Print Operators as FULL CONTROL */
-
- sa = PRINTER_ACE_FULL_CONTROL;
- init_sec_ace(&ace[i++], &global_sid_Builtin_Print_Operators,
- SEC_ACE_TYPE_ACCESS_ALLOWED, sa,
- SEC_ACE_FLAG_OBJECT_INHERIT | SEC_ACE_FLAG_INHERIT_ONLY);
- init_sec_ace(&ace[i++], &global_sid_Builtin_Print_Operators,
- SEC_ACE_TYPE_ACCESS_ALLOWED,
- sa, SEC_ACE_FLAG_CONTAINER_INHERIT);
-
- /* Make the security descriptor owned by the BUILTIN\Administrators */
-
- /* The ACL revision number in rpc_secdesc.h differs from the one
- created by NT when setting ACE entries in printer
- descriptors. NT4 complains about the property being edited by a
- NT5 machine. */
-
- if ((psa = make_sec_acl(mem_ctx, NT4_ACL_REVISION, i, ace)) != NULL) {
- psd = make_sec_desc(mem_ctx,
- SD_REVISION,
- SEC_DESC_SELF_RELATIVE,
- &global_sid_Builtin_Administrators,
- &global_sid_Builtin_Administrators,
- NULL,
- psa,
- &sd_size);
- }
-
- if (psd == NULL) {
- DEBUG(0,("construct_default_printer_sd: Failed to make SEC_DESC.\n"));
- return WERR_NOMEM;
- }
-
- DEBUG(4,("construct_default_printer_sdb: size = %u.\n",
- (unsigned int)sd_size));
-
- *secdesc = psd;
-
- return WERR_OK;
-}
-
-/****************************************************************************
- ***************************************************************************/
-
-static char *win_driver;
-static char *os2_driver;
-
-static const char *get_win_driver(void)
-{
- if (win_driver == NULL) {
- return "";
- }
- return win_driver;
-}
-
-static const char *get_os2_driver(void)
-{
- if (os2_driver == NULL) {
- return "";
- }
- return os2_driver;
-}
-
-static bool set_driver_mapping(const char *from, const char *to)
-{
- SAFE_FREE(win_driver);
- SAFE_FREE(os2_driver);
-
- win_driver = SMB_STRDUP(from);
- os2_driver = SMB_STRDUP(to);
-
- if (win_driver == NULL || os2_driver == NULL) {
- SAFE_FREE(win_driver);
- SAFE_FREE(os2_driver);
- return false;
- }
- return true;
-}
-
-/**
- * @internal
- *
- * @brief Map a Windows driver to a OS/2 driver.
- *
- * @param[in] mem_ctx The memory context to use.
- *
- * @param[in,out] pdrivername The drivername of Windows to remap.
- *
- * @return WERR_OK on success, a corresponding WERROR on failure.
- */
-WERROR spoolss_map_to_os2_driver(TALLOC_CTX *mem_ctx, const char **pdrivername)
-{
- const char *mapfile = lp_os2_driver_map();
- char **lines = NULL;
- const char *drivername;
- int numlines = 0;
- int i;
-
- if (pdrivername == NULL || *pdrivername == NULL || *pdrivername[0] == '\0') {
- return WERR_INVALID_PARAMETER;
- }
-
- drivername = *pdrivername;
-
- if (mapfile[0] == '\0') {
- return WERR_BADFILE;
- }
-
- if (strequal(drivername, get_win_driver())) {
- DEBUG(3,("Mapped Windows driver %s to OS/2 driver %s\n",
- drivername, get_os2_driver()));
- drivername = talloc_strdup(mem_ctx, get_os2_driver());
- if (drivername == NULL) {
- return WERR_NOMEM;
- }
- *pdrivername = drivername;
- return WERR_OK;
- }
-
- lines = file_lines_load(mapfile, &numlines, 0, NULL);
- if (numlines == 0 || lines == NULL) {
- DEBUG(0,("No entries in OS/2 driver map %s\n", mapfile));
- TALLOC_FREE(lines);
- return WERR_EMPTY;
- }
-
- DEBUG(4,("Scanning OS/2 driver map %s\n",mapfile));
-
- for( i = 0; i < numlines; i++) {
- char *nt_name = lines[i];
- char *os2_name = strchr(nt_name, '=');
-
- if (os2_name == NULL) {
- continue;
- }
-
- *os2_name++ = '\0';
-
- while (isspace(*nt_name)) {
- nt_name++;
- }
-
- if (*nt_name == '\0' || strchr("#;", *nt_name)) {
- continue;
- }
-
- {
- int l = strlen(nt_name);
- while (l && isspace(nt_name[l - 1])) {
- nt_name[l - 1] = 0;
- l--;
- }
- }
-
- while (isspace(*os2_name)) {
- os2_name++;
- }
-
- {
- int l = strlen(os2_name);
- while (l && isspace(os2_name[l-1])) {
- os2_name[l-1] = 0;
- l--;
- }
- }
-
- if (strequal(nt_name, drivername)) {
- DEBUG(3,("Mapped Windows driver %s to OS/2 driver %s\n",drivername,os2_name));
- set_driver_mapping(drivername, os2_name);
- drivername = talloc_strdup(mem_ctx, os2_name);
- TALLOC_FREE(lines);
- if (drivername == NULL) {
- return WERR_NOMEM;
- }
- *pdrivername = drivername;
- return WERR_OK;
- }
- }
-
- TALLOC_FREE(lines);
- return WERR_OK;
-}
-
-/****************************************************************************
-****************************************************************************/
-
-bool driver_info_ctr_to_info8(struct spoolss_AddDriverInfoCtr *r,
- struct spoolss_DriverInfo8 *_info8)
-{
- struct spoolss_DriverInfo8 info8;
-
- ZERO_STRUCT(info8);
-
- switch (r->level) {
- case 3:
- info8.version = r->info.info3->version;
- info8.driver_name = r->info.info3->driver_name;
- info8.architecture = r->info.info3->architecture;
- info8.driver_path = r->info.info3->driver_path;
- info8.data_file = r->info.info3->data_file;
- info8.config_file = r->info.info3->config_file;
- info8.help_file = r->info.info3->help_file;
- info8.monitor_name = r->info.info3->monitor_name;
- info8.default_datatype = r->info.info3->default_datatype;
- if (r->info.info3->dependent_files && r->info.info3->dependent_files->string) {
- info8.dependent_files = r->info.info3->dependent_files->string;
- }
- break;
- case 6:
- info8.version = r->info.info6->version;
- info8.driver_name = r->info.info6->driver_name;
- info8.architecture = r->info.info6->architecture;
- info8.driver_path = r->info.info6->driver_path;
- info8.data_file = r->info.info6->data_file;
- info8.config_file = r->info.info6->config_file;
- info8.help_file = r->info.info6->help_file;
- info8.monitor_name = r->info.info6->monitor_name;
- info8.default_datatype = r->info.info6->default_datatype;
- if (r->info.info6->dependent_files && r->info.info6->dependent_files->string) {
- info8.dependent_files = r->info.info6->dependent_files->string;
- }
- info8.driver_date = r->info.info6->driver_date;
- info8.driver_version = r->info.info6->driver_version;
- info8.manufacturer_name = r->info.info6->manufacturer_name;
- info8.manufacturer_url = r->info.info6->manufacturer_url;
- info8.hardware_id = r->info.info6->hardware_id;
- info8.provider = r->info.info6->provider;
- break;
- case 8:
- info8.version = r->info.info8->version;
- info8.driver_name = r->info.info8->driver_name;
- info8.architecture = r->info.info8->architecture;
- info8.driver_path = r->info.info8->driver_path;
- info8.data_file = r->info.info8->data_file;
- info8.config_file = r->info.info8->config_file;
- info8.help_file = r->info.info8->help_file;
- info8.monitor_name = r->info.info8->monitor_name;
- info8.default_datatype = r->info.info8->default_datatype;
- if (r->info.info8->dependent_files && r->info.info8->dependent_files->string) {
- info8.dependent_files = r->info.info8->dependent_files->string;
- }
- if (r->info.info8->previous_names && r->info.info8->previous_names->string) {
- info8.previous_names = r->info.info8->previous_names->string;
- }
- info8.driver_date = r->info.info8->driver_date;
- info8.driver_version = r->info.info8->driver_version;
- info8.manufacturer_name = r->info.info8->manufacturer_name;
- info8.manufacturer_url = r->info.info8->manufacturer_url;
- info8.hardware_id = r->info.info8->hardware_id;
- info8.provider = r->info.info8->provider;
- info8.print_processor = r->info.info8->print_processor;
- info8.vendor_setup = r->info.info8->vendor_setup;
- if (r->info.info8->color_profiles && r->info.info8->color_profiles->string) {
- info8.color_profiles = r->info.info8->color_profiles->string;
- }
- info8.inf_path = r->info.info8->inf_path;
- info8.printer_driver_attributes = r->info.info8->printer_driver_attributes;
- if (r->info.info8->core_driver_dependencies && r->info.info8->core_driver_dependencies->string) {
- info8.core_driver_dependencies = r->info.info8->core_driver_dependencies->string;
- }
- info8.min_inbox_driver_ver_date = r->info.info8->min_inbox_driver_ver_date;
- info8.min_inbox_driver_ver_version = r->info.info8->min_inbox_driver_ver_version;
- break;
- default:
- return false;
- }
-
- *_info8 = info8;
-
- return true;
-}
-
-
-/****************************************************************************
Determine whether or not a particular driver is currently assigned
to a printer
****************************************************************************/
@@ -1586,6 +1183,7 @@ bool printer_driver_in_use(TALLOC_CTX *mem_ctx,
bool in_use = False;
struct spoolss_PrinterInfo2 *pinfo2 = NULL;
WERROR result;
+ struct dcerpc_binding_handle *b = NULL;
if (!r) {
return false;
@@ -1600,7 +1198,17 @@ bool printer_driver_in_use(TALLOC_CTX *mem_ctx,
continue;
}
- result = winreg_get_printer(mem_ctx, session_info, msg_ctx,
+ if (b == NULL) {
+ result = winreg_printer_binding_handle(mem_ctx,
--
Samba Shared Repository
More information about the samba-cvs
mailing list