summaryrefslogtreecommitdiff
path: root/source4/torture/ndr
diff options
context:
space:
mode:
authorAndreas Schneider <asn@samba.org>2013-03-14 07:29:20 +0100
committerGünther Deschner <gd@samba.org>2013-03-15 12:11:03 +0100
commit56328c0ccbb8b9ff7726d0ff2262841a1ba8e0d3 (patch)
tree60e484c20f3ba73ea80e413a48f6cf7053a8eeaa /source4/torture/ndr
parentbeea48d7e7d0aced70b185f289d610135290d182 (diff)
downloadsamba-56328c0ccbb8b9ff7726d0ff2262841a1ba8e0d3.tar.gz
samba-56328c0ccbb8b9ff7726d0ff2262841a1ba8e0d3.tar.bz2
samba-56328c0ccbb8b9ff7726d0ff2262841a1ba8e0d3.zip
torture: Add ntprinting latin1 test.
Reviewed-by: Günther Deschner <gd@samba.org>
Diffstat (limited to 'source4/torture/ndr')
-rw-r--r--source4/torture/ndr/ntprinting.c217
1 files changed, 217 insertions, 0 deletions
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,