summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoridd-guest <idd-guest@alioth.debian.org>2013-05-02 20:07:24 +0000
committeridd-guest <idd-guest@alioth.debian.org>2013-05-02 20:07:24 +0000
commit14ebdf4332b12add5c19807a14b377671356e780 (patch)
tree90508eae2439c246d64a39b237b96e6cf085ba69
parentd2173700eee452b659ffae93bfe7696a13f8e930 (diff)
downloadsamba-14ebdf4332b12add5c19807a14b377671356e780.tar.gz
Load samba-3.6.14 into branches/samba/upstream.upstream/3.6.14
git-svn-id: svn://svn.debian.org/svn/pkg-samba/branches/samba/upstream@4222 fc4039ab-9d04-0410-8cac-899223bdd6b0
-rw-r--r--WHATSNEW.txt105
-rw-r--r--librpc/idl/ntprinting.idl69
-rw-r--r--librpc/ndr/ndr_ntprinting.c15
-rw-r--r--librpc/ndr/ndr_ntprinting.h2
-rw-r--r--nsswitch/pam_winbind.c2
-rw-r--r--nsswitch/wbinfo.c7
-rw-r--r--packaging/RHEL-CTDB/samba.spec2
-rw-r--r--packaging/RHEL/makerpms.sh2
-rw-r--r--packaging/RHEL/samba.spec3
-rw-r--r--packaging/RHEL/samba.spec.tmpl1
-rw-r--r--pidl/lib/Parse/Pidl/NDR.pm1
-rw-r--r--pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm12
-rw-r--r--source3/VERSION2
-rw-r--r--source3/auth/user_util.c12
-rw-r--r--source3/include/version.h4
-rw-r--r--source3/lib/secdesc.c3
-rw-r--r--source3/libads/ldap.c6
-rw-r--r--source3/librpc/gen_ndr/ndr_ntprinting.c104
-rw-r--r--source3/librpc/gen_ndr/ntprinting.h50
-rw-r--r--source3/librpc/gen_ndr/py_dfs.c2
-rw-r--r--source3/librpc/gen_ndr/py_dns.c2
-rw-r--r--source3/librpc/gen_ndr/py_dnsp.c2
-rw-r--r--source3/librpc/gen_ndr/py_frstrans.c2
-rw-r--r--source3/librpc/gen_ndr/py_idmap.c6
-rw-r--r--source3/librpc/gen_ndr/py_misc.c2
-rw-r--r--source3/librpc/gen_ndr/py_ntprinting.c68
-rw-r--r--source3/librpc/gen_ndr/py_rap.c2
-rw-r--r--source3/librpc/gen_ndr/py_security.c2
-rw-r--r--source3/librpc/gen_ndr/py_spoolss.c4
-rw-r--r--source3/modules/vfs_fake_perms.c30
-rw-r--r--source3/printing/nt_printing_migrate.c14
-rw-r--r--source3/printing/nt_printing_migrate.h6
-rw-r--r--source3/printing/nt_printing_migrate_internal.c6
-rw-r--r--source3/printing/printing.c77
-rw-r--r--source3/printing/spoolssd.c18
-rw-r--r--source3/rpc_server/wkssvc/srv_wkssvc_nt.c8
-rw-r--r--source3/smbd/conn.c7
-rw-r--r--source3/smbd/dir.c25
-rw-r--r--source3/smbd/process.c53
-rw-r--r--source3/smbd/proto.h7
-rw-r--r--source3/smbd/reply.c156
-rw-r--r--source3/smbd/server.c77
-rw-r--r--source3/smbd/server_reload.c80
-rw-r--r--source3/smbd/trans2.c61
-rw-r--r--source3/utils/net_printing.c134
-rw-r--r--source3/winbindd/winbindd_cache.c21
-rw-r--r--source4/torture/ndr/ntprinting.c217
47 files changed, 1140 insertions, 351 deletions
diff --git a/WHATSNEW.txt b/WHATSNEW.txt
index 96a8407018..be09c55814 100644
--- a/WHATSNEW.txt
+++ b/WHATSNEW.txt
@@ -1,4 +1,104 @@
==============================
+ Release Notes for Samba 3.6.14
+ April 29, 2013
+ ==============================
+
+
+This is is the latest stable release of Samba 3.6.
+
+Major enhancements in Samba 3.6.14 include:
+
+o Certain xattrs cause Windows error 0x800700FF (bug #9130).
+
+Changes since 3.6.13:
+---------------------
+
+o Jeremy Allison <jra@samba.org>
+ * BUG 9130: Certain xattrs cause Windows error 0x800700FF.
+ * BUG 9724: Use is_encrypted_packet() function correctly inside server.
+ * BUG 9733: Fix 'smbcontrol close-share' is not working.
+ * BUG 9747: Make sure that we only propogate the INHERITED flag when we are
+ allowed to.
+ * BUG 9748: Remove unneeded fstat system call from hot read path.
+ * BUG 9811: Fix bug in old create temp SMB request. Only use VFS functions.
+
+
+o David Disseldorp <ddiss@samba.org>
+ * BUG 9650: New or deleted CUPS printerqueues are not recognized by Samba.
+ * BUG 9807: wbinfo: Fix segfault in wbinfo_pam_logon.
+
+
+o Volker Lendecke <vl@samba.org>
+ * BUG 9727: wkssvc: Fix NULL pointer dereference.
+ * BUG 9736: smbd: Tune "dir" a bit.
+ * BUG 9775: Fix segfault for "artificial" conn_structs.
+ * BUG 9809: RHEL SPEC: Package dbwrap_tool man page.
+
+
+o Andreas Schneider <asn@samba.org>
+ * BUG 9139: Fix the username map optimization.
+ * BUG 9699: Fix adding case sensitive spn.
+ * BUG 9723: Add a tool to migrate latin1 printing tdbs to registry.
+ * BUG 9735: Fix Winbind separator in upn to username conversion.
+ * BUG 9766: Cache name_to_sid/sid_to_name correctly.
+
+
+Note about upgrading from older versions:
+-----------------------------------------
+
+It is still the case that there are printing tdbs (ntprinting.tdb, ntforms.tdb,
+ntdrivers.tdb) which are in latin1 or other encodings. When updating from
+Samba 3.5 or earlier to Samba 3.6 or 4.0 these tdbs need to be migrated to our
+new registry based printing management. This means during the migration we
+also need to do charset conversion. This can only been done manually cause we don't
+know in which encoding the tdb is. You have to specify the correct code page
+for the conversion, see iconv -l and Wikipedia [1] for the available codepages.
+The mostly used one is Windows Latin1 which is CP1252.
+
+We've extended the 'net printing dump' and 'net printing migrate' commands to
+define the encoding of the tdb. So you can correctly view the tdb with:
+
+ net printing dump encoding=CP1252 /path/to/ntprinters.tdb
+
+or migrate it with e.g.:
+
+ net printing migrate encoding=CP1252 /path/to/ntprinters.tdb
+
+If you migrate printers we suggest you do it in the following order.
+
+ntforms.tdb
+ntdrivers.tdb
+ntprinting.tdb
+
+Don't forget to rename, move or delete these files in /var/lib/samba after the
+migration.
+
+[1] https://en.wikipedia.org/wiki/Code_page
+
+
+######################################################################
+Reporting bugs & Development Discussion
+#######################################
+
+Please discuss this release on the samba-technical mailing list or by
+joining the #samba-technical IRC channel on irc.freenode.net.
+
+If you do report problems then please try to send high quality
+feedback. If you don't provide vital information to help us track down
+the problem then you will probably be ignored. All bug reports should
+be filed under the Samba 3.6 product in the project's Bugzilla
+database (https://bugzilla.samba.org/).
+
+
+======================================================================
+== Our Code, Our Bugs, Our Responsibility.
+== The Samba Team
+======================================================================
+
+Release notes for older releases follow:
+----------------------------------------
+
+ ==============================
Release Notes for Samba 3.6.13
March 18, 2013
==============================
@@ -94,8 +194,9 @@ database (https://bugzilla.samba.org/).
== The Samba Team
======================================================================
-Release notes for older releases follow:
-----------------------------------------
+
+----------------------------------------------------------------------
+
==============================
Release Notes for Samba 3.6.12
diff --git a/librpc/idl/ntprinting.idl b/librpc/idl/ntprinting.idl
index 7013566672..8152144fca 100644
--- a/librpc/idl/ntprinting.idl
+++ b/librpc/idl/ntprinting.idl
@@ -30,20 +30,24 @@ interface ntprinting
[in] ntprinting_form form
);
- /* Samba 3 tdb storage format: drivers
+ /*
+ * First the string flags and then the Samba 3 tdb storage
+ * format: drivers
* "dffffffff" followed by a remaining buffer of "f" array */
typedef [flag(NDR_NOALIGN),public] struct {
+ [skip] uint32 string_flags;
+
uint32 version;
- utf8string name;
- utf8string environment;
- utf8string driverpath;
- utf8string datafile;
- utf8string configfile;
- utf8string helpfile;
- utf8string monitorname;
- utf8string defaultdatatype;
- [flag(STR_UTF8|STR_NOTERM|NDR_REMAINING)] string_array dependent_files;
+ [flag(ndr_ntprinting_string_flags(r->string_flags))] string name;
+ [flag(ndr_ntprinting_string_flags(r->string_flags))] string environment;
+ [flag(ndr_ntprinting_string_flags(r->string_flags))] string driverpath;
+ [flag(ndr_ntprinting_string_flags(r->string_flags))] string datafile;
+ [flag(ndr_ntprinting_string_flags(r->string_flags))] string configfile;
+ [flag(ndr_ntprinting_string_flags(r->string_flags))] string helpfile;
+ [flag(ndr_ntprinting_string_flags(r->string_flags))] string monitorname;
+ [flag(ndr_ntprinting_string_flags(r->string_flags))] string defaultdatatype;
+ [flag((ndr_ntprinting_string_flags(r->string_flags)&~STR_NULLTERM)|STR_NOTERM|NDR_REMAINING)] string_array dependent_files;
} ntprinting_driver;
[public] void decode_ntprinting_driver(
@@ -57,9 +61,11 @@ interface ntprinting
* "B" private data blob */
typedef [flag(NDR_NOALIGN),public] struct {
+ [skip] uint32 string_flags;
+
/* uint32 devicemode_ptr; */
- utf8string devicename;
- utf8string formname;
+ [flag(ndr_ntprinting_string_flags(r->string_flags))] string devicename;
+ [flag(ndr_ntprinting_string_flags(r->string_flags))] string formname;
uint16 specversion;
uint16 driverversion;
uint16 size;
@@ -95,21 +101,30 @@ interface ntprinting
DATA_BLOB *nt_dev_private;
} ntprinting_devicemode;
- /* Samba 3 tdb storage format: printer_data
+ /*
+ * First the string flags and then the Samba 3 tdb storage
+ * format: printer_data
* "p" ptr to printer_data
* "fdB" */
typedef [flag(NDR_NOALIGN),public] struct {
+ [skip] uint32 string_flags;
+
uint32 ptr;
- utf8string name;
+ [flag(ndr_ntprinting_string_flags(r->string_flags))] string name;
uint32 type;
DATA_BLOB data;
} ntprinting_printer_data;
- /* Samba 3 tdb storage format: printer_info
- * "dddddddddddfffffPfffff" */
+ /*
+ * First the string flags and then the Samba 3 tdb storage
+ * format: printer_info
+ * "dddddddddddfffffPfffff"
+ */
typedef [flag(NDR_NOALIGN),public] struct {
+ [skip] uint32 string_flags;
+
uint32 attributes;
uint32 priority;
uint32 default_priority;
@@ -121,17 +136,17 @@ interface ntprinting
uint32 changeid;
uint32 c_setprinter;
uint32 setuptime;
- utf8string servername;
- utf8string printername;
- utf8string sharename;
- utf8string portname;
- utf8string drivername;
- utf8string comment;
- utf8string location;
- utf8string sepfile;
- utf8string printprocessor;
- utf8string datatype;
- utf8string parameters;
+ [flag(ndr_ntprinting_string_flags(r->string_flags))] string servername;
+ [flag(ndr_ntprinting_string_flags(r->string_flags))] string printername;
+ [flag(ndr_ntprinting_string_flags(r->string_flags))] string sharename;
+ [flag(ndr_ntprinting_string_flags(r->string_flags))] string portname;
+ [flag(ndr_ntprinting_string_flags(r->string_flags))] string drivername;
+ [flag(ndr_ntprinting_string_flags(r->string_flags))] string comment;
+ [flag(ndr_ntprinting_string_flags(r->string_flags))] string location;
+ [flag(ndr_ntprinting_string_flags(r->string_flags))] string sepfile;
+ [flag(ndr_ntprinting_string_flags(r->string_flags))] string printprocessor;
+ [flag(ndr_ntprinting_string_flags(r->string_flags))] string datatype;
+ [flag(ndr_ntprinting_string_flags(r->string_flags))] string parameters;
} ntprinting_printer_info;
/* Abstract Samba 3 printer
diff --git a/librpc/ndr/ndr_ntprinting.c b/librpc/ndr/ndr_ntprinting.c
index 76b296d169..cb5293b88c 100644
--- a/librpc/ndr/ndr_ntprinting.c
+++ b/librpc/ndr/ndr_ntprinting.c
@@ -22,6 +22,19 @@
#include "includes.h"
#include "../librpc/gen_ndr/ndr_ntprinting.h"
+_PUBLIC_ uint32_t ndr_ntprinting_string_flags(uint32_t string_flags)
+{
+ uint32_t flags = LIBNDR_FLAG_STR_NULLTERM;
+
+ if (string_flags & LIBNDR_FLAG_STR_ASCII) {
+ flags |= LIBNDR_FLAG_STR_ASCII;
+ } else {
+ flags |= LIBNDR_FLAG_STR_UTF8;
+ }
+
+ return flags;
+}
+
_PUBLIC_ enum ndr_err_code ndr_pull_ntprinting_printer(struct ndr_pull *ndr, int ndr_flags, struct ntprinting_printer *r)
{
uint32_t _ptr_devmode;
@@ -43,6 +56,7 @@ _PUBLIC_ enum ndr_err_code ndr_pull_ntprinting_printer(struct ndr_pull *ndr, int
if (r->devmode) {
_mem_save_devmode_0 = NDR_PULL_GET_MEM_CTX(ndr);
NDR_PULL_SET_MEM_CTX(ndr, r->devmode, 0);
+ r->devmode->string_flags = r->info.string_flags;
NDR_CHECK(ndr_pull_ntprinting_devicemode(ndr, NDR_SCALARS|NDR_BUFFERS, r->devmode));
NDR_PULL_SET_MEM_CTX(ndr, _mem_save_devmode_0, 0);
}
@@ -59,6 +73,7 @@ _PUBLIC_ enum ndr_err_code ndr_pull_ntprinting_printer(struct ndr_pull *ndr, int
}
r->printer_data = talloc_realloc(ndr, r->printer_data, struct ntprinting_printer_data, r->count + 1);
NDR_ERR_HAVE_NO_MEMORY(r->printer_data);
+ r->printer_data[r->count].string_flags = r->info.string_flags;
NDR_CHECK(ndr_pull_ntprinting_printer_data(ndr, NDR_SCALARS, &r->printer_data[r->count]));
r->count++;
}
diff --git a/librpc/ndr/ndr_ntprinting.h b/librpc/ndr/ndr_ntprinting.h
index 8bda430438..3b6ee01460 100644
--- a/librpc/ndr/ndr_ntprinting.h
+++ b/librpc/ndr/ndr_ntprinting.h
@@ -22,4 +22,6 @@
#include "includes.h"
#include "../librpc/gen_ndr/ndr_ntprinting.h"
+_PUBLIC_ uint32_t ndr_ntprinting_string_flags(uint32_t string_flags);
+
_PUBLIC_ enum ndr_err_code ndr_pull_ntprinting_printer(struct ndr_pull *ndr, int ndr_flags, struct ntprinting_printer *r);
diff --git a/nsswitch/pam_winbind.c b/nsswitch/pam_winbind.c
index 3257101223..d1264943a7 100644
--- a/nsswitch/pam_winbind.c
+++ b/nsswitch/pam_winbind.c
@@ -2448,7 +2448,7 @@ static char* winbind_upn_to_username(struct pwb_context *ctx,
return NULL;
}
- return talloc_asprintf(ctx, "%s\\%s", domain, name);
+ return talloc_asprintf(ctx, "%s%c%s", domain, sep, name);
}
static int _pam_delete_cred(pam_handle_t *pamh, int flags,
diff --git a/nsswitch/wbinfo.c b/nsswitch/wbinfo.c
index ac07175022..9d25f59b8c 100644
--- a/nsswitch/wbinfo.c
+++ b/nsswitch/wbinfo.c
@@ -1728,7 +1728,7 @@ static bool wbinfo_pam_logon(char *username)
{
wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE;
struct wbcLogonUserParams params;
- struct wbcAuthErrorInfo *error;
+ struct wbcAuthErrorInfo *error = NULL;
char *s = NULL;
char *p = NULL;
TALLOC_CTX *frame = talloc_tos();
@@ -1779,16 +1779,15 @@ static bool wbinfo_pam_logon(char *username)
d_printf("plaintext password authentication %s\n",
WBC_ERROR_IS_OK(wbc_status) ? "succeeded" : "failed");
- if (!WBC_ERROR_IS_OK(wbc_status)) {
+ if (!WBC_ERROR_IS_OK(wbc_status) && (error != NULL)) {
d_fprintf(stderr,
"error code was %s (0x%x)\nerror message was: %s\n",
error->nt_string,
(int)error->nt_status,
error->display_string);
wbcFreeMemory(error);
- return false;
}
- return true;
+ return WBC_ERROR_IS_OK(wbc_status);
}
/* Save creds with winbind */
diff --git a/packaging/RHEL-CTDB/samba.spec b/packaging/RHEL-CTDB/samba.spec
index 689abec464..7bb9caf266 100644
--- a/packaging/RHEL-CTDB/samba.spec
+++ b/packaging/RHEL-CTDB/samba.spec
@@ -5,7 +5,7 @@ Summary: Samba SMB client and server
Vendor: Samba Team
Packager: Samba Team <samba@samba.org>
Name: samba
-Version: 3.6.13
+Version: 3.6.14
Release: 1GITHASH
Epoch: 0
License: GNU GPL version 3
diff --git a/packaging/RHEL/makerpms.sh b/packaging/RHEL/makerpms.sh
index aebd09adf0..6fc964e783 100644
--- a/packaging/RHEL/makerpms.sh
+++ b/packaging/RHEL/makerpms.sh
@@ -20,7 +20,7 @@ SRCDIR=`rpm --eval %_sourcedir`
USERID=`id -u`
GRPID=`id -g`
-VERSION='3.6.13'
+VERSION='3.6.14'
REVISION=''
SPECFILE="samba.spec"
RPMVER=`rpm --version | awk '{print $3}'`
diff --git a/packaging/RHEL/samba.spec b/packaging/RHEL/samba.spec
index ff2f77031b..bb65eea343 100644
--- a/packaging/RHEL/samba.spec
+++ b/packaging/RHEL/samba.spec
@@ -11,7 +11,7 @@ Summary: Samba SMB client and server
Vendor: Samba Team
Packager: Samba Team <samba@samba.org>
Name: samba
-Version: 3.6.13
+Version: 3.6.14
Release: 1
Epoch: 0
License: GNU GPL version 3
@@ -370,6 +370,7 @@ fi
%{_mandir}/man8/winbindd.8*
%{_mandir}/man1/ntlm_auth.1*
%{_mandir}/man1/wbinfo.1*
+%{_mandir}/man1/dbwrap_*.1*
%{_mandir}/man8/vfs_*.8*
%{_mandir}/man8/idmap_*.8*
diff --git a/packaging/RHEL/samba.spec.tmpl b/packaging/RHEL/samba.spec.tmpl
index adbc6dfb65..a689435131 100644
--- a/packaging/RHEL/samba.spec.tmpl
+++ b/packaging/RHEL/samba.spec.tmpl
@@ -370,6 +370,7 @@ fi
%{_mandir}/man8/winbindd.8*
%{_mandir}/man1/ntlm_auth.1*
%{_mandir}/man1/wbinfo.1*
+%{_mandir}/man1/dbwrap_*.1*
%{_mandir}/man8/vfs_*.8*
%{_mandir}/man8/idmap_*.8*
diff --git a/pidl/lib/Parse/Pidl/NDR.pm b/pidl/lib/Parse/Pidl/NDR.pm
index 71e7228063..c4cef64a75 100644
--- a/pidl/lib/Parse/Pidl/NDR.pm
+++ b/pidl/lib/Parse/Pidl/NDR.pm
@@ -1070,6 +1070,7 @@ my %property_list = (
"noprint" => ["FUNCTION", "TYPEDEF", "STRUCT", "UNION", "ENUM", "BITMAP", "ELEMENT", "PIPE"],
"nopython" => ["FUNCTION", "TYPEDEF", "STRUCT", "UNION", "ENUM", "BITMAP"],
"todo" => ["FUNCTION"],
+ "skip" => ["ELEMENT"],
# union
"switch_is" => ["ELEMENT"],
diff --git a/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm b/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm
index 3676d6d077..10a886a41b 100644
--- a/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm
+++ b/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm
@@ -924,7 +924,11 @@ sub ParseDataPull($$$$$$$)
$var_name = get_pointer_to($var_name);
- $self->pidl("NDR_CHECK(".TypeFunctionName("ndr_pull", $l->{DATA_TYPE})."($ndr, $ndr_flags, $var_name));");
+ if (has_property($e, "skip")) {
+ $self->pidl("/* [skip] '$var_name' */");
+ } else {
+ $self->pidl("NDR_CHECK(".TypeFunctionName("ndr_pull", $l->{DATA_TYPE})."($ndr, $ndr_flags, $var_name));");
+ }
my $pl = GetPrevLevel($e, $l);
@@ -962,7 +966,11 @@ sub ParseDataPush($$$$$$$)
$var_name = get_pointer_to($var_name);
}
- $self->pidl("NDR_CHECK(".TypeFunctionName("ndr_push", $l->{DATA_TYPE})."($ndr, $ndr_flags, $var_name));");
+ if (has_property($e, "skip")) {
+ $self->pidl("/* [skip] '$var_name' */");
+ } else {
+ $self->pidl("NDR_CHECK(".TypeFunctionName("ndr_push", $l->{DATA_TYPE})."($ndr, $ndr_flags, $var_name));");
+ }
} else {
$self->ParseTypePush($l->{DATA_TYPE}, $ndr, $var_name, $primitives, $deferred);
}
diff --git a/source3/VERSION b/source3/VERSION
index ab58022fe9..46ec559697 100644
--- a/source3/VERSION
+++ b/source3/VERSION
@@ -25,7 +25,7 @@
########################################################
SAMBA_VERSION_MAJOR=3
SAMBA_VERSION_MINOR=6
-SAMBA_VERSION_RELEASE=13
+SAMBA_VERSION_RELEASE=14
########################################################
# Bug fix releases use a letter for the patch revision #
diff --git a/source3/auth/user_util.c b/source3/auth/user_util.c
index d982c746c6..0ef0eb56cd 100644
--- a/source3/auth/user_util.c
+++ b/source3/auth/user_util.c
@@ -425,12 +425,16 @@ bool map_username(TALLOC_CTX *ctx, const char *user_in, char **p_user_out)
x_fclose(f);
/*
- * Setup the last_from and last_to as an optimization so
+ * If we didn't successfully map a user in the loop above,
+ * setup the last_from and last_to as an optimization so
* that we don't scan the file again for the same user.
*/
-
- set_last_from_to(user_in, user_in);
- store_map_in_gencache(ctx, user_in, user_in);
+ if (!mapped_user) {
+ DEBUG(8, ("The user '%s' has no mapping. "
+ "Skip it next time.\n", user_in));
+ set_last_from_to(user_in, user_in);
+ store_map_in_gencache(ctx, user_in, user_in);
+ }
return mapped_user;
}
diff --git a/source3/include/version.h b/source3/include/version.h
index d11d39438e..5237260986 100644
--- a/source3/include/version.h
+++ b/source3/include/version.h
@@ -1,8 +1,8 @@
/* Autogenerated by script/mkversion.sh */
#define SAMBA_VERSION_MAJOR 3
#define SAMBA_VERSION_MINOR 6
-#define SAMBA_VERSION_RELEASE 13
-#define SAMBA_VERSION_OFFICIAL_STRING "3.6.13"
+#define SAMBA_VERSION_RELEASE 14
+#define SAMBA_VERSION_OFFICIAL_STRING "3.6.14"
#ifdef SAMBA_VERSION_VENDOR_FUNCTION
# define SAMBA_VERSION_STRING SAMBA_VERSION_VENDOR_FUNCTION
#else /* SAMBA_VERSION_VENDOR_FUNCTION */
diff --git a/source3/lib/secdesc.c b/source3/lib/secdesc.c
index b7c9fc5293..7ff3a6af47 100644
--- a/source3/lib/secdesc.c
+++ b/source3/lib/secdesc.c
@@ -602,7 +602,8 @@ NTSTATUS se_create_child_secdesc(TALLOC_CTX *ctx,
if (!container) {
new_flags = 0;
} else {
- new_flags &= ~SEC_ACE_FLAG_INHERIT_ONLY;
+ new_flags &= ~(SEC_ACE_FLAG_INHERIT_ONLY|
+ SEC_ACE_FLAG_INHERITED_ACE);
if (!(new_flags & SEC_ACE_FLAG_CONTAINER_INHERIT)) {
new_flags |= SEC_ACE_FLAG_INHERIT_ONLY;
diff --git a/source3/libads/ldap.c b/source3/libads/ldap.c
index e62a4b4137..b841c843c6 100644
--- a/source3/libads/ldap.c
+++ b/source3/libads/ldap.c
@@ -1920,8 +1920,7 @@ ADS_STATUS ads_add_service_principal_name(ADS_STRUCT *ads, const char *machine_n
ads_msgfree(ads, res);
return ADS_ERROR(LDAP_NO_MEMORY);
}
- strupper_m(psp1);
- strlower_m(&psp1[strlen(spn)]);
+ strlower_m(&psp1[strlen(spn) + 1]);
servicePrincipalName[0] = psp1;
DEBUG(5,("ads_add_service_principal_name: INFO: Adding %s to host %s\n",
@@ -1934,8 +1933,7 @@ ADS_STATUS ads_add_service_principal_name(ADS_STRUCT *ads, const char *machine_n
ret = ADS_ERROR(LDAP_NO_MEMORY);
goto out;
}
- strupper_m(psp2);
- strlower_m(&psp2[strlen(spn)]);
+ strlower_m(&psp2[strlen(spn) + 1]);
servicePrincipalName[1] = psp2;
DEBUG(5,("ads_add_service_principal_name: INFO: Adding %s to host %s\n",
diff --git a/source3/librpc/gen_ndr/ndr_ntprinting.c b/source3/librpc/gen_ndr/ndr_ntprinting.c
index aafe65fc40..248d0e27de 100644
--- a/source3/librpc/gen_ndr/ndr_ntprinting.c
+++ b/source3/librpc/gen_ndr/ndr_ntprinting.c
@@ -79,58 +79,59 @@ _PUBLIC_ enum ndr_err_code ndr_push_ntprinting_driver(struct ndr_push *ndr, int
ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN);
if (ndr_flags & NDR_SCALARS) {
NDR_CHECK(ndr_push_align(ndr, 4));
+ /* [skip] 'r->string_flags' */
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->version));
{
uint32_t _flags_save_string = ndr->flags;
- ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_UTF8|LIBNDR_FLAG_STR_NULLTERM);
+ ndr_set_flags(&ndr->flags, ndr_ntprinting_string_flags(r->string_flags));
NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->name));
ndr->flags = _flags_save_string;
}
{
uint32_t _flags_save_string = ndr->flags;
- ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_UTF8|LIBNDR_FLAG_STR_NULLTERM);
+ ndr_set_flags(&ndr->flags, ndr_ntprinting_string_flags(r->string_flags));
NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->environment));
ndr->flags = _flags_save_string;
}
{
uint32_t _flags_save_string = ndr->flags;
- ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_UTF8|LIBNDR_FLAG_STR_NULLTERM);
+ ndr_set_flags(&ndr->flags, ndr_ntprinting_string_flags(r->string_flags));
NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->driverpath));
ndr->flags = _flags_save_string;
}
{
uint32_t _flags_save_string = ndr->flags;
- ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_UTF8|LIBNDR_FLAG_STR_NULLTERM);
+ ndr_set_flags(&ndr->flags, ndr_ntprinting_string_flags(r->string_flags));
NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->datafile));
ndr->flags = _flags_save_string;
}
{
uint32_t _flags_save_string = ndr->flags;
- ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_UTF8|LIBNDR_FLAG_STR_NULLTERM);
+ ndr_set_flags(&ndr->flags, ndr_ntprinting_string_flags(r->string_flags));
NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->configfile));
ndr->flags = _flags_save_string;
}
{
uint32_t _flags_save_string = ndr->flags;
- ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_UTF8|LIBNDR_FLAG_STR_NULLTERM);
+ ndr_set_flags(&ndr->flags, ndr_ntprinting_string_flags(r->string_flags));
NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->helpfile));
ndr->flags = _flags_save_string;
}
{
uint32_t _flags_save_string = ndr->flags;
- ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_UTF8|LIBNDR_FLAG_STR_NULLTERM);
+ ndr_set_flags(&ndr->flags, ndr_ntprinting_string_flags(r->string_flags));
NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->monitorname));
ndr->flags = _flags_save_string;
}
{
uint32_t _flags_save_string = ndr->flags;
- ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_UTF8|LIBNDR_FLAG_STR_NULLTERM);
+ ndr_set_flags(&ndr->flags, ndr_ntprinting_string_flags(r->string_flags));
NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->defaultdatatype));
ndr->flags = _flags_save_string;
}
{
uint32_t _flags_save_string_array = ndr->flags;
- ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_UTF8|LIBNDR_FLAG_STR_NOTERM|LIBNDR_FLAG_REMAINING);
+ ndr_set_flags(&ndr->flags, (ndr_ntprinting_string_flags(r->string_flags)&~LIBNDR_FLAG_STR_NULLTERM)|LIBNDR_FLAG_STR_NOTERM|LIBNDR_FLAG_REMAINING);
NDR_CHECK(ndr_push_string_array(ndr, NDR_SCALARS, r->dependent_files));
ndr->flags = _flags_save_string_array;
}
@@ -150,58 +151,59 @@ _PUBLIC_ enum ndr_err_code ndr_pull_ntprinting_driver(struct ndr_pull *ndr, int
ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN);
if (ndr_flags & NDR_SCALARS) {
NDR_CHECK(ndr_pull_align(ndr, 4));
+ /* [skip] '&r->string_flags' */
NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->version));
{
uint32_t _flags_save_string = ndr->flags;
- ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_UTF8|LIBNDR_FLAG_STR_NULLTERM);
+ ndr_set_flags(&ndr->flags, ndr_ntprinting_string_flags(r->string_flags));
NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->name));
ndr->flags = _flags_save_string;
}
{
uint32_t _flags_save_string = ndr->flags;
- ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_UTF8|LIBNDR_FLAG_STR_NULLTERM);
+ ndr_set_flags(&ndr->flags, ndr_ntprinting_string_flags(r->string_flags));
NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->environment));
ndr->flags = _flags_save_string;
}
{
uint32_t _flags_save_string = ndr->flags;
- ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_UTF8|LIBNDR_FLAG_STR_NULLTERM);
+ ndr_set_flags(&ndr->flags, ndr_ntprinting_string_flags(r->string_flags));
NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->driverpath));
ndr->flags = _flags_save_string;
}
{
uint32_t _flags_save_string = ndr->flags;
- ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_UTF8|LIBNDR_FLAG_STR_NULLTERM);
+ ndr_set_flags(&ndr->flags, ndr_ntprinting_string_flags(r->string_flags));
NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->datafile));
ndr->flags = _flags_save_string;
}
{
uint32_t _flags_save_string = ndr->flags;
- ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_UTF8|LIBNDR_FLAG_STR_NULLTERM);
+ ndr_set_flags(&ndr->flags, ndr_ntprinting_string_flags(r->string_flags));
NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->configfile));
ndr->flags = _flags_save_string;
}
{
uint32_t _flags_save_string = ndr->flags;
- ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_UTF8|LIBNDR_FLAG_STR_NULLTERM);
+ ndr_set_flags(&ndr->flags, ndr_ntprinting_string_flags(r->string_flags));
NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->helpfile));
ndr->flags = _flags_save_string;
}
{
uint32_t _flags_save_string = ndr->flags;
- ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_UTF8|LIBNDR_FLAG_STR_NULLTERM);
+ ndr_set_flags(&ndr->flags, ndr_ntprinting_string_flags(r->string_flags));
NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->monitorname));
ndr->flags = _flags_save_string;
}
{
uint32_t _flags_save_string = ndr->flags;
- ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_UTF8|LIBNDR_FLAG_STR_NULLTERM);
+ ndr_set_flags(&ndr->flags, ndr_ntprinting_string_flags(r->string_flags));
NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->defaultdatatype));
ndr->flags = _flags_save_string;
}
{
uint32_t _flags_save_string_array = ndr->flags;
- ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_UTF8|LIBNDR_FLAG_STR_NOTERM|LIBNDR_FLAG_REMAINING);
+ ndr_set_flags(&ndr->flags, (ndr_ntprinting_string_flags(r->string_flags)&~LIBNDR_FLAG_STR_NULLTERM)|LIBNDR_FLAG_STR_NOTERM|LIBNDR_FLAG_REMAINING);
NDR_CHECK(ndr_pull_string_array(ndr, NDR_SCALARS, &r->dependent_files));
ndr->flags = _flags_save_string_array;
}
@@ -222,6 +224,7 @@ _PUBLIC_ void ndr_print_ntprinting_driver(struct ndr_print *ndr, const char *nam
uint32_t _flags_save_STRUCT = ndr->flags;
ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN);
ndr->depth++;
+ ndr_print_uint32(ndr, "string_flags", r->string_flags);
ndr_print_uint32(ndr, "version", r->version);
ndr_print_string(ndr, "name", r->name);
ndr_print_string(ndr, "environment", r->environment);
@@ -244,15 +247,16 @@ _PUBLIC_ enum ndr_err_code ndr_push_ntprinting_devicemode(struct ndr_push *ndr,
ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN);
if (ndr_flags & NDR_SCALARS) {
NDR_CHECK(ndr_push_align(ndr, 5));
+ /* [skip] 'r->string_flags' */
{
uint32_t _flags_save_string = ndr->flags;
- ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_UTF8|LIBNDR_FLAG_STR_NULLTERM);
+ ndr_set_flags(&ndr->flags, ndr_ntprinting_string_flags(r->string_flags));
NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->devicename));
ndr->flags = _flags_save_string;
}
{
uint32_t _flags_save_string = ndr->flags;
- ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_UTF8|LIBNDR_FLAG_STR_NULLTERM);
+ ndr_set_flags(&ndr->flags, ndr_ntprinting_string_flags(r->string_flags));
NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->formname));
ndr->flags = _flags_save_string;
}
@@ -310,15 +314,16 @@ _PUBLIC_ enum ndr_err_code ndr_pull_ntprinting_devicemode(struct ndr_pull *ndr,
ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN);
if (ndr_flags & NDR_SCALARS) {
NDR_CHECK(ndr_pull_align(ndr, 5));
+ /* [skip] '&r->string_flags' */
{
uint32_t _flags_save_string = ndr->flags;
- ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_UTF8|LIBNDR_FLAG_STR_NULLTERM);
+ ndr_set_flags(&ndr->flags, ndr_ntprinting_string_flags(r->string_flags));
NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->devicename));
ndr->flags = _flags_save_string;
}
{
uint32_t _flags_save_string = ndr->flags;
- ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_UTF8|LIBNDR_FLAG_STR_NULLTERM);
+ ndr_set_flags(&ndr->flags, ndr_ntprinting_string_flags(r->string_flags));
NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->formname));
ndr->flags = _flags_save_string;
}
@@ -383,6 +388,7 @@ _PUBLIC_ void ndr_print_ntprinting_devicemode(struct ndr_print *ndr, const char
uint32_t _flags_save_STRUCT = ndr->flags;
ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN);
ndr->depth++;
+ ndr_print_uint32(ndr, "string_flags", r->string_flags);
ndr_print_string(ndr, "devicename", r->devicename);
ndr_print_string(ndr, "formname", r->formname);
ndr_print_uint16(ndr, "specversion", r->specversion);
@@ -435,10 +441,11 @@ _PUBLIC_ enum ndr_err_code ndr_push_ntprinting_printer_data(struct ndr_push *ndr
ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN);
if (ndr_flags & NDR_SCALARS) {
NDR_CHECK(ndr_push_align(ndr, 4));
+ /* [skip] 'r->string_flags' */
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->ptr));
{
uint32_t _flags_save_string = ndr->flags;
- ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_UTF8|LIBNDR_FLAG_STR_NULLTERM);
+ ndr_set_flags(&ndr->flags, ndr_ntprinting_string_flags(r->string_flags));
NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->name));
ndr->flags = _flags_save_string;
}
@@ -460,10 +467,11 @@ _PUBLIC_ enum ndr_err_code ndr_pull_ntprinting_printer_data(struct ndr_pull *ndr
ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN);
if (ndr_flags & NDR_SCALARS) {
NDR_CHECK(ndr_pull_align(ndr, 4));
+ /* [skip] '&r->string_flags' */
NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->ptr));
{
uint32_t _flags_save_string = ndr->flags;
- ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_UTF8|LIBNDR_FLAG_STR_NULLTERM);
+ ndr_set_flags(&ndr->flags, ndr_ntprinting_string_flags(r->string_flags));
NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->name));
ndr->flags = _flags_save_string;
}
@@ -486,6 +494,7 @@ _PUBLIC_ void ndr_print_ntprinting_printer_data(struct ndr_print *ndr, const cha
uint32_t _flags_save_STRUCT = ndr->flags;
ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN);
ndr->depth++;
+ ndr_print_uint32(ndr, "string_flags", r->string_flags);
ndr_print_uint32(ndr, "ptr", r->ptr);
ndr_print_string(ndr, "name", r->name);
ndr_print_uint32(ndr, "type", r->type);
@@ -502,6 +511,7 @@ _PUBLIC_ enum ndr_err_code ndr_push_ntprinting_printer_info(struct ndr_push *ndr
ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN);
if (ndr_flags & NDR_SCALARS) {
NDR_CHECK(ndr_push_align(ndr, 4));
+ /* [skip] 'r->string_flags' */
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->attributes));
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->priority));
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->default_priority));
@@ -515,67 +525,67 @@ _PUBLIC_ enum ndr_err_code ndr_push_ntprinting_printer_info(struct ndr_push *ndr
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->setuptime));
{
uint32_t _flags_save_string = ndr->flags;
- ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_UTF8|LIBNDR_FLAG_STR_NULLTERM);
+ ndr_set_flags(&ndr->flags, ndr_ntprinting_string_flags(r->string_flags));
NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->servername));
ndr->flags = _flags_save_string;
}
{
uint32_t _flags_save_string = ndr->flags;
- ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_UTF8|LIBNDR_FLAG_STR_NULLTERM);
+ ndr_set_flags(&ndr->flags, ndr_ntprinting_string_flags(r->string_flags));
NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->printername));
ndr->flags = _flags_save_string;
}
{
uint32_t _flags_save_string = ndr->flags;
- ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_UTF8|LIBNDR_FLAG_STR_NULLTERM);
+ ndr_set_flags(&ndr->flags, ndr_ntprinting_string_flags(r->string_flags));
NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->sharename));
ndr->flags = _flags_save_string;
}
{
uint32_t _flags_save_string = ndr->flags;
- ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_UTF8|LIBNDR_FLAG_STR_NULLTERM);
+ ndr_set_flags(&ndr->flags, ndr_ntprinting_string_flags(r->string_flags));
NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->portname));
ndr->flags = _flags_save_string;
}
{
uint32_t _flags_save_string = ndr->flags;
- ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_UTF8|LIBNDR_FLAG_STR_NULLTERM);
+ ndr_set_flags(&ndr->flags, ndr_ntprinting_string_flags(r->string_flags));
NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->drivername));
ndr->flags = _flags_save_string;
}
{
uint32_t _flags_save_string = ndr->flags;
- ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_UTF8|LIBNDR_FLAG_STR_NULLTERM);
+ ndr_set_flags(&ndr->flags, ndr_ntprinting_string_flags(r->string_flags));
NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->comment));
ndr->flags = _flags_save_string;
}
{
uint32_t _flags_save_string = ndr->flags;
- ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_UTF8|LIBNDR_FLAG_STR_NULLTERM);
+ ndr_set_flags(&ndr->flags, ndr_ntprinting_string_flags(r->string_flags));
NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->location));
ndr->flags = _flags_save_string;
}
{
uint32_t _flags_save_string = ndr->flags;
- ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_UTF8|LIBNDR_FLAG_STR_NULLTERM);
+ ndr_set_flags(&ndr->flags, ndr_ntprinting_string_flags(r->string_flags));
NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->sepfile));
ndr->flags = _flags_save_string;
}
{
uint32_t _flags_save_string = ndr->flags;
- ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_UTF8|LIBNDR_FLAG_STR_NULLTERM);
+ ndr_set_flags(&ndr->flags, ndr_ntprinting_string_flags(r->string_flags));
NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->printprocessor));
ndr->flags = _flags_save_string;
}
{
uint32_t _flags_save_string = ndr->flags;
- ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_UTF8|LIBNDR_FLAG_STR_NULLTERM);
+ ndr_set_flags(&ndr->flags, ndr_ntprinting_string_flags(r->string_flags));
NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->datatype));
ndr->flags = _flags_save_string;
}
{
uint32_t _flags_save_string = ndr->flags;
- ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_UTF8|LIBNDR_FLAG_STR_NULLTERM);
+ ndr_set_flags(&ndr->flags, ndr_ntprinting_string_flags(r->string_flags));
NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->parameters));
ndr->flags = _flags_save_string;
}
@@ -595,6 +605,7 @@ _PUBLIC_ enum ndr_err_code ndr_pull_ntprinting_printer_info(struct ndr_pull *ndr
ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN);
if (ndr_flags & NDR_SCALARS) {
NDR_CHECK(ndr_pull_align(ndr, 4));
+ /* [skip] '&r->string_flags' */
NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->attributes));
NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->priority));
NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->default_priority));
@@ -608,67 +619,67 @@ _PUBLIC_ enum ndr_err_code ndr_pull_ntprinting_printer_info(struct ndr_pull *ndr
NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->setuptime));
{
uint32_t _flags_save_string = ndr->flags;
- ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_UTF8|LIBNDR_FLAG_STR_NULLTERM);
+ ndr_set_flags(&ndr->flags, ndr_ntprinting_string_flags(r->string_flags));
NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->servername));
ndr->flags = _flags_save_string;
}
{
uint32_t _flags_save_string = ndr->flags;
- ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_UTF8|LIBNDR_FLAG_STR_NULLTERM);
+ ndr_set_flags(&ndr->flags, ndr_ntprinting_string_flags(r->string_flags));
NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->printername));
ndr->flags = _flags_save_string;
}
{
uint32_t _flags_save_string = ndr->flags;
- ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_UTF8|LIBNDR_FLAG_STR_NULLTERM);
+ ndr_set_flags(&ndr->flags, ndr_ntprinting_string_flags(r->string_flags));
NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->sharename));
ndr->flags = _flags_save_string;
}
{
uint32_t _flags_save_string = ndr->flags;
- ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_UTF8|LIBNDR_FLAG_STR_NULLTERM);
+ ndr_set_flags(&ndr->flags, ndr_ntprinting_string_flags(r->string_flags));
NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->portname));
ndr->flags = _flags_save_string;
}
{
uint32_t _flags_save_string = ndr->flags;
- ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_UTF8|LIBNDR_FLAG_STR_NULLTERM);
+ ndr_set_flags(&ndr->flags, ndr_ntprinting_string_flags(r->string_flags));
NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->drivername));
ndr->flags = _flags_save_string;
}
{
uint32_t _flags_save_string = ndr->flags;
- ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_UTF8|LIBNDR_FLAG_STR_NULLTERM);
+ ndr_set_flags(&ndr->flags, ndr_ntprinting_string_flags(r->string_flags));
NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->comment));
ndr->flags = _flags_save_string;
}
{
uint32_t _flags_save_string = ndr->flags;
- ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_UTF8|LIBNDR_FLAG_STR_NULLTERM);
+ ndr_set_flags(&ndr->flags, ndr_ntprinting_string_flags(r->string_flags));
NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->location));
ndr->flags = _flags_save_string;
}
{
uint32_t _flags_save_string = ndr->flags;
- ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_UTF8|LIBNDR_FLAG_STR_NULLTERM);
+ ndr_set_flags(&ndr->flags, ndr_ntprinting_string_flags(r->string_flags));
NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->sepfile));
ndr->flags = _flags_save_string;
}
{
uint32_t _flags_save_string = ndr->flags;
- ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_UTF8|LIBNDR_FLAG_STR_NULLTERM);
+ ndr_set_flags(&ndr->flags, ndr_ntprinting_string_flags(r->string_flags));
NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->printprocessor));
ndr->flags = _flags_save_string;
}
{
uint32_t _flags_save_string = ndr->flags;
- ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_UTF8|LIBNDR_FLAG_STR_NULLTERM);
+ ndr_set_flags(&ndr->flags, ndr_ntprinting_string_flags(r->string_flags));
NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->datatype));
ndr->flags = _flags_save_string;
}
{
uint32_t _flags_save_string = ndr->flags;
- ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_UTF8|LIBNDR_FLAG_STR_NULLTERM);
+ ndr_set_flags(&ndr->flags, ndr_ntprinting_string_flags(r->string_flags));
NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->parameters));
ndr->flags = _flags_save_string;
}
@@ -689,6 +700,7 @@ _PUBLIC_ void ndr_print_ntprinting_printer_info(struct ndr_print *ndr, const cha
uint32_t _flags_save_STRUCT = ndr->flags;
ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN);
ndr->depth++;
+ ndr_print_uint32(ndr, "string_flags", r->string_flags);
ndr_print_uint32(ndr, "attributes", r->attributes);
ndr_print_uint32(ndr, "priority", r->priority);
ndr_print_uint32(ndr, "default_priority", r->default_priority);
diff --git a/source3/librpc/gen_ndr/ntprinting.h b/source3/librpc/gen_ndr/ntprinting.h
index adcce73254..2f138c98e5 100644
--- a/source3/librpc/gen_ndr/ntprinting.h
+++ b/source3/librpc/gen_ndr/ntprinting.h
@@ -22,21 +22,23 @@ struct ntprinting_form {
}/* [public,flag(LIBNDR_FLAG_NOALIGN)] */;
struct ntprinting_driver {
+ uint32_t string_flags;/* [skip] */
uint32_t version;
- const char * name;/* [flag(LIBNDR_FLAG_STR_UTF8|LIBNDR_FLAG_STR_NULLTERM)] */
- const char * environment;/* [flag(LIBNDR_FLAG_STR_UTF8|LIBNDR_FLAG_STR_NULLTERM)] */
- const char * driverpath;/* [flag(LIBNDR_FLAG_STR_UTF8|LIBNDR_FLAG_STR_NULLTERM)] */
- const char * datafile;/* [flag(LIBNDR_FLAG_STR_UTF8|LIBNDR_FLAG_STR_NULLTERM)] */
- const char * configfile;/* [flag(LIBNDR_FLAG_STR_UTF8|LIBNDR_FLAG_STR_NULLTERM)] */
- const char * helpfile;/* [flag(LIBNDR_FLAG_STR_UTF8|LIBNDR_FLAG_STR_NULLTERM)] */
- const char * monitorname;/* [flag(LIBNDR_FLAG_STR_UTF8|LIBNDR_FLAG_STR_NULLTERM)] */
- const char * defaultdatatype;/* [flag(LIBNDR_FLAG_STR_UTF8|LIBNDR_FLAG_STR_NULLTERM)] */
- const char ** dependent_files;/* [flag(LIBNDR_FLAG_STR_UTF8|LIBNDR_FLAG_STR_NOTERM|LIBNDR_FLAG_REMAINING)] */
+ const char * name;/* [flag(ndr_ntprinting_string_flags(r->string_flags))] */
+ const char * environment;/* [flag(ndr_ntprinting_string_flags(r->string_flags))] */
+ const char * driverpath;/* [flag(ndr_ntprinting_string_flags(r->string_flags))] */
+ const char * datafile;/* [flag(ndr_ntprinting_string_flags(r->string_flags))] */
+ const char * configfile;/* [flag(ndr_ntprinting_string_flags(r->string_flags))] */
+ const char * helpfile;/* [flag(ndr_ntprinting_string_flags(r->string_flags))] */
+ const char * monitorname;/* [flag(ndr_ntprinting_string_flags(r->string_flags))] */
+ const char * defaultdatatype;/* [flag(ndr_ntprinting_string_flags(r->string_flags))] */
+ const char ** dependent_files;/* [flag((ndr_ntprinting_string_flags(r->string_flags)&~LIBNDR_FLAG_STR_NULLTERM)|LIBNDR_FLAG_STR_NOTERM|LIBNDR_FLAG_REMAINING)] */
}/* [public,flag(LIBNDR_FLAG_NOALIGN)] */;
struct ntprinting_devicemode {
- const char * devicename;/* [flag(LIBNDR_FLAG_STR_UTF8|LIBNDR_FLAG_STR_NULLTERM)] */
- const char * formname;/* [flag(LIBNDR_FLAG_STR_UTF8|LIBNDR_FLAG_STR_NULLTERM)] */
+ uint32_t string_flags;/* [skip] */
+ const char * devicename;/* [flag(ndr_ntprinting_string_flags(r->string_flags))] */
+ const char * formname;/* [flag(ndr_ntprinting_string_flags(r->string_flags))] */
uint16_t specversion;
uint16_t driverversion;
uint16_t size;
@@ -73,13 +75,15 @@ struct ntprinting_devicemode {
}/* [public,flag(LIBNDR_FLAG_NOALIGN)] */;
struct ntprinting_printer_data {
+ uint32_t string_flags;/* [skip] */
uint32_t ptr;
- const char * name;/* [flag(LIBNDR_FLAG_STR_UTF8|LIBNDR_FLAG_STR_NULLTERM)] */
+ const char * name;/* [flag(ndr_ntprinting_string_flags(r->string_flags))] */
uint32_t type;
DATA_BLOB data;
}/* [public,flag(LIBNDR_FLAG_NOALIGN)] */;
struct ntprinting_printer_info {
+ uint32_t string_flags;/* [skip] */
uint32_t attributes;
uint32_t priority;
uint32_t default_priority;
@@ -91,17 +95,17 @@ struct ntprinting_printer_info {
uint32_t changeid;
uint32_t c_setprinter;
uint32_t setuptime;
- const char * servername;/* [flag(LIBNDR_FLAG_STR_UTF8|LIBNDR_FLAG_STR_NULLTERM)] */
- const char * printername;/* [flag(LIBNDR_FLAG_STR_UTF8|LIBNDR_FLAG_STR_NULLTERM)] */
- const char * sharename;/* [flag(LIBNDR_FLAG_STR_UTF8|LIBNDR_FLAG_STR_NULLTERM)] */
- const char * portname;/* [flag(LIBNDR_FLAG_STR_UTF8|LIBNDR_FLAG_STR_NULLTERM)] */
- const char * drivername;/* [flag(LIBNDR_FLAG_STR_UTF8|LIBNDR_FLAG_STR_NULLTERM)] */
- const char * comment;/* [flag(LIBNDR_FLAG_STR_UTF8|LIBNDR_FLAG_STR_NULLTERM)] */
- const char * location;/* [flag(LIBNDR_FLAG_STR_UTF8|LIBNDR_FLAG_STR_NULLTERM)] */
- const char * sepfile;/* [flag(LIBNDR_FLAG_STR_UTF8|LIBNDR_FLAG_STR_NULLTERM)] */
- const char * printprocessor;/* [flag(LIBNDR_FLAG_STR_UTF8|LIBNDR_FLAG_STR_NULLTERM)] */
- const char * datatype;/* [flag(LIBNDR_FLAG_STR_UTF8|LIBNDR_FLAG_STR_NULLTERM)] */
- const char * parameters;/* [flag(LIBNDR_FLAG_STR_UTF8|LIBNDR_FLAG_STR_NULLTERM)] */
+ const char * servername;/* [flag(ndr_ntprinting_string_flags(r->string_flags))] */
+ const char * printername;/* [flag(ndr_ntprinting_string_flags(r->string_flags))] */
+ const char * sharename;/* [flag(ndr_ntprinting_string_flags(r->string_flags))] */
+ const char * portname;/* [flag(ndr_ntprinting_string_flags(r->string_flags))] */
+ const char * drivername;/* [flag(ndr_ntprinting_string_flags(r->string_flags))] */
+ const char * comment;/* [flag(ndr_ntprinting_string_flags(r->string_flags))] */
+ const char * location;/* [flag(ndr_ntprinting_string_flags(r->string_flags))] */
+ const char * sepfile;/* [flag(ndr_ntprinting_string_flags(r->string_flags))] */
+ const char * printprocessor;/* [flag(ndr_ntprinting_string_flags(r->string_flags))] */
+ const char * datatype;/* [flag(ndr_ntprinting_string_flags(r->string_flags))] */
+ const char * parameters;/* [flag(ndr_ntprinting_string_flags(r->string_flags))] */
}/* [public,flag(LIBNDR_FLAG_NOALIGN)] */;
struct ntprinting_printer {
diff --git a/source3/librpc/gen_ndr/py_dfs.c b/source3/librpc/gen_ndr/py_dfs.c
index d7ae8b7b77..3397fff2e6 100644
--- a/source3/librpc/gen_ndr/py_dfs.c
+++ b/source3/librpc/gen_ndr/py_dfs.c
@@ -4824,8 +4824,8 @@ void initdfs(void)
PyModule_AddObject(m, "DFS_MANAGER_VERSION_W2K8", PyInt_FromLong(DFS_MANAGER_VERSION_W2K8));
PyModule_AddObject(m, "DFS_INVALID_PRIORITY_CLASS", PyInt_FromLong(DFS_INVALID_PRIORITY_CLASS));
PyModule_AddObject(m, "DFS_VOLUME_STATE_AD_BLOB", PyInt_FromLong(DFS_VOLUME_STATE_AD_BLOB));
- PyModule_AddObject(m, "DFS_STORAGE_STATES", PyInt_FromLong(0xf));
PyModule_AddObject(m, "DFS_PROPERTY_FLAG_TARGET_FAILBACK", PyInt_FromLong(DFS_PROPERTY_FLAG_TARGET_FAILBACK));
+ PyModule_AddObject(m, "DFS_STORAGE_STATES", PyInt_FromLong(0xf));
PyModule_AddObject(m, "DFS_VOLUME_STATE_ONLINE", PyInt_FromLong(DFS_VOLUME_STATE_ONLINE));
PyModule_AddObject(m, "DFS_GLOBAL_LOW_PRIORITY_CLASS", PyInt_FromLong(DFS_GLOBAL_LOW_PRIORITY_CLASS));
PyModule_AddObject(m, "DFS_MANAGER_VERSION_W2K", PyInt_FromLong(DFS_MANAGER_VERSION_W2K));
diff --git a/source3/librpc/gen_ndr/py_dns.c b/source3/librpc/gen_ndr/py_dns.c
index 8fd4914de4..1ebe4e4785 100644
--- a/source3/librpc/gen_ndr/py_dns.c
+++ b/source3/librpc/gen_ndr/py_dns.c
@@ -1489,8 +1489,8 @@ void initdns(void)
PyModule_AddObject(m, "DNS_RCODE_NXRRSET", PyInt_FromLong(DNS_RCODE_NXRRSET));
PyModule_AddObject(m, "DNS_QTYPE_A", PyInt_FromLong(DNS_QTYPE_A));
PyModule_AddObject(m, "DNS_QTYPE_NSEC", PyInt_FromLong(DNS_QTYPE_NSEC));
- PyModule_AddObject(m, "DNS_QTYPE_SRV", PyInt_FromLong(DNS_QTYPE_SRV));
PyModule_AddObject(m, "DNS_QTYPE_DS", PyInt_FromLong(DNS_QTYPE_DS));
+ PyModule_AddObject(m, "DNS_QTYPE_SRV", PyInt_FromLong(DNS_QTYPE_SRV));
PyModule_AddObject(m, "DNS_RCODE_REFUSED", PyInt_FromLong(DNS_RCODE_REFUSED));
PyModule_AddObject(m, "DNS_RCODE_NOTZONE", PyInt_FromLong(DNS_RCODE_NOTZONE));
PyModule_AddObject(m, "DNS_QTYPE_MX", PyInt_FromLong(DNS_QTYPE_MX));
diff --git a/source3/librpc/gen_ndr/py_dnsp.c b/source3/librpc/gen_ndr/py_dnsp.c
index c3a9e50cd8..44c8ffceab 100644
--- a/source3/librpc/gen_ndr/py_dnsp.c
+++ b/source3/librpc/gen_ndr/py_dnsp.c
@@ -1138,8 +1138,8 @@ void initdnsp(void)
PyModule_AddObject(m, "DNS_RANK_ROOT_HINT", PyInt_FromLong(DNS_RANK_ROOT_HINT));
PyModule_AddObject(m, "DNS_TYPE_RRSIG", PyInt_FromLong(DNS_TYPE_RRSIG));
PyModule_AddObject(m, "DNS_TYPE_ALL", PyInt_FromLong(DNS_TYPE_ALL));
- PyModule_AddObject(m, "DNS_TYPE_TXT", PyInt_FromLong(DNS_TYPE_TXT));
PyModule_AddObject(m, "DNS_TYPE_A", PyInt_FromLong(DNS_TYPE_A));
+ PyModule_AddObject(m, "DNS_TYPE_TXT", PyInt_FromLong(DNS_TYPE_TXT));
PyModule_AddObject(m, "DNS_TYPE_AFSDB", PyInt_FromLong(DNS_TYPE_AFSDB));
PyModule_AddObject(m, "DNS_RANK_NS_GLUE", PyInt_FromLong(DNS_RANK_NS_GLUE));
PyModule_AddObject(m, "DNS_RANK_CACHE_NA_AUTHORITY", PyInt_FromLong(DNS_RANK_CACHE_NA_AUTHORITY));
diff --git a/source3/librpc/gen_ndr/py_frstrans.c b/source3/librpc/gen_ndr/py_frstrans.c
index 85f49d5b53..c14739607a 100644
--- a/source3/librpc/gen_ndr/py_frstrans.c
+++ b/source3/librpc/gen_ndr/py_frstrans.c
@@ -2102,8 +2102,8 @@ void initfrstrans(void)
PyModule_AddObject(m, "FRSTRANS_RDC_VERSION", PyInt_FromLong(FRSTRANS_RDC_VERSION));
PyModule_AddObject(m, "FRSTRANS_RDC_FILTER_GENERIC", PyInt_FromLong(FRSTRANS_RDC_FILTER_GENERIC));
PyModule_AddObject(m, "FRSTRANS_VERSION_REQUEST_SLOW_SYNC", PyInt_FromLong(FRSTRANS_VERSION_REQUEST_SLOW_SYNC));
- PyModule_AddObject(m, "FRSTRANS_TRANSPORT_SUPPORTS_RDC_SIMILARITY", PyInt_FromLong(FRSTRANS_TRANSPORT_SUPPORTS_RDC_SIMILARITY));
PyModule_AddObject(m, "FRSTRANS_RDC_FILTER_MAX", PyInt_FromLong(FRSTRANS_RDC_FILTER_MAX));
+ PyModule_AddObject(m, "FRSTRANS_TRANSPORT_SUPPORTS_RDC_SIMILARITY", PyInt_FromLong(FRSTRANS_TRANSPORT_SUPPORTS_RDC_SIMILARITY));
Py_INCREF((PyObject *)(void *)&frstrans_VersionVector_Type);
PyModule_AddObject(m, "VersionVector", (PyObject *)(void *)&frstrans_VersionVector_Type);
Py_INCREF((PyObject *)(void *)&frstrans_Update_Type);
diff --git a/source3/librpc/gen_ndr/py_idmap.c b/source3/librpc/gen_ndr/py_idmap.c
index 0eb669dfc9..e0f0ce22f6 100644
--- a/source3/librpc/gen_ndr/py_idmap.c
+++ b/source3/librpc/gen_ndr/py_idmap.c
@@ -324,11 +324,11 @@ void initidmap(void)
PyModule_AddObject(m, "ID_TYPE_BOTH", PyInt_FromLong(ID_TYPE_BOTH));
PyModule_AddObject(m, "ID_MAPPED", PyInt_FromLong(ID_MAPPED));
PyModule_AddObject(m, "ID_TYPE_UID", PyInt_FromLong(ID_TYPE_UID));
- PyModule_AddObject(m, "ID_TYPE_NOT_SPECIFIED", PyInt_FromLong(ID_TYPE_NOT_SPECIFIED));
PyModule_AddObject(m, "ID_EXPIRED", PyInt_FromLong(ID_EXPIRED));
- PyModule_AddObject(m, "ID_UNKNOWN", PyInt_FromLong(ID_UNKNOWN));
- PyModule_AddObject(m, "ID_TYPE_GID", PyInt_FromLong(ID_TYPE_GID));
PyModule_AddObject(m, "ID_UNMAPPED", PyInt_FromLong(ID_UNMAPPED));
+ PyModule_AddObject(m, "ID_TYPE_NOT_SPECIFIED", PyInt_FromLong(ID_TYPE_NOT_SPECIFIED));
+ PyModule_AddObject(m, "ID_TYPE_GID", PyInt_FromLong(ID_TYPE_GID));
+ PyModule_AddObject(m, "ID_UNKNOWN", PyInt_FromLong(ID_UNKNOWN));
Py_INCREF((PyObject *)(void *)&unixid_Type);
PyModule_AddObject(m, "unixid", (PyObject *)(void *)&unixid_Type);
Py_INCREF((PyObject *)(void *)&id_map_Type);
diff --git a/source3/librpc/gen_ndr/py_misc.c b/source3/librpc/gen_ndr/py_misc.c
index 76beeaa483..516b2078b0 100644
--- a/source3/librpc/gen_ndr/py_misc.c
+++ b/source3/librpc/gen_ndr/py_misc.c
@@ -702,8 +702,8 @@ void initmisc(void)
PyModule_AddObject(m, "REG_QWORD", PyInt_FromLong(REG_QWORD));
PyModule_AddObject(m, "SEC_CHAN_RODC", PyInt_FromLong(SEC_CHAN_RODC));
PyModule_AddObject(m, "REG_LINK", PyInt_FromLong(REG_LINK));
- PyModule_AddObject(m, "REG_NONE", PyInt_FromLong(REG_NONE));
PyModule_AddObject(m, "SEC_CHAN_LOCAL", PyInt_FromLong(SEC_CHAN_LOCAL));
+ PyModule_AddObject(m, "REG_NONE", PyInt_FromLong(REG_NONE));
Py_INCREF((PyObject *)(void *)&GUID_Type);
PyModule_AddObject(m, "GUID", (PyObject *)(void *)&GUID_Type);
Py_INCREF((PyObject *)(void *)&ndr_syntax_id_Type);
diff --git a/source3/librpc/gen_ndr/py_ntprinting.c b/source3/librpc/gen_ndr/py_ntprinting.c
index 130244913f..6ba7a83816 100644
--- a/source3/librpc/gen_ndr/py_ntprinting.c
+++ b/source3/librpc/gen_ndr/py_ntprinting.c
@@ -227,6 +227,22 @@ static PyTypeObject ntprinting_form_Type = {
};
+static PyObject *py_ntprinting_driver_get_string_flags(PyObject *obj, void *closure)
+{
+ struct ntprinting_driver *object = (struct ntprinting_driver *)py_talloc_get_ptr(obj);
+ PyObject *py_string_flags;
+ py_string_flags = PyInt_FromLong(object->string_flags);
+ return py_string_flags;
+}
+
+static int py_ntprinting_driver_set_string_flags(PyObject *py_obj, PyObject *value, void *closure)
+{
+ struct ntprinting_driver *object = (struct ntprinting_driver *)py_talloc_get_ptr(py_obj);
+ PY_CHECK_TYPE(&PyInt_Type, value, return -1;);
+ object->string_flags = PyInt_AsLong(value);
+ return 0;
+}
+
static PyObject *py_ntprinting_driver_get_version(PyObject *obj, void *closure)
{
struct ntprinting_driver *object = (struct ntprinting_driver *)py_talloc_get_ptr(obj);
@@ -379,6 +395,7 @@ static int py_ntprinting_driver_set_dependent_files(PyObject *py_obj, PyObject *
}
static PyGetSetDef py_ntprinting_driver_getsetters[] = {
+ { discard_const_p(char, "string_flags"), py_ntprinting_driver_get_string_flags, py_ntprinting_driver_set_string_flags },
{ discard_const_p(char, "version"), py_ntprinting_driver_get_version, py_ntprinting_driver_set_version },
{ discard_const_p(char, "name"), py_ntprinting_driver_get_name, py_ntprinting_driver_set_name },
{ discard_const_p(char, "environment"), py_ntprinting_driver_get_environment, py_ntprinting_driver_set_environment },
@@ -460,6 +477,22 @@ static PyTypeObject ntprinting_driver_Type = {
};
+static PyObject *py_ntprinting_devicemode_get_string_flags(PyObject *obj, void *closure)
+{
+ struct ntprinting_devicemode *object = (struct ntprinting_devicemode *)py_talloc_get_ptr(obj);
+ PyObject *py_string_flags;
+ py_string_flags = PyInt_FromLong(object->string_flags);
+ return py_string_flags;
+}
+
+static int py_ntprinting_devicemode_set_string_flags(PyObject *py_obj, PyObject *value, void *closure)
+{
+ struct ntprinting_devicemode *object = (struct ntprinting_devicemode *)py_talloc_get_ptr(py_obj);
+ PY_CHECK_TYPE(&PyInt_Type, value, return -1;);
+ object->string_flags = PyInt_AsLong(value);
+ return 0;
+}
+
static PyObject *py_ntprinting_devicemode_get_devicename(PyObject *obj, void *closure)
{
struct ntprinting_devicemode *object = (struct ntprinting_devicemode *)py_talloc_get_ptr(obj);
@@ -1029,6 +1062,7 @@ static int py_ntprinting_devicemode_set_nt_dev_private(PyObject *py_obj, PyObjec
}
static PyGetSetDef py_ntprinting_devicemode_getsetters[] = {
+ { discard_const_p(char, "string_flags"), py_ntprinting_devicemode_get_string_flags, py_ntprinting_devicemode_set_string_flags },
{ discard_const_p(char, "devicename"), py_ntprinting_devicemode_get_devicename, py_ntprinting_devicemode_set_devicename },
{ discard_const_p(char, "formname"), py_ntprinting_devicemode_get_formname, py_ntprinting_devicemode_set_formname },
{ discard_const_p(char, "specversion"), py_ntprinting_devicemode_get_specversion, py_ntprinting_devicemode_set_specversion },
@@ -1135,6 +1169,22 @@ static PyTypeObject ntprinting_devicemode_Type = {
};
+static PyObject *py_ntprinting_printer_data_get_string_flags(PyObject *obj, void *closure)
+{
+ struct ntprinting_printer_data *object = (struct ntprinting_printer_data *)py_talloc_get_ptr(obj);
+ PyObject *py_string_flags;
+ py_string_flags = PyInt_FromLong(object->string_flags);
+ return py_string_flags;
+}
+
+static int py_ntprinting_printer_data_set_string_flags(PyObject *py_obj, PyObject *value, void *closure)
+{
+ struct ntprinting_printer_data *object = (struct ntprinting_printer_data *)py_talloc_get_ptr(py_obj);
+ PY_CHECK_TYPE(&PyInt_Type, value, return -1;);
+ object->string_flags = PyInt_AsLong(value);
+ return 0;
+}
+
static PyObject *py_ntprinting_printer_data_get_ptr(PyObject *obj, void *closure)
{
struct ntprinting_printer_data *object = (struct ntprinting_printer_data *)py_talloc_get_ptr(obj);
@@ -1198,6 +1248,7 @@ static int py_ntprinting_printer_data_set_data(PyObject *py_obj, PyObject *value
}
static PyGetSetDef py_ntprinting_printer_data_getsetters[] = {
+ { discard_const_p(char, "string_flags"), py_ntprinting_printer_data_get_string_flags, py_ntprinting_printer_data_set_string_flags },
{ discard_const_p(char, "ptr"), py_ntprinting_printer_data_get_ptr, py_ntprinting_printer_data_set_ptr },
{ discard_const_p(char, "name"), py_ntprinting_printer_data_get_name, py_ntprinting_printer_data_set_name },
{ discard_const_p(char, "type"), py_ntprinting_printer_data_get_type, py_ntprinting_printer_data_set_type },
@@ -1273,6 +1324,22 @@ static PyTypeObject ntprinting_printer_data_Type = {
};
+static PyObject *py_ntprinting_printer_info_get_string_flags(PyObject *obj, void *closure)
+{
+ struct ntprinting_printer_info *object = (struct ntprinting_printer_info *)py_talloc_get_ptr(obj);
+ PyObject *py_string_flags;
+ py_string_flags = PyInt_FromLong(object->string_flags);
+ return py_string_flags;
+}
+
+static int py_ntprinting_printer_info_set_string_flags(PyObject *py_obj, PyObject *value, void *closure)
+{
+ struct ntprinting_printer_info *object = (struct ntprinting_printer_info *)py_talloc_get_ptr(py_obj);
+ PY_CHECK_TYPE(&PyInt_Type, value, return -1;);
+ object->string_flags = PyInt_AsLong(value);
+ return 0;
+}
+
static PyObject *py_ntprinting_printer_info_get_attributes(PyObject *obj, void *closure)
{
struct ntprinting_printer_info *object = (struct ntprinting_printer_info *)py_talloc_get_ptr(obj);
@@ -1615,6 +1682,7 @@ static int py_ntprinting_printer_info_set_parameters(PyObject *py_obj, PyObject
}
static PyGetSetDef py_ntprinting_printer_info_getsetters[] = {
+ { discard_const_p(char, "string_flags"), py_ntprinting_printer_info_get_string_flags, py_ntprinting_printer_info_set_string_flags },
{ discard_const_p(char, "attributes"), py_ntprinting_printer_info_get_attributes, py_ntprinting_printer_info_set_attributes },
{ discard_const_p(char, "priority"), py_ntprinting_printer_info_get_priority, py_ntprinting_printer_info_set_priority },
{ discard_const_p(char, "default_priority"), py_ntprinting_printer_info_get_default_priority, py_ntprinting_printer_info_set_default_priority },
diff --git a/source3/librpc/gen_ndr/py_rap.c b/source3/librpc/gen_ndr/py_rap.c
index 594b1bb25e..b3c1646eaa 100644
--- a/source3/librpc/gen_ndr/py_rap.c
+++ b/source3/librpc/gen_ndr/py_rap.c
@@ -7938,8 +7938,8 @@ void initrap(void)
PyModule_AddObject(m, "RAP_WUserGetGroups", PyInt_FromLong(59));
PyModule_AddObject(m, "RAP_WUserPasswordSet3", PyInt_FromLong(275));
PyModule_AddObject(m, "RAP_WShareDel_REQ", PyString_FromString("zW"));
- PyModule_AddObject(m, "RAP_WMessageNameDel", PyInt_FromLong(32));
PyModule_AddObject(m, "RAP_WfileEnum", PyInt_FromLong(10));
+ PyModule_AddObject(m, "RAP_WMessageNameDel", PyInt_FromLong(32));
PyModule_AddObject(m, "RAP_NetPathCompare", PyInt_FromLong(138));
PyModule_AddObject(m, "RAP_WErrorLogRead", PyInt_FromLong(135));
PyModule_AddObject(m, "RAP_PARAM_JOBSTATUSSTR", PyInt_FromLong(RAP_PARAM_JOBSTATUSSTR));
diff --git a/source3/librpc/gen_ndr/py_security.c b/source3/librpc/gen_ndr/py_security.c
index a7255920db..83b94dec93 100644
--- a/source3/librpc/gen_ndr/py_security.c
+++ b/source3/librpc/gen_ndr/py_security.c
@@ -2089,8 +2089,8 @@ void initsecurity(void)
PyModule_AddObject(m, "SEC_ACE_TYPE_SYSTEM_ALARM", PyInt_FromLong(SEC_ACE_TYPE_SYSTEM_ALARM));
PyModule_AddObject(m, "SEC_RIGHTS_DIR_PRIV_RESTORE", PyInt_FromLong(SEC_RIGHTS_PRIV_RESTORE|SEC_DIR_ADD_FILE|SEC_DIR_ADD_SUBDIR));
PyModule_AddObject(m, "SEC_GROUP_FROM_PARENT", PyInt_FromLong(SEC_GROUP_FROM_PARENT));
- PyModule_AddObject(m, "DOMAIN_RID_LOGON", PyInt_FromLong(9));
PyModule_AddObject(m, "SID_WORLD", PyString_FromString("S-1-1-0"));
+ PyModule_AddObject(m, "DOMAIN_RID_LOGON", PyInt_FromLong(9));
PyModule_AddObject(m, "SEC_STD_READ_CONTROL", PyInt_FromLong(0x00020000));
PyModule_AddObject(m, "SEC_MASK_GENERIC", PyInt_FromLong(0xF0000000));
PyModule_AddObject(m, "SEC_GENERIC_READ", PyInt_FromLong(0x80000000));
diff --git a/source3/librpc/gen_ndr/py_spoolss.c b/source3/librpc/gen_ndr/py_spoolss.c
index 06fabbeb2d..25e1dad0c0 100644
--- a/source3/librpc/gen_ndr/py_spoolss.c
+++ b/source3/librpc/gen_ndr/py_spoolss.c
@@ -31872,8 +31872,8 @@ void initspoolss(void)
PyModule_AddObject(m, "PRINTER_STATUS_BUSY", PyInt_FromLong(PRINTER_STATUS_BUSY));
PyModule_AddObject(m, "SPOOL_REG_PRINTMAXRESOLUTIONSUPPORTED", PyString_FromString("printMaxResolutionSupported"));
PyModule_AddObject(m, "PRINTER_DRIVER_PACKAGE_AWARE", PyInt_FromLong(PRINTER_DRIVER_PACKAGE_AWARE));
- PyModule_AddObject(m, "DMPAPER_PENV_10", PyInt_FromLong(DMPAPER_PENV_10));
PyModule_AddObject(m, "JOB_NOTIFY_FIELD_TOTAL_PAGES", PyInt_FromLong(JOB_NOTIFY_FIELD_TOTAL_PAGES));
+ PyModule_AddObject(m, "DMPAPER_PENV_10", PyInt_FromLong(DMPAPER_PENV_10));
PyModule_AddObject(m, "PRINTER_STATUS_PAPER_JAM", PyInt_FromLong(PRINTER_STATUS_PAPER_JAM));
PyModule_AddObject(m, "SPOOLSS_DM_PS_FEED_DIRECTION_SHORT_EDGE_FIRST", PyInt_FromLong(SPOOLSS_DM_PS_FEED_DIRECTION_SHORT_EDGE_FIRST));
PyModule_AddObject(m, "SERVER_ALL_ACCESS", PyInt_FromLong(SEC_STD_REQUIRED|SERVER_ACCESS_ADMINISTER|SERVER_ACCESS_ENUMERATE));
@@ -31939,8 +31939,8 @@ void initspoolss(void)
PyModule_AddObject(m, "SPOOLSS_DRIVER_VERSION_9X", PyInt_FromLong(SPOOLSS_DRIVER_VERSION_9X));
PyModule_AddObject(m, "SPOOLSS_JOB_CONTROL_RESUME", PyInt_FromLong(SPOOLSS_JOB_CONTROL_RESUME));
PyModule_AddObject(m, "PRINTER_NOTIFY_FIELD_ATTRIBUTES", PyInt_FromLong(PRINTER_NOTIFY_FIELD_ATTRIBUTES));
- PyModule_AddObject(m, "SPOOL_REG_OPERATINGSYSTEM", PyString_FromString("operatingSystem"));
PyModule_AddObject(m, "MAXDEVICENAME", PyInt_FromLong(32));
+ PyModule_AddObject(m, "SPOOL_REG_OPERATINGSYSTEM", PyString_FromString("operatingSystem"));
PyModule_AddObject(m, "PORT_STATUS_NO_TONER", PyInt_FromLong(PORT_STATUS_NO_TONER));
PyModule_AddObject(m, "DMDITHER_LINEART", PyInt_FromLong(DMDITHER_LINEART));
PyModule_AddObject(m, "DMPAPER_PENV_3_ROTATED", PyInt_FromLong(DMPAPER_PENV_3_ROTATED));
diff --git a/source3/modules/vfs_fake_perms.c b/source3/modules/vfs_fake_perms.c
index ade2407543..9956a3d299 100644
--- a/source3/modules/vfs_fake_perms.c
+++ b/source3/modules/vfs_fake_perms.c
@@ -29,6 +29,8 @@
#undef DBGC_CLASS
#define DBGC_CLASS DBGC_VFS
+extern struct current_user current_user;
+
static int fake_perms_stat(vfs_handle_struct *handle,
struct smb_filename *smb_fname)
{
@@ -41,8 +43,18 @@ static int fake_perms_stat(vfs_handle_struct *handle,
} else {
smb_fname->st.st_ex_mode = S_IRWXU;
}
- smb_fname->st.st_ex_uid = handle->conn->session_info->utok.uid;
- smb_fname->st.st_ex_gid = handle->conn->session_info->utok.gid;
+ if (handle->conn->session_info != NULL) {
+ smb_fname->st.st_ex_uid =
+ handle->conn->session_info->utok.uid;
+ smb_fname->st.st_ex_gid =
+ handle->conn->session_info->utok.gid;
+ } else {
+ /*
+ * Sucks, but current_user is the best we can do here.
+ */
+ smb_fname->st.st_ex_uid = current_user.ut.uid;
+ smb_fname->st.st_ex_gid = current_user.ut.gid;
+ }
}
return ret;
@@ -59,8 +71,18 @@ static int fake_perms_fstat(vfs_handle_struct *handle, files_struct *fsp, SMB_ST
} else {
sbuf->st_ex_mode = S_IRWXU;
}
- sbuf->st_ex_uid = handle->conn->session_info->utok.uid;
- sbuf->st_ex_gid = handle->conn->session_info->utok.gid;
+ if (handle->conn->session_info != NULL) {
+ sbuf->st_ex_uid =
+ handle->conn->session_info->utok.uid;
+ sbuf->st_ex_gid =
+ handle->conn->session_info->utok.gid;
+ } else {
+ /*
+ * Sucks, but current_user is the best we can do here.
+ */
+ sbuf->st_ex_uid = current_user.ut.uid;
+ sbuf->st_ex_gid = current_user.ut.gid;
+ }
}
return ret;
}
diff --git a/source3/printing/nt_printing_migrate.c b/source3/printing/nt_printing_migrate.c
index 6eb2f44998..77766190ce 100644
--- a/source3/printing/nt_printing_migrate.c
+++ b/source3/printing/nt_printing_migrate.c
@@ -103,7 +103,8 @@ NTSTATUS printing_tdb_migrate_driver(TALLOC_CTX *mem_ctx,
struct rpc_pipe_client *winreg_pipe,
const char *key_name,
unsigned char *data,
- size_t length)
+ size_t length,
+ bool do_string_conversion)
{
struct dcerpc_binding_handle *b = winreg_pipe->binding_handle;
enum ndr_err_code ndr_err;
@@ -121,6 +122,10 @@ NTSTATUS printing_tdb_migrate_driver(TALLOC_CTX *mem_ctx,
ZERO_STRUCT(r);
+ if (do_string_conversion) {
+ r.string_flags = LIBNDR_FLAG_STR_ASCII;
+ }
+
ndr_err = ndr_pull_struct_blob(&blob, mem_ctx, &r,
(ndr_pull_flags_fn_t)ndr_pull_ntprinting_driver);
if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
@@ -177,7 +182,8 @@ NTSTATUS printing_tdb_migrate_printer(TALLOC_CTX *mem_ctx,
struct rpc_pipe_client *winreg_pipe,
const char *key_name,
unsigned char *data,
- size_t length)
+ size_t length,
+ bool do_string_conversion)
{
struct dcerpc_binding_handle *b = winreg_pipe->binding_handle;
enum ndr_err_code ndr_err;
@@ -200,6 +206,10 @@ NTSTATUS printing_tdb_migrate_printer(TALLOC_CTX *mem_ctx,
ZERO_STRUCT(r);
+ if (do_string_conversion) {
+ r.info.string_flags = LIBNDR_FLAG_STR_ASCII;
+ }
+
ndr_err = ndr_pull_struct_blob(&blob, mem_ctx, &r,
(ndr_pull_flags_fn_t) ndr_pull_ntprinting_printer);
if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
diff --git a/source3/printing/nt_printing_migrate.h b/source3/printing/nt_printing_migrate.h
index 3da8db4626..0c9800ddcd 100644
--- a/source3/printing/nt_printing_migrate.h
+++ b/source3/printing/nt_printing_migrate.h
@@ -30,12 +30,14 @@ NTSTATUS printing_tdb_migrate_driver(TALLOC_CTX *mem_ctx,
struct rpc_pipe_client *winreg_pipe,
const char *key_name,
unsigned char *data,
- size_t length);
+ size_t length,
+ bool do_string_conversion);
NTSTATUS printing_tdb_migrate_printer(TALLOC_CTX *mem_ctx,
struct rpc_pipe_client *winreg_pipe,
const char *key_name,
unsigned char *data,
- size_t length);
+ size_t length,
+ bool do_string_conversion);
NTSTATUS printing_tdb_migrate_secdesc(TALLOC_CTX *mem_ctx,
struct rpc_pipe_client *winreg_pipe,
const char *key_name,
diff --git a/source3/printing/nt_printing_migrate_internal.c b/source3/printing/nt_printing_migrate_internal.c
index 5d8edc75f8..4b3758f80d 100644
--- a/source3/printing/nt_printing_migrate_internal.c
+++ b/source3/printing/nt_printing_migrate_internal.c
@@ -114,7 +114,8 @@ static NTSTATUS migrate_internal(TALLOC_CTX *mem_ctx,
winreg_pipe,
(const char *) kbuf.dptr + strlen(DRIVERS_PREFIX),
dbuf.dptr,
- dbuf.dsize);
+ dbuf.dsize,
+ false);
SAFE_FREE(dbuf.dptr);
if (!NT_STATUS_IS_OK(status)) {
tdb_close(tdb);
@@ -130,7 +131,8 @@ static NTSTATUS migrate_internal(TALLOC_CTX *mem_ctx,
winreg_pipe,
printer_name,
dbuf.dptr,
- dbuf.dsize);
+ dbuf.dsize,
+ false);
SAFE_FREE(dbuf.dptr);
if (!NT_STATUS_IS_OK(status)) {
tdb_close(tdb);
diff --git a/source3/printing/printing.c b/source3/printing/printing.c
index a5b36c725d..16821ae8a4 100644
--- a/source3/printing/printing.c
+++ b/source3/printing/printing.c
@@ -1656,6 +1656,24 @@ static void add_child_pid(pid_t pid)
num_children += 1;
}
+/****************************************************************************
+ Notify smbds of new printcap data
+**************************************************************************/
+static void reload_pcap_change_notify(struct tevent_context *ev,
+ struct messaging_context *msg_ctx)
+{
+ /*
+ * Reload the printers first in the background process so that
+ * newly added printers get default values created in the registry.
+ *
+ * This will block the process for some time (~1 sec per printer), but
+ * it doesn't block smbd's servering clients.
+ */
+ reload_printers_full(ev, msg_ctx);
+
+ message_send_all(msg_ctx, MSG_PRINTER_PCAP, NULL, 0, NULL);
+}
+
static bool printer_housekeeping_fn(const struct timeval *now,
void *private_data)
{
@@ -1678,6 +1696,43 @@ static bool printer_housekeeping_fn(const struct timeval *now,
return true;
}
+static void printing_sig_term_handler(struct tevent_context *ev,
+ struct tevent_signal *se,
+ int signum,
+ int count,
+ void *siginfo,
+ void *private_data)
+{
+ exit_server_cleanly("termination signal");
+}
+
+static void printing_sig_hup_handler(struct tevent_context *ev,
+ struct tevent_signal *se,
+ int signum,
+ int count,
+ void *siginfo,
+ void *private_data)
+{
+ struct messaging_context *msg_ctx = talloc_get_type_abort(
+ private_data, struct messaging_context);
+
+ DEBUG(1,("Reloading printers after SIGHUP\n"));
+ pcap_cache_reload(ev, msg_ctx,
+ &reload_pcap_change_notify);
+}
+
+static void printing_conf_updated(struct messaging_context *msg,
+ void *private_data,
+ uint32_t msg_type,
+ struct server_id server_id,
+ DATA_BLOB *data)
+{
+ DEBUG(5,("Reloading printers after conf change\n"));
+ pcap_cache_reload(messaging_event_context(msg), msg,
+ &reload_pcap_change_notify);
+}
+
+
static pid_t background_lpq_updater_pid = -1;
/****************************************************************************
@@ -1713,6 +1768,7 @@ void start_background_queue(struct tevent_context *ev,
struct tevent_fd *fde;
int ret;
NTSTATUS status;
+ struct tevent_signal *se;
/* Child. */
DEBUG(5,("start_background_queue: background LPQ thread started\n"));
@@ -1727,8 +1783,18 @@ void start_background_queue(struct tevent_context *ev,
smb_panic("reinit_after_fork() failed");
}
- smbd_setup_sig_term_handler();
- smbd_setup_sig_hup_handler(ev, msg_ctx);
+ se = tevent_add_signal(ev, ev, SIGTERM, 0,
+ printing_sig_term_handler,
+ NULL);
+ if (se == NULL) {
+ smb_panic("failed to setup SIGTERM handler");
+ }
+ se = tevent_add_signal(ev, ev, SIGHUP, 0,
+ printing_sig_hup_handler,
+ msg_ctx);
+ if (se == NULL) {
+ smb_panic("failed to setup SIGHUP handler");
+ }
if (!serverid_register(procid_self(),
FLAG_MSG_GENERAL|FLAG_MSG_SMBD
@@ -1742,6 +1808,8 @@ void start_background_queue(struct tevent_context *ev,
messaging_register(msg_ctx, NULL, MSG_PRINTER_UPDATE,
print_queue_receive);
+ messaging_register(msg_ctx, NULL, MSG_SMB_CONF_UPDATED,
+ printing_conf_updated);
fde = tevent_add_fd(ev, ev, pause_pipe[1], TEVENT_FD_READ,
printing_pause_fd_handler,
@@ -1751,6 +1819,11 @@ void start_background_queue(struct tevent_context *ev,
smb_panic("tevent_add_fd() failed for pause_pipe");
}
+ /* reload on startup to ensure parent smbd is refreshed */
+ pcap_cache_reload(server_event_context(),
+ smbd_messaging_context(),
+ &reload_pcap_change_notify);
+
if (!(event_add_idle(ev, NULL,
timeval_set(SMBD_HOUSEKEEPING_INTERVAL, 0),
"printer_housekeeping",
diff --git a/source3/printing/spoolssd.c b/source3/printing/spoolssd.c
index cb90a9f7c7..83727dffda 100644
--- a/source3/printing/spoolssd.c
+++ b/source3/printing/spoolssd.c
@@ -71,10 +71,23 @@ static void smb_conf_updated(struct messaging_context *msg,
DEBUG(10, ("Got message saying smb.conf was updated. Reloading.\n"));
change_to_root_user();
- reload_printers(ev_ctx, msg);
spoolss_reopen_logs();
}
+static void spoolss_pcap_updated(struct messaging_context *msg,
+ void *private_data,
+ uint32_t msg_type,
+ struct server_id server_id,
+ DATA_BLOB *data)
+{
+ struct tevent_context *ev_ctx = talloc_get_type_abort(private_data,
+ struct tevent_context);
+
+ DEBUG(10, ("Got message saying pcap was updated. Reloading.\n"));
+ change_to_root_user();
+ reload_printers(ev_ctx, msg);
+}
+
static void spoolss_sig_term_handler(struct tevent_context *ev,
struct tevent_signal *se,
int signum,
@@ -111,7 +124,6 @@ static void spoolss_sig_hup_handler(struct tevent_context *ev,
change_to_root_user();
DEBUG(1,("Reloading printers after SIGHUP\n"));
- reload_printers(ev, msg_ctx);
spoolss_reopen_logs();
}
@@ -198,6 +210,8 @@ void start_spoolssd(struct tevent_context *ev_ctx,
MSG_PRINTER_UPDATE, print_queue_receive);
messaging_register(msg_ctx, ev_ctx,
MSG_SMB_CONF_UPDATED, smb_conf_updated);
+ messaging_register(msg_ctx, ev_ctx,
+ MSG_PRINTER_PCAP, spoolss_pcap_updated);
/*
* Initialize spoolss with an init function to convert printers first.
diff --git a/source3/rpc_server/wkssvc/srv_wkssvc_nt.c b/source3/rpc_server/wkssvc/srv_wkssvc_nt.c
index 1764941a6f..2d3ec1e036 100644
--- a/source3/rpc_server/wkssvc/srv_wkssvc_nt.c
+++ b/source3/rpc_server/wkssvc/srv_wkssvc_nt.c
@@ -579,7 +579,9 @@ WERROR _wkssvc_NetWkstaEnumUsers(struct pipes_struct *p,
}
r->out.info->level = r->in.info->level;
*r->out.entries_read = r->out.info->ctr.user0->entries_read;
- *r->out.resume_handle = 0;
+ if (r->out.resume_handle != NULL) {
+ *r->out.resume_handle = 0;
+ }
break;
case 1:
r->out.info->ctr.user1 = create_enum_users1(p->mem_ctx);
@@ -588,7 +590,9 @@ WERROR _wkssvc_NetWkstaEnumUsers(struct pipes_struct *p,
}
r->out.info->level = r->in.info->level;
*r->out.entries_read = r->out.info->ctr.user1->entries_read;
- *r->out.resume_handle = 0;
+ if (r->out.resume_handle != NULL) {
+ *r->out.resume_handle = 0;
+ }
break;
default:
return WERR_UNKNOWN_LEVEL;
diff --git a/source3/smbd/conn.c b/source3/smbd/conn.c
index 8a96e88053..05e692fa50 100644
--- a/source3/smbd/conn.c
+++ b/source3/smbd/conn.c
@@ -481,7 +481,7 @@ void msg_force_tdis(struct messaging_context *msg,
if (strcmp(sharename, "*") == 0) {
DEBUG(1,("Forcing close of all shares\n"));
conn_close_all(sconn);
- return;
+ goto done;
}
if (sconn->using_smb2) {
@@ -512,4 +512,9 @@ void msg_force_tdis(struct messaging_context *msg,
}
}
}
+
+ done:
+
+ change_to_root_user();
+ reload_services(msg, -1, true);
}
diff --git a/source3/smbd/dir.c b/source3/smbd/dir.c
index 92be816a4e..f7bc325d9f 100644
--- a/source3/smbd/dir.c
+++ b/source3/smbd/dir.c
@@ -941,12 +941,14 @@ bool smbd_dirptr_get_entry(TALLOC_CTX *ctx,
long *_prev_offset)
{
connection_struct *conn = dirptr->conn;
- bool needslash;
+ size_t slashlen;
+ size_t pathlen;
*_smb_fname = NULL;
*_mode = 0;
- needslash = ( dirptr->path[strlen(dirptr->path) -1] != '/');
+ pathlen = strlen(dirptr->path);
+ slashlen = ( dirptr->path[pathlen-1] != '/') ? 1 : 0;
while (true) {
long cur_offset;
@@ -990,16 +992,27 @@ bool smbd_dirptr_get_entry(TALLOC_CTX *ctx,
continue;
}
- pathreal = talloc_asprintf(ctx, "%s%s%s",
- dirptr->path,
- needslash?"/":"",
- dname);
+ /*
+ * This used to be
+ * pathreal = talloc_asprintf(ctx, "%s%s%s", dirptr->path,
+ * needslash?"/":"", dname);
+ * but this was measurably slower than doing the memcpy.
+ */
+
+ pathreal = talloc_array(
+ ctx, char,
+ pathlen + slashlen + talloc_get_size(dname));
if (!pathreal) {
TALLOC_FREE(dname);
TALLOC_FREE(fname);
return false;
}
+ memcpy(pathreal, dirptr->path, pathlen);
+ pathreal[pathlen] = '/';
+ memcpy(pathreal + slashlen + pathlen, dname,
+ talloc_get_size(dname));
+
/* Create smb_fname with NULL stream_name. */
ZERO_STRUCT(smb_fname);
smb_fname.base_name = pathreal;
diff --git a/source3/smbd/process.c b/source3/smbd/process.c
index 358d0515ae..f43005dda3 100644
--- a/source3/smbd/process.c
+++ b/source3/smbd/process.c
@@ -921,59 +921,6 @@ struct idle_event *event_add_idle(struct event_context *event_ctx,
return result;
}
-static void smbd_sig_term_handler(struct tevent_context *ev,
- struct tevent_signal *se,
- int signum,
- int count,
- void *siginfo,
- void *private_data)
-{
- exit_server_cleanly("termination signal");
-}
-
-void smbd_setup_sig_term_handler(void)
-{
- struct tevent_signal *se;
-
- se = tevent_add_signal(smbd_event_context(),
- smbd_event_context(),
- SIGTERM, 0,
- smbd_sig_term_handler,
- NULL);
- if (!se) {
- exit_server("failed to setup SIGTERM handler");
- }
-}
-
-static void smbd_sig_hup_handler(struct tevent_context *ev,
- struct tevent_signal *se,
- int signum,
- int count,
- void *siginfo,
- void *private_data)
-{
- struct messaging_context *msg_ctx = talloc_get_type_abort(
- private_data, struct messaging_context);
- change_to_root_user();
- DEBUG(1,("Reloading services after SIGHUP\n"));
- reload_services(msg_ctx, smbd_server_conn->sock, False);
- if (am_parent) {
- pcap_cache_reload(ev, msg_ctx, &reload_pcap_change_notify);
- }
-}
-
-void smbd_setup_sig_hup_handler(struct tevent_context *ev,
- struct messaging_context *msg_ctx)
-{
- struct tevent_signal *se;
-
- se = tevent_add_signal(ev, ev, SIGHUP, 0, smbd_sig_hup_handler,
- msg_ctx);
- if (!se) {
- exit_server("failed to setup SIGHUP handler");
- }
-}
-
static NTSTATUS smbd_server_connection_loop_once(struct smbd_server_connection *conn)
{
int timeout;
diff --git a/source3/smbd/proto.h b/source3/smbd/proto.h
index d6f751175c..b4c5cb40cf 100644
--- a/source3/smbd/proto.h
+++ b/source3/smbd/proto.h
@@ -769,9 +769,6 @@ NTSTATUS make_default_filesystem_acl(TALLOC_CTX *ctx,
/* The following definitions come from smbd/process.c */
-void smbd_setup_sig_term_handler(void);
-void smbd_setup_sig_hup_handler(struct tevent_context *ev,
- struct messaging_context *msg_ctx);
bool srv_send_smb(struct smbd_server_connection *sconn, char *buffer,
bool no_signing, uint32_t seqnum,
bool do_encrypt,
@@ -980,10 +977,10 @@ struct messaging_context *smbd_messaging_context(void);
struct memcache *smbd_memcache(void);
void reload_printers(struct tevent_context *ev,
struct messaging_context *msg_ctx);
+void reload_printers_full(struct tevent_context *ev,
+ struct messaging_context *msg_ctx);
bool reload_services(struct messaging_context *msg_ctx, int smb_sock,
bool test);
-void reload_pcap_change_notify(struct tevent_context *ev,
- struct messaging_context *msg_ctx);
void exit_server(const char *const explanation);
void exit_server_cleanly(const char *const explanation);
void exit_server_fault(void);
diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c
index a708fd83dd..ca3a08f872 100644
--- a/source3/smbd/reply.c
+++ b/source3/smbd/reply.c
@@ -2239,13 +2239,14 @@ void reply_ctemp(struct smb_request *req)
{
connection_struct *conn = req->conn;
struct smb_filename *smb_fname = NULL;
+ char *wire_name = NULL;
char *fname = NULL;
uint32 fattr;
files_struct *fsp;
int oplock_request;
- int tmpfd;
char *s;
NTSTATUS status;
+ int i;
TALLOC_CTX *ctx = talloc_tos();
START_PROFILE(SMBctemp);
@@ -2258,77 +2259,86 @@ void reply_ctemp(struct smb_request *req)
fattr = SVAL(req->vwv+0, 0);
oplock_request = CORE_OPLOCK_REQUEST(req->inbuf);
- srvstr_get_path_req(ctx, req, &fname, (const char *)req->buf+1,
+ srvstr_get_path_req(ctx, req, &wire_name, (const char *)req->buf+1,
STR_TERMINATE, &status);
if (!NT_STATUS_IS_OK(status)) {
reply_nterror(req, status);
goto out;
}
- if (*fname) {
- fname = talloc_asprintf(ctx,
- "%s/TMXXXXXX",
- fname);
- } else {
- fname = talloc_strdup(ctx, "TMXXXXXX");
- }
- if (!fname) {
- reply_nterror(req, NT_STATUS_NO_MEMORY);
- goto out;
- }
+ for (i = 0; i < 10; i++) {
+ if (*wire_name) {
+ fname = talloc_asprintf(ctx,
+ "%s/TMP%s",
+ wire_name,
+ generate_random_str_list(ctx, 5, "0123456789"));
+ } else {
+ fname = talloc_asprintf(ctx,
+ "TMP%s",
+ generate_random_str_list(ctx, 5, "0123456789"));
+ }
- status = filename_convert(ctx, conn,
+ if (!fname) {
+ reply_nterror(req, NT_STATUS_NO_MEMORY);
+ goto out;
+ }
+
+ status = filename_convert(ctx, conn,
req->flags2 & FLAGS2_DFS_PATHNAMES,
fname,
0,
NULL,
&smb_fname);
- if (!NT_STATUS_IS_OK(status)) {
- if (NT_STATUS_EQUAL(status,NT_STATUS_PATH_NOT_COVERED)) {
- reply_botherror(req, NT_STATUS_PATH_NOT_COVERED,
+ if (!NT_STATUS_IS_OK(status)) {
+ if (NT_STATUS_EQUAL(status,NT_STATUS_PATH_NOT_COVERED)) {
+ reply_botherror(req, NT_STATUS_PATH_NOT_COVERED,
ERRSRV, ERRbadpath);
+ goto out;
+ }
+ reply_nterror(req, status);
goto out;
}
- reply_nterror(req, status);
- goto out;
- }
-
- tmpfd = mkstemp(smb_fname->base_name);
- if (tmpfd == -1) {
- reply_nterror(req, map_nt_error_from_unix(errno));
- goto out;
- }
-
- SMB_VFS_STAT(conn, smb_fname);
-
- /* We should fail if file does not exist. */
- status = SMB_VFS_CREATE_FILE(
- conn, /* conn */
- req, /* req */
- 0, /* root_dir_fid */
- smb_fname, /* fname */
- FILE_GENERIC_READ | FILE_GENERIC_WRITE, /* access_mask */
- FILE_SHARE_READ | FILE_SHARE_WRITE, /* share_access */
- FILE_OPEN, /* create_disposition*/
- 0, /* create_options */
- fattr, /* file_attributes */
- oplock_request, /* oplock_request */
- 0, /* allocation_size */
- 0, /* private_flags */
- NULL, /* sd */
- NULL, /* ea_list */
- &fsp, /* result */
- NULL); /* pinfo */
- /* close fd from mkstemp() */
- close(tmpfd);
+ /* Create the file. */
+ status = SMB_VFS_CREATE_FILE(
+ conn, /* conn */
+ req, /* req */
+ 0, /* root_dir_fid */
+ smb_fname, /* fname */
+ FILE_GENERIC_READ | FILE_GENERIC_WRITE, /* access_mask */
+ FILE_SHARE_READ | FILE_SHARE_WRITE, /* share_access */
+ FILE_CREATE, /* create_disposition*/
+ 0, /* create_options */
+ fattr, /* file_attributes */
+ oplock_request, /* oplock_request */
+ 0, /* allocation_size */
+ 0, /* private_flags */
+ NULL, /* sd */
+ NULL, /* ea_list */
+ &fsp, /* result */
+ NULL); /* pinfo */
+
+ if (NT_STATUS_EQUAL(status, NT_STATUS_OBJECT_NAME_COLLISION)) {
+ TALLOC_FREE(fname);
+ TALLOC_FREE(smb_fname);
+ continue;
+ }
- if (!NT_STATUS_IS_OK(status)) {
- if (open_was_deferred(req->mid)) {
- /* We have re-scheduled this call. */
+ if (!NT_STATUS_IS_OK(status)) {
+ if (open_was_deferred(req->mid)) {
+ /* We have re-scheduled this call. */
+ goto out;
+ }
+ reply_openerror(req, status);
goto out;
}
- reply_openerror(req, status);
+
+ break;
+ }
+
+ if (i == 10) {
+ /* Collision after 10 times... */
+ reply_nterror(req, status);
goto out;
}
@@ -2369,6 +2379,8 @@ void reply_ctemp(struct smb_request *req)
fsp->fh->fd, (unsigned int)smb_fname->st.st_ex_mode));
out:
TALLOC_FREE(smb_fname);
+ TALLOC_FREE(fname);
+ TALLOC_FREE(wire_name);
END_PROFILE(SMBctemp);
return;
}
@@ -3136,8 +3148,7 @@ void reply_readbraw(struct smb_request *req)
START_PROFILE(SMBreadbraw);
- if (srv_is_signing_active(sconn) ||
- is_encrypted_packet(req->inbuf)) {
+ if (srv_is_signing_active(sconn) || req->encrypted) {
exit_server_cleanly("reply_readbraw: SMB signing/sealing is active - "
"raw reads/writes are disallowed.");
}
@@ -3530,11 +3541,6 @@ static void send_file_readX(connection_struct *conn, struct smb_request *req,
struct lock_struct lock;
int saved_errno = 0;
- if(fsp_stat(fsp) == -1) {
- reply_nterror(req, map_nt_error_from_unix(errno));
- return;
- }
-
init_strict_lock_struct(fsp, (uint64_t)req->smbpid,
(uint64_t)startpos, (uint64_t)smb_maxcnt, READ_LOCK,
&lock);
@@ -3544,16 +3550,6 @@ static void send_file_readX(connection_struct *conn, struct smb_request *req,
return;
}
- if (!S_ISREG(fsp->fsp_name->st.st_ex_mode) ||
- (startpos > fsp->fsp_name->st.st_ex_size)
- || (smb_maxcnt > (fsp->fsp_name->st.st_ex_size - startpos))) {
- /*
- * We already know that we would do a short read, so don't
- * try the sendfile() path.
- */
- goto nosendfile_read;
- }
-
/*
* We can only use sendfile on a non-chained packet
* but we can use on a non-oplocked file. tridge proved this
@@ -3561,12 +3557,27 @@ static void send_file_readX(connection_struct *conn, struct smb_request *req,
*/
if (!req_is_in_chain(req) &&
- !is_encrypted_packet(req->inbuf) && (fsp->base_fsp == NULL) &&
+ !req->encrypted && (fsp->base_fsp == NULL) &&
(fsp->wcp == NULL) &&
lp_use_sendfile(SNUM(conn), req->sconn->smb1.signing_state) ) {
uint8 headerbuf[smb_size + 12 * 2];
DATA_BLOB header;
+ if(fsp_stat(fsp) == -1) {
+ reply_nterror(req, map_nt_error_from_unix(errno));
+ goto strict_unlock;
+ }
+
+ if (!S_ISREG(fsp->fsp_name->st.st_ex_mode) ||
+ (startpos > fsp->fsp_name->st.st_ex_size) ||
+ (smb_maxcnt > (fsp->fsp_name->st.st_ex_size - startpos))) {
+ /*
+ * We already know that we would do a short read, so don't
+ * try the sendfile() path.
+ */
+ goto nosendfile_read;
+ }
+
/*
* Set up the packet header before send. We
* assume here the sendfile will work (get the
@@ -3765,8 +3776,7 @@ void reply_read_and_X(struct smb_request *req)
return;
}
/* We currently don't do this on signed or sealed data. */
- if (srv_is_signing_active(req->sconn) ||
- is_encrypted_packet(req->inbuf)) {
+ if (srv_is_signing_active(req->sconn) || req->encrypted) {
reply_nterror(req, NT_STATUS_NOT_SUPPORTED);
END_PROFILE(SMBreadX);
return;
diff --git a/source3/smbd/server.c b/source3/smbd/server.c
index 4b6114a7f9..a26dbc4ea4 100644
--- a/source3/smbd/server.c
+++ b/source3/smbd/server.c
@@ -108,10 +108,7 @@ static void smb_conf_updated(struct messaging_context *msg,
"updated. Reloading.\n"));
change_to_root_user();
reload_services(msg, smbd_server_conn->sock, False);
- if (am_parent) {
- pcap_cache_reload(ev_ctx, msg,
- &reload_pcap_change_notify);
- }
+ /* printer reload triggered by background printing process */
}
/*******************************************************************
@@ -132,6 +129,57 @@ static void smb_pcap_updated(struct messaging_context *msg,
reload_printers(ev_ctx, msg);
}
+static void smbd_sig_term_handler(struct tevent_context *ev,
+ struct tevent_signal *se,
+ int signum,
+ int count,
+ void *siginfo,
+ void *private_data)
+{
+ exit_server_cleanly("termination signal");
+}
+
+static void smbd_setup_sig_term_handler(void)
+{
+ struct tevent_signal *se;
+
+ se = tevent_add_signal(smbd_event_context(),
+ smbd_event_context(),
+ SIGTERM, 0,
+ smbd_sig_term_handler,
+ NULL);
+ if (!se) {
+ exit_server("failed to setup SIGTERM handler");
+ }
+}
+
+static void smbd_sig_hup_handler(struct tevent_context *ev,
+ struct tevent_signal *se,
+ int signum,
+ int count,
+ void *siginfo,
+ void *private_data)
+{
+ struct messaging_context *msg_ctx = talloc_get_type_abort(
+ private_data, struct messaging_context);
+ change_to_root_user();
+ DEBUG(1,("Reloading services after SIGHUP\n"));
+ reload_services(msg_ctx, smbd_server_conn->sock, false);
+}
+
+static void smbd_setup_sig_hup_handler(struct tevent_context *ev,
+ struct messaging_context *msg_ctx)
+{
+ struct tevent_signal *se;
+
+ se = tevent_add_signal(ev, ev, SIGHUP, 0, smbd_sig_hup_handler,
+ msg_ctx);
+ if (!se) {
+ exit_server("failed to setup SIGHUP handler");
+ }
+}
+
+
/*******************************************************************
Delete a statcache entry.
********************************************************************/
@@ -772,8 +820,6 @@ static bool open_sockets_smbd(struct smbd_parent_context *parent,
messaging_register(msg_ctx, NULL, MSG_SMB_STAT_CACHE_DELETE,
smb_stat_cache_delete);
messaging_register(msg_ctx, NULL, MSG_DEBUG, smbd_msg_debug);
- messaging_register(msg_ctx, server_event_context(), MSG_PRINTER_PCAP,
- smb_pcap_updated);
brl_register_msgs(msg_ctx);
msg_idmap_register_msgs(msg_ctx);
@@ -1234,10 +1280,6 @@ extern void build_options(bool screen);
if (!print_backend_init(smbd_messaging_context()))
exit(1);
- /* Publish nt printers, this requires a working winreg pipe */
- pcap_cache_reload(server_event_context(), smbd_messaging_context(),
- &reload_printers);
-
/* only start the background queue daemon if we are
running as a daemon -- bad things will happen if
smbd is launched via inetd and we fork a copy of
@@ -1245,8 +1287,19 @@ extern void build_options(bool screen);
if (is_daemon && !interactive
&& lp_parm_bool(-1, "smbd", "backgroundqueue", true)) {
- start_background_queue(smbd_event_context(),
- smbd_messaging_context());
+ /* background queue is responsible for printcap cache updates */
+ messaging_register(smbd_server_conn->msg_ctx,
+ smbd_event_context(),
+ MSG_PRINTER_PCAP, smb_pcap_updated);
+ start_background_queue(server_event_context(),
+ smbd_server_conn->msg_ctx);
+ } else {
+ DEBUG(3, ("running without background printer process, dynamic "
+ "printer updates disabled\n"));
+ /* Publish nt printers, this requires a working winreg pipe */
+ pcap_cache_reload(server_event_context(),
+ smbd_messaging_context(),
+ &reload_printers_full);
}
if (is_daemon && !_lp_disable_spoolss()) {
diff --git a/source3/smbd/server_reload.c b/source3/smbd/server_reload.c
index bda5d08a63..9e28a72a76 100644
--- a/source3/smbd/server_reload.c
+++ b/source3/smbd/server_reload.c
@@ -36,8 +36,51 @@
void reload_printers(struct tevent_context *ev,
struct messaging_context *msg_ctx)
{
+ int n_services;
+ int pnum;
+ int snum;
+ const char *pname;
+
+ n_services = lp_numservices();
+ pnum = lp_servicenumber(PRINTERS_NAME);
+
+ DEBUG(10, ("reloading printer services from pcap cache\n"));
+
+ /*
+ * Add default config for printers added to smb.conf file and remove
+ * stale printers
+ */
+ for (snum = 0; snum < n_services; snum++) {
+ /* avoid removing PRINTERS_NAME */
+ if (snum == pnum) {
+ continue;
+ }
+
+ /* skip no-printer services */
+ if (!(lp_snum_ok(snum) && lp_print_ok(snum))) {
+ continue;
+ }
+
+ pname = lp_printername(snum);
+
+ /* check printer, but avoid removing non-autoloaded printers */
+ if (lp_autoloaded(snum) && !pcap_printername_ok(pname)) {
+ DEBUG(3, ("removing stale printer %s\n", pname));
+ lp_killservice(snum);
+ }
+ }
+
+ /* Make sure deleted printers are gone */
+ load_printers(ev, msg_ctx);
+}
+
+/****************************************************************************
+ purge stale printers and reload from pre-populated pcap cache
+**************************************************************************/
+void reload_printers_full(struct tevent_context *ev,
+ struct messaging_context *msg_ctx)
+{
struct auth_serversupplied_info *session_info = NULL;
- struct spoolss_PrinterInfo2 *pinfo2 = NULL;
int n_services;
int pnum;
int snum;
@@ -45,17 +88,12 @@ void reload_printers(struct tevent_context *ev,
const char *sname;
NTSTATUS status;
- load_printers(ev, msg_ctx);
-
n_services = lp_numservices();
pnum = lp_servicenumber(PRINTERS_NAME);
- DEBUG(10, ("reloading printer services from pcap cache\n"));
-
- status = make_session_info_system(talloc_tos(), &session_info);
+ status = make_session_info_system(talloc_new(NULL), &session_info);
if (!NT_STATUS_IS_OK(status)) {
- DEBUG(3, ("reload_printers: "
- "Could not create system session_info\n"));
+ DEBUG(3, ("Could not create system session_info\n"));
/* can't remove stale printers before we
* are fully initilized */
return;
@@ -81,8 +119,7 @@ void reload_printers(struct tevent_context *ev,
/* check printer, but avoid removing non-autoloaded printers */
if (lp_autoloaded(snum) && !pcap_printername_ok(pname)) {
- DEBUG(3, ("removing stale printer %s\n", pname));
-
+ struct spoolss_PrinterInfo2 *pinfo2 = NULL;
if (is_printer_published(session_info, session_info,
msg_ctx,
NULL, lp_servicename(snum),
@@ -96,7 +133,6 @@ void reload_printers(struct tevent_context *ev,
}
nt_printer_remove(session_info, session_info, msg_ctx,
pname);
- lp_killservice(snum);
} else {
DEBUG(8, ("Adding default registry entry for printer "
"[%s], if it doesn't exist.\n", sname));
@@ -105,8 +141,8 @@ void reload_printers(struct tevent_context *ev,
}
}
- /* Make sure deleted printers are gone */
- load_printers(ev, msg_ctx);
+ /* finally, purge old snums */
+ reload_printers(ev, msg_ctx);
TALLOC_FREE(session_info);
}
@@ -160,21 +196,3 @@ bool reload_services(struct messaging_context *msg_ctx, int smb_sock,
return(ret);
}
-
-/****************************************************************************
- Notify smbds of new printcap data
-**************************************************************************/
-void reload_pcap_change_notify(struct tevent_context *ev,
- struct messaging_context *msg_ctx)
-{
- /*
- * Reload the printers first in the background process so that
- * newly added printers get default values created in the registry.
- *
- * This will block the process for some time (~1 sec per printer), but
- * it doesn't block smbd's servering clients.
- */
- reload_printers(ev, msg_ctx);
-
- message_send_all(msg_ctx, MSG_PRINTER_PCAP, NULL, 0, NULL);
-}
diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c
index df4fa64929..01b0130a38 100644
--- a/source3/smbd/trans2.c
+++ b/source3/smbd/trans2.c
@@ -328,6 +328,15 @@ static struct ea_list *get_ea_list_from_file(TALLOC_CTX *mem_ctx, connection_str
return NULL;
}
+ if (listp->ea.value.length == 0) {
+ /*
+ * We can never return a zero length EA.
+ * Windows reports the EA's as corrupted.
+ */
+ TALLOC_FREE(listp);
+ continue;
+ }
+
push_ascii_fstring(dos_ea_name, listp->ea.name);
*pea_total_len +=
@@ -411,6 +420,7 @@ static NTSTATUS fill_ea_chained_buffer(TALLOC_CTX *mem_ctx,
{
uint8_t *p = (uint8_t *)pdata;
uint8_t *last_start = NULL;
+ bool store_data = (pdata != NULL);
*ret_data_size = 0;
@@ -422,8 +432,9 @@ static NTSTATUS fill_ea_chained_buffer(TALLOC_CTX *mem_ctx,
size_t dos_namelen;
fstring dos_ea_name;
size_t this_size;
+ size_t pad = 0;
- if (last_start) {
+ if (last_start && store_data) {
SIVAL(last_start, 0, PTR_DIFF(p, last_start));
}
last_start = p;
@@ -440,7 +451,7 @@ static NTSTATUS fill_ea_chained_buffer(TALLOC_CTX *mem_ctx,
this_size = 0x08 + dos_namelen + 1 + ea_list->ea.value.length;
if (ea_list->next) {
- size_t pad = 4 - (this_size % 4);
+ pad = (4 - (this_size % 4)) % 4;
this_size += pad;
}
@@ -449,12 +460,19 @@ static NTSTATUS fill_ea_chained_buffer(TALLOC_CTX *mem_ctx,
}
/* We know we have room. */
- SIVAL(p, 0x00, 0); /* next offset */
- SCVAL(p, 0x04, ea_list->ea.flags);
- SCVAL(p, 0x05, dos_namelen);
- SSVAL(p, 0x06, ea_list->ea.value.length);
- fstrcpy((char *)(p+0x08), dos_ea_name);
- memcpy(p + 0x08 + dos_namelen + 1, ea_list->ea.value.data, ea_list->ea.value.length);
+ if (store_data) {
+ SIVAL(p, 0x00, 0); /* next offset */
+ SCVAL(p, 0x04, ea_list->ea.flags);
+ SCVAL(p, 0x05, dos_namelen);
+ SSVAL(p, 0x06, ea_list->ea.value.length);
+ fstrcpy((char *)(p+0x08), dos_ea_name);
+ memcpy(p + 0x08 + dos_namelen + 1, ea_list->ea.value.data, ea_list->ea.value.length);
+ if (pad) {
+ memset(p + 0x08 + dos_namelen + 1 + ea_list->ea.value.length,
+ '\0',
+ pad);
+ }
+ }
total_data_size -= this_size;
p += this_size;
@@ -468,13 +486,38 @@ static NTSTATUS fill_ea_chained_buffer(TALLOC_CTX *mem_ctx,
static unsigned int estimate_ea_size(connection_struct *conn, files_struct *fsp, const char *fname)
{
size_t total_ea_len = 0;
+ struct ea_list *ea_list = NULL;
TALLOC_CTX *mem_ctx = NULL;
if (!lp_ea_support(SNUM(conn))) {
return 0;
}
mem_ctx = talloc_tos();
- (void)get_ea_list_from_file(mem_ctx, conn, fsp, fname, &total_ea_len);
+ ea_list = get_ea_list_from_file(mem_ctx, conn, fsp, fname, &total_ea_len);
+ if (ea_list == NULL) {
+ return 0;
+ }
+ if(conn->sconn->using_smb2) {
+ NTSTATUS status;
+ unsigned int ret_data_size;
+ /*
+ * We're going to be using fill_ea_chained_buffer() to
+ * marshall EA's - this size is significantly larger
+ * than the SMB1 buffer. Re-calculate the size without
+ * marshalling.
+ */
+ status = fill_ea_chained_buffer(mem_ctx,
+ NULL,
+ 65535,
+ &ret_data_size,
+ conn,
+ ea_list);
+ if (!NT_STATUS_IS_OK(status)) {
+ ret_data_size = 0;
+ }
+ total_ea_len = ret_data_size;
+ }
+
return total_ea_len;
}
diff --git a/source3/utils/net_printing.c b/source3/utils/net_printing.c
index a52d31faf7..ccb073cf6f 100644
--- a/source3/utils/net_printing.c
+++ b/source3/utils/net_printing.c
@@ -37,6 +37,48 @@
#define PRINTERS_PREFIX "PRINTERS/"
#define SECDESC_PREFIX "SECDESC/"
+#define ARG_ENCODING "encoding="
+
+struct printing_opts {
+ const char *encoding;
+ const char *tdb;
+};
+
+static NTSTATUS printing_parse_args(TALLOC_CTX *mem_ctx,
+ struct printing_opts **popts,
+ int argc, const char **argv)
+{
+ size_t c;
+ struct printing_opts *o;
+
+ if (argc == 0) {
+ return NT_STATUS_INVALID_PARAMETER;
+ }
+
+ o = talloc_zero(mem_ctx, struct printing_opts);
+ if (o == NULL) {
+ return NT_STATUS_INVALID_PARAMETER;
+ }
+
+ for (c = 0; c < argc; c++) {
+ if (strnequal(argv[c], ARG_ENCODING, sizeof(ARG_ENCODING) - 1)) {
+ o->encoding = talloc_strdup(o,
+ argv[c] + sizeof(ARG_ENCODING) - 1);
+ if (o->encoding == NULL) {
+ return NT_STATUS_NO_MEMORY;
+ }
+ } else {
+ o->tdb = talloc_strdup(o, argv[c]);
+ if (o->tdb == NULL) {
+ return NT_STATUS_NO_MEMORY;
+ }
+ }
+ }
+
+ *popts = o;
+ return NT_STATUS_OK;
+}
+
static void dump_form(TALLOC_CTX *mem_ctx,
const char *key_name,
unsigned char *data,
@@ -70,7 +112,8 @@ static void dump_form(TALLOC_CTX *mem_ctx,
static void dump_driver(TALLOC_CTX *mem_ctx,
const char *key_name,
unsigned char *data,
- size_t length)
+ size_t length,
+ bool do_string_conversion)
{
enum ndr_err_code ndr_err;
DATA_BLOB blob;
@@ -83,6 +126,10 @@ static void dump_driver(TALLOC_CTX *mem_ctx,
ZERO_STRUCT(r);
+ if (do_string_conversion) {
+ r.string_flags = LIBNDR_FLAG_STR_ASCII;
+ }
+
ndr_err = ndr_pull_struct_blob(&blob, mem_ctx, &r,
(ndr_pull_flags_fn_t)ndr_pull_ntprinting_driver);
if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
@@ -100,7 +147,8 @@ static void dump_driver(TALLOC_CTX *mem_ctx,
static void dump_printer(TALLOC_CTX *mem_ctx,
const char *key_name,
unsigned char *data,
- size_t length)
+ size_t length,
+ bool do_string_conversion)
{
enum ndr_err_code ndr_err;
DATA_BLOB blob;
@@ -113,6 +161,10 @@ static void dump_printer(TALLOC_CTX *mem_ctx,
ZERO_STRUCT(r);
+ if (do_string_conversion) {
+ r.info.string_flags = LIBNDR_FLAG_STR_ASCII;
+ }
+
ndr_err = ndr_pull_struct_blob(&blob, mem_ctx, &r,
(ndr_pull_flags_fn_t)ndr_pull_ntprinting_printer);
if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
@@ -165,19 +217,43 @@ static int net_printing_dump(struct net_context *c, int argc,
TALLOC_CTX *ctx = talloc_stackframe();
TDB_CONTEXT *tdb;
TDB_DATA kbuf, newkey, dbuf;
+ struct printing_opts *o;
+ const char *save_dos_charset = lp_dos_charset();
+ bool do_string_conversion = false;
+ NTSTATUS status;
if (argc < 1 || c->display_usage) {
- d_fprintf(stderr, "%s\nnet printing dump <file.tdb>\n",
- _("Usage:"));
+ d_printf( "%s\n"
+ "net printing dump [options] <file.tdb>\n"
+ " %s\n",
+ _("Usage:"),
+ _("Dump formated printer information of the tdb."));
+ d_printf(_("Valid options:\n"));
+ d_printf(_(" encoding=<CP> Set the Code Page of the tdb file.\n"
+ " See iconv -l for the list of CP values\n"
+ " (CP1252 is Western latin1, CP1251 is Cyrillic).\n"));
goto done;
}
- tdb = tdb_open_log(argv[0], 0, TDB_DEFAULT, O_RDONLY, 0600);
+ status = printing_parse_args(ctx, &o, argc, argv);
+ if (!NT_STATUS_IS_OK(status)) {
+ d_fprintf(stderr, _("failed to parse arguments\n"));
+ goto done;
+ }
+
+ tdb = tdb_open_log(o->tdb, 0, TDB_DEFAULT, O_RDONLY, 0600);
if (!tdb) {
- d_fprintf(stderr, _("failed to open tdb file: %s\n"), argv[0]);
+ d_fprintf(stderr, _("failed to open tdb file: %s\n"), o->tdb);
goto done;
}
+ if (o->encoding != NULL) {
+ lp_set_cmdline("dos charset", o->encoding);
+ d_fprintf(stderr, _("do string conversion from %s to %s\n"),
+ lp_dos_charset(), lp_unix_charset());
+ do_string_conversion = true;
+ }
+
for (kbuf = tdb_firstkey(tdb);
kbuf.dptr;
newkey = tdb_nextkey(tdb, kbuf), free(kbuf.dptr), kbuf=newkey)
@@ -194,13 +270,21 @@ static int net_printing_dump(struct net_context *c, int argc,
}
if (strncmp((const char *)kbuf.dptr, DRIVERS_PREFIX, strlen(DRIVERS_PREFIX)) == 0) {
- dump_driver(ctx, (const char *)kbuf.dptr+strlen(DRIVERS_PREFIX), dbuf.dptr, dbuf.dsize);
+ dump_driver(ctx,
+ (const char *)kbuf.dptr+strlen(DRIVERS_PREFIX),
+ dbuf.dptr,
+ dbuf.dsize,
+ do_string_conversion);
SAFE_FREE(dbuf.dptr);
continue;
}
if (strncmp((const char *)kbuf.dptr, PRINTERS_PREFIX, strlen(PRINTERS_PREFIX)) == 0) {
- dump_printer(ctx, (const char *)kbuf.dptr+strlen(PRINTERS_PREFIX), dbuf.dptr, dbuf.dsize);
+ dump_printer(ctx,
+ (const char *)kbuf.dptr+strlen(PRINTERS_PREFIX),
+ dbuf.dptr,
+ dbuf.dsize,
+ do_string_conversion);
SAFE_FREE(dbuf.dptr);
continue;
}
@@ -216,6 +300,7 @@ static int net_printing_dump(struct net_context *c, int argc,
ret = 0;
done:
+ lp_set_cmdline("dos charset", save_dos_charset);
talloc_free(ctx);
return ret;
}
@@ -229,23 +314,39 @@ static NTSTATUS printing_migrate_internal(struct net_context *c,
int argc,
const char **argv)
{
+ struct printing_opts *o;
TALLOC_CTX *tmp_ctx;
TDB_CONTEXT *tdb;
TDB_DATA kbuf, newkey, dbuf;
NTSTATUS status;
+ const char *save_dos_charset = lp_dos_charset();
+ bool do_string_conversion = false;
tmp_ctx = talloc_new(mem_ctx);
if (tmp_ctx == NULL) {
return NT_STATUS_NO_MEMORY;
}
- tdb = tdb_open_log(argv[0], 0, TDB_DEFAULT, O_RDONLY, 0600);
+ status = printing_parse_args(tmp_ctx, &o, argc, argv);
+ if (!NT_STATUS_IS_OK(status)) {
+ d_fprintf(stderr, _("failed to parse arguments\n"));
+ goto done;
+ }
+
+ tdb = tdb_open_log(o->tdb, 0, TDB_DEFAULT, O_RDONLY, 0600);
if (tdb == NULL) {
- d_fprintf(stderr, _("failed to open tdb file: %s\n"), argv[0]);
+ d_fprintf(stderr, _("failed to open tdb file: %s\n"), o->tdb);
status = NT_STATUS_NO_SUCH_FILE;
goto done;
}
+ if (o->encoding != NULL) {
+ lp_set_cmdline("dos charset", o->encoding);
+ d_fprintf(stderr, _("do string conversion from %s to %s\n"),
+ lp_dos_charset(), lp_unix_charset());
+ do_string_conversion = true;
+ }
+
for (kbuf = tdb_firstkey(tdb);
kbuf.dptr;
newkey = tdb_nextkey(tdb, kbuf), free(kbuf.dptr), kbuf = newkey)
@@ -270,7 +371,8 @@ static NTSTATUS printing_migrate_internal(struct net_context *c,
winreg_pipe,
(const char *) kbuf.dptr + strlen(DRIVERS_PREFIX),
dbuf.dptr,
- dbuf.dsize);
+ dbuf.dsize,
+ do_string_conversion);
SAFE_FREE(dbuf.dptr);
continue;
}
@@ -280,7 +382,8 @@ static NTSTATUS printing_migrate_internal(struct net_context *c,
winreg_pipe,
(const char *) kbuf.dptr + strlen(PRINTERS_PREFIX),
dbuf.dptr,
- dbuf.dsize);
+ dbuf.dsize,
+ do_string_conversion);
SAFE_FREE(dbuf.dptr);
continue;
}
@@ -312,6 +415,7 @@ static NTSTATUS printing_migrate_internal(struct net_context *c,
status = NT_STATUS_OK;
done:
+ lp_set_cmdline("dos charset", save_dos_charset);
talloc_free(tmp_ctx);
return status;
}
@@ -322,10 +426,14 @@ static int net_printing_migrate(struct net_context *c,
{
if (argc < 1 || c->display_usage) {
d_printf( "%s\n"
- "net printing migrate <file.tdb>\n"
+ "net printing migrate [options] <file.tdb>\n"
" %s\n",
_("Usage:"),
_("Migrate tdb printing files to new storage"));
+ d_printf(_("Valid options:\n"));
+ d_printf(_(" encoding=<CP> Set the Code Page of the tdb file.\n"
+ " See iconv -l for the list of CP values\n"
+ " (CP1252 is Western latin1, CP1251 is Cyrillic).\n"));
return 0;
}
diff --git a/source3/winbindd/winbindd_cache.c b/source3/winbindd/winbindd_cache.c
index 81b9b1799b..033ea770db 100644
--- a/source3/winbindd/winbindd_cache.c
+++ b/source3/winbindd/winbindd_cache.c
@@ -945,6 +945,15 @@ static void wcache_save_name_to_sid(struct winbindd_domain *domain,
centry = centry_start(domain, status);
if (!centry)
return;
+
+ if (domain_name[0] == '\0') {
+ struct winbindd_domain *mydomain =
+ find_domain_from_sid_noinit(sid);
+ if (mydomain != NULL) {
+ domain_name = mydomain->name;
+ }
+ }
+
centry_put_uint32(centry, type);
centry_put_sid(centry, sid);
fstrcpy(uname, name);
@@ -965,6 +974,14 @@ static void wcache_save_sid_to_name(struct winbindd_domain *domain, NTSTATUS sta
if (!centry)
return;
+ if (domain_name[0] == '\0') {
+ struct winbindd_domain *mydomain =
+ find_domain_from_sid_noinit(sid);
+ if (mydomain != NULL) {
+ domain_name = mydomain->name;
+ }
+ }
+
if (NT_STATUS_IS_OK(status)) {
centry_put_uint32(centry, type);
centry_put_string(centry, domain_name);
@@ -1781,6 +1798,10 @@ NTSTATUS wcache_name_to_sid(struct winbindd_domain *domain,
return NT_STATUS_NO_MEMORY;
}
+ if (domain_name[0] == '\0') {
+ domain_name = domain->name;
+ }
+
centry = wcache_fetch(cache, domain, "NS/%s/%s", domain_name, uname);
TALLOC_FREE(uname);
if (centry == NULL) {
diff --git a/source4/torture/ndr/ntprinting.c b/source4/torture/ndr/ntprinting.c
index 44ad86b7ac..3ff9cb12ee 100644
--- a/source4/torture/ndr/ntprinting.c
+++ b/source4/torture/ndr/ntprinting.c
@@ -22,6 +22,7 @@
#include "torture/ndr/ndr.h"
#include "librpc/gen_ndr/ndr_ntprinting.h"
#include "torture/ndr/proto.h"
+#include "param/param.h"
static const uint8_t ntprinting_printer_data[] = {
0x48, 0x10, 0x08, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
@@ -296,6 +297,170 @@ static const uint8_t ntprinting_printer_data[] = {
0x00, 0x00, 0x00, 0x00, 0x00
};
+static const uint8_t ntprinting_printer_data_latin1[] = {
+ 0x48, 0x1a, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x94, 0x46, 0x50, 0x0e, 0x00, 0x00, 0x00, 0x00,
+ 0x94, 0xee, 0xb9, 0x50, 0x00, 0x53, 0x30, 0x42,
+ 0x43, 0x00, 0x53, 0x30, 0x42, 0x43, 0x00, 0x53,
+ 0x61, 0x6d, 0x62, 0x61, 0x20, 0x50, 0x72, 0x69,
+ 0x6e, 0x74, 0x65, 0x72, 0x20, 0x50, 0x6f, 0x72,
+ 0x74, 0x00, 0x48, 0x50, 0x20, 0x44, 0x65, 0x73,
+ 0x69, 0x67, 0x6e, 0x6a, 0x65, 0x74, 0x20, 0x38,
+ 0x30, 0x30, 0x50, 0x53, 0x20, 0x34, 0x32, 0x20,
+ 0x62, 0x79, 0x20, 0x48, 0x50, 0x00, 0x22, 0x20,
+ 0x53, 0x41, 0x4c, 0x41, 0x20, 0x44, 0x41, 0x20,
+ 0x52, 0x45, 0x43, 0x45, 0x50, 0xc7, 0xc3, 0x4f,
+ 0x20, 0x44, 0x41, 0x20, 0x43, 0x4f, 0x4e, 0x53,
+ 0x54, 0x52, 0x55, 0xc7, 0xc3, 0x4f, 0x20, 0x2d,
+ 0x20, 0x52, 0x41, 0x4e, 0x44, 0x30, 0x20, 0x4c,
+ 0x4f, 0x43, 0x41, 0x54, 0x49, 0x4f, 0x00, 0x55,
+ 0x54, 0x47, 0x43, 0x41, 0x20, 0x00, 0x00, 0x77,
+ 0x69, 0x6e, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x00,
+ 0x52, 0x41, 0x57, 0x00, 0x00, 0x01, 0x00, 0x00,
+ 0x00, 0x5c, 0x5c, 0x4c, 0x4f, 0x43, 0x41, 0x4c,
+ 0x48, 0x4f, 0x53, 0x54, 0x5c, 0x53, 0x30, 0x42,
+ 0x43, 0x00, 0x4c, 0x65, 0x74, 0x74, 0x65, 0x72,
+ 0x00, 0x01, 0x04, 0x00, 0x04, 0xdc, 0x00, 0x00,
+ 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x64, 0x00, 0x01, 0x00, 0x0f, 0x00, 0xfc,
+ 0xff, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x13, 0x47, 0x01,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x01, 0x00, 0x00, 0x00, 0x50, 0x72, 0x69,
+ 0x6e, 0x74, 0x65, 0x72, 0x44, 0x72, 0x69, 0x76,
+ 0x65, 0x72, 0x44, 0x61, 0x74, 0x61, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
+ 0x00, 0x00, 0x00, 0x50, 0x72, 0x69, 0x6e, 0x74,
+ 0x65, 0x72, 0x44, 0x72, 0x69, 0x76, 0x65, 0x72,
+ 0x44, 0x61, 0x74, 0x61, 0x5c, 0x44, 0x72, 0x76,
+ 0x50, 0x61, 0x70, 0x65, 0x72, 0x53, 0x74, 0x61,
+ 0x6e, 0x64, 0x61, 0x72, 0x64, 0x73, 0x00, 0x04,
+ 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x61,
+ 0xc2, 0x00, 0xc0, 0x01, 0x00, 0x00, 0x00, 0x50,
+ 0x72, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x44, 0x72,
+ 0x69, 0x76, 0x65, 0x72, 0x44, 0x61, 0x74, 0x61,
+ 0x5c, 0x44, 0x72, 0x76, 0x44, 0x65, 0x76, 0x4d,
+ 0x6f, 0x64, 0x65, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x42, 0x02, 0x00, 0x00, 0x31, 0x00, 0x3b, 0x00,
+ 0x31, 0x00, 0x3b, 0x00, 0x32, 0x00, 0x36, 0x00,
+ 0x36, 0x00, 0x3b, 0x00, 0x2d, 0x00, 0x33, 0x00,
+ 0x3b, 0x00, 0x31, 0x00, 0x3b, 0x00, 0x31, 0x00,
+ 0x30, 0x00, 0x3b, 0x00, 0x30, 0x00, 0x3b, 0x00,
+ 0x30, 0x00, 0x3b, 0x00, 0x31, 0x00, 0x3b, 0x00,
+ 0x31, 0x00, 0x30, 0x00, 0x37, 0x00, 0x33, 0x00,
+ 0x37, 0x00, 0x34, 0x00, 0x31, 0x00, 0x39, 0x00,
+ 0x30, 0x00, 0x35, 0x00, 0x3b, 0x00, 0x30, 0x00,
+ 0x3b, 0x00, 0x30, 0x00, 0x3b, 0x00, 0x30, 0x00,
+ 0x3b, 0x00, 0x31, 0x00, 0x3b, 0x00, 0x35, 0x00,
+ 0x30, 0x00, 0x3b, 0x00, 0x34, 0x00, 0x3b, 0x00,
+ 0x35, 0x00, 0x3b, 0x00, 0x30, 0x00, 0x3b, 0x00,
+ 0x32, 0x00, 0x30, 0x00, 0x30, 0x00, 0x3b, 0x00,
+ 0x30, 0x00, 0x3b, 0x00, 0x30, 0x00, 0x3b, 0x00,
+ 0x30, 0x00, 0x3b, 0x00, 0x30, 0x00, 0x3b, 0x00,
+ 0x32, 0x00, 0x3b, 0x00, 0x32, 0x00, 0x3b, 0x00,
+ 0x32, 0x00, 0x3b, 0x00, 0x31, 0x00, 0x3b, 0x00,
+ 0x31, 0x00, 0x3b, 0x00, 0x31, 0x00, 0x3b, 0x00,
+ 0x30, 0x00, 0x3b, 0x00, 0x32, 0x00, 0x36, 0x00,
+ 0x32, 0x00, 0x3b, 0x00, 0x31, 0x00, 0x30, 0x00,
+ 0x30, 0x00, 0x3b, 0x00, 0x31, 0x00, 0x36, 0x00,
+ 0x37, 0x00, 0x37, 0x00, 0x37, 0x00, 0x32, 0x00,
+ 0x31, 0x00, 0x36, 0x00, 0x3b, 0x00, 0x30, 0x00,
+ 0x3b, 0x00, 0x31, 0x00, 0x3b, 0x00, 0x30, 0x00,
+ 0x3b, 0x00, 0x31, 0x00, 0x36, 0x00, 0x3b, 0x00,
+ 0x32, 0x00, 0x31, 0x00, 0x3b, 0x00, 0x32, 0x00,
+ 0x30, 0x00, 0x3b, 0x00, 0x31, 0x00, 0x3b, 0x00,
+ 0x31, 0x00, 0x3b, 0x00, 0x30, 0x00, 0x3b, 0x00,
+ 0x30, 0x00, 0x3b, 0x00, 0x30, 0x00, 0x3b, 0x00,
+ 0x30, 0x00, 0x3b, 0x00, 0x31, 0x00, 0x3b, 0x00,
+ 0x31, 0x00, 0x3b, 0x00, 0x30, 0x00, 0x3b, 0x00,
+ 0x34, 0x00, 0x3b, 0x00, 0x36, 0x00, 0x35, 0x00,
+ 0x35, 0x00, 0x33, 0x00, 0x35, 0x00, 0x3b, 0x00,
+ 0x32, 0x00, 0x36, 0x00, 0x33, 0x00, 0x31, 0x00,
+ 0x37, 0x00, 0x32, 0x00, 0x3b, 0x00, 0x30, 0x00,
+ 0x3b, 0x00, 0x30, 0x00, 0x3b, 0x00, 0x31, 0x00,
+ 0x3b, 0x00, 0x30, 0x00, 0x3b, 0x00, 0x37, 0x00,
+ 0x3b, 0x00, 0x31, 0x00, 0x30, 0x00, 0x32, 0x00,
+ 0x37, 0x00, 0x3b, 0x00, 0x31, 0x00, 0x3b, 0x00,
+ 0x30, 0x00, 0x3b, 0x00, 0x32, 0x00, 0x3b, 0x00,
+ 0x31, 0x00, 0x3b, 0x00, 0x32, 0x00, 0x31, 0x00,
+ 0x35, 0x00, 0x39, 0x00, 0x3b, 0x00, 0x32, 0x00,
+ 0x37, 0x00, 0x39, 0x00, 0x34, 0x00, 0x3b, 0x00,
+ 0x32, 0x00, 0x31, 0x00, 0x35, 0x00, 0x39, 0x00,
+ 0x3b, 0x00, 0x32, 0x00, 0x37, 0x00, 0x39, 0x00,
+ 0x34, 0x00, 0x3b, 0x00, 0x32, 0x00, 0x31, 0x00,
+ 0x35, 0x00, 0x39, 0x00, 0x3b, 0x00, 0x32, 0x00,
+ 0x37, 0x00, 0x39, 0x00, 0x34, 0x00, 0x3b, 0x00,
+ 0x32, 0x00, 0x31, 0x00, 0x35, 0x00, 0x39, 0x00,
+ 0x3b, 0x00, 0x32, 0x00, 0x37, 0x00, 0x39, 0x00,
+ 0x34, 0x00, 0x3b, 0x00, 0x32, 0x00, 0x31, 0x00,
+ 0x35, 0x00, 0x39, 0x00, 0x3b, 0x00, 0x32, 0x00,
+ 0x37, 0x00, 0x39, 0x00, 0x34, 0x00, 0x3b, 0x00,
+ 0x32, 0x00, 0x31, 0x00, 0x35, 0x00, 0x39, 0x00,
+ 0x3b, 0x00, 0x32, 0x00, 0x37, 0x00, 0x39, 0x00,
+ 0x34, 0x00, 0x3b, 0x00, 0x32, 0x00, 0x31, 0x00,
+ 0x35, 0x00, 0x39, 0x00, 0x3b, 0x00, 0x32, 0x00,
+ 0x37, 0x00, 0x39, 0x00, 0x34, 0x00, 0x3b, 0x00,
+ 0x32, 0x00, 0x31, 0x00, 0x35, 0x00, 0x39, 0x00,
+ 0x3b, 0x00, 0x32, 0x00, 0x37, 0x00, 0x39, 0x00,
+ 0x34, 0x00, 0x3b, 0x00, 0x32, 0x00, 0x31, 0x00,
+ 0x35, 0x00, 0x39, 0x00, 0x3b, 0x00, 0x32, 0x00,
+ 0x37, 0x00, 0x39, 0x00, 0x34, 0x00, 0x3b, 0x00,
+ 0x32, 0x00, 0x31, 0x00, 0x35, 0x00, 0x39, 0x00,
+ 0x3b, 0x00, 0x32, 0x00, 0x37, 0x00, 0x39, 0x00,
+ 0x34, 0x00, 0x3b, 0x00, 0x30, 0x00, 0x3b, 0x00,
+ 0x3b, 0x00, 0x3b, 0x00, 0x3b, 0x00, 0x3b, 0x00,
+ 0x3b, 0x00, 0x31, 0x00, 0x30, 0x00, 0x30, 0x00,
+ 0x3b, 0x00, 0x31, 0x00, 0x30, 0x00, 0x30, 0x00,
+ 0x3b, 0x00, 0x31, 0x00, 0x30, 0x00, 0x30, 0x00,
+ 0x3b, 0x00, 0x30, 0x00, 0x3b, 0x00, 0x30, 0x00,
+ 0x3b, 0x00, 0x3b, 0x00, 0x00, 0x00, 0x01, 0x00,
+ 0x00, 0x00, 0x50, 0x72, 0x69, 0x6e, 0x74, 0x65,
+ 0x72, 0x44, 0x72, 0x69, 0x76, 0x65, 0x72, 0x44,
+ 0x61, 0x74, 0x61, 0x5c, 0x44, 0x72, 0x76, 0x45,
+ 0x57, 0x53, 0x49, 0x50, 0x00, 0x01, 0x00, 0x00,
+ 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
+ 0x00, 0x00, 0x00, 0x44, 0x73, 0x53, 0x70, 0x6f,
+ 0x6f, 0x6c, 0x65, 0x72, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
+ 0x00, 0x44, 0x73, 0x53, 0x70, 0x6f, 0x6f, 0x6c,
+ 0x65, 0x72, 0x5c, 0x70, 0x72, 0x69, 0x6e, 0x74,
+ 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x00, 0x01,
+ 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x53,
+ 0x00, 0x30, 0x00, 0x42, 0x00, 0x43, 0x00, 0x00,
+ 0x00, 0x01, 0x00, 0x00, 0x00, 0x44, 0x73, 0x53,
+ 0x70, 0x6f, 0x6f, 0x6c, 0x65, 0x72, 0x5c, 0x73,
+ 0x65, 0x72, 0x76, 0x65, 0x72, 0x4e, 0x61, 0x6d,
+ 0x65, 0x00, 0x01, 0x00, 0x00, 0x00, 0x14, 0x00,
+ 0x00, 0x00, 0x53, 0x00, 0x36, 0x00, 0x30, 0x00,
+ 0x32, 0x00, 0x30, 0x00, 0x50, 0x00, 0x53, 0x00,
+ 0x36, 0x00, 0x36, 0x00, 0x00, 0x00, 0x01, 0x00,
+ 0x00, 0x00, 0x44, 0x73, 0x53, 0x70, 0x6f, 0x6f,
+ 0x6c, 0x65, 0x72, 0x5c, 0x73, 0x68, 0x6f, 0x72,
+ 0x74, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x4e,
+ 0x61, 0x6d, 0x65, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0x53, 0x00, 0x36, 0x00,
+ 0x30, 0x00, 0x32, 0x00, 0x30, 0x00, 0x50, 0x00,
+ 0x53, 0x00, 0x36, 0x00, 0x36, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x44, 0x73, 0x53, 0x70,
+ 0x6f, 0x6f, 0x6c, 0x65, 0x72, 0x5c, 0x75, 0x4e,
+ 0x43, 0x4e, 0x61, 0x6d, 0x65, 0x00, 0x01, 0x00,
+ 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x5c, 0x00,
+ 0x5c, 0x00, 0x53, 0x00, 0x36, 0x00, 0x30, 0x00,
+ 0x32, 0x00, 0x30, 0x00, 0x50, 0x00, 0x53, 0x00,
+ 0x36, 0x00, 0x36, 0x00, 0x5c, 0x00, 0x53, 0x00,
+ 0x30, 0x00, 0x42, 0x00, 0x43, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00
+};
+
static bool ntprinting_printer_check(struct torture_context *tctx,
struct ntprinting_printer *r)
{
@@ -421,10 +586,62 @@ static bool ntprinting_printer_check(struct torture_context *tctx,
return true;
}
+static bool ntprinting_printer_latin1_check(struct torture_context *tctx)
+{
+ enum ndr_err_code ndr_err;
+ struct ntprinting_printer r;
+ DATA_BLOB blob;
+ bool ok;
+
+ ok = lpcfg_do_global_parameter(tctx->lp_ctx, "dos charset", "CP1252");
+ if (!ok) {
+ torture_comment(tctx, "Could not set 'dos charset' option.\n");
+ return false;
+ }
+ reload_charcnv(tctx->lp_ctx);
+
+ ZERO_STRUCT(r);
+ r.info.string_flags = LIBNDR_FLAG_STR_ASCII;
+
+ blob = data_blob_const(ntprinting_printer_data_latin1,
+ sizeof(ntprinting_printer_data_latin1));
+
+ ndr_err = ndr_pull_struct_blob(&blob, tctx, &r,
+ (ndr_pull_flags_fn_t)ndr_pull_ntprinting_printer);
+
+ torture_assert_ndr_success(tctx,
+ ndr_err,
+ "ndr_pull_ntprinting_printer");
+#if 0
+ ndr_print_debug((ndr_print_fn_t) ndr_print_ntprinting_printer,
+ "ntprinter",
+ &r);
+#endif
+ torture_assert_str_equal(tctx,
+ r.info.printername,
+ "S0BC",
+ "printername");
+ /* latin1 encoding check */
+ torture_assert_str_equal(tctx,
+ r.info.comment,
+ "\" SALA DA RECEPÇÃO DA CONSTRUÇÃO - RAND0 LOCATIO",
+ "comment");
+ torture_assert_str_equal(tctx,
+ r.info.location,
+ "UTGCA ",
+ "location");
+
+ return true;
+}
+
struct torture_suite *ndr_ntprinting_suite(TALLOC_CTX *ctx)
{
struct torture_suite *suite = torture_suite_create(ctx, "ntprinting");
+ torture_suite_add_simple_test(suite,
+ "ntprinting latin1 check",
+ ntprinting_printer_latin1_check);
+
torture_suite_add_ndr_pull_test(suite,
ntprinting_printer,
ntprinting_printer_data,