Update to Samba 4.8.2

Guenther
This commit is contained in:
Günther Deschner 2018-05-16 16:45:45 +02:00
parent afb4bfc6f4
commit d737df5458
4 changed files with 9 additions and 234 deletions

2
.gitignore vendored
View File

@ -123,3 +123,5 @@ samba-3.6.0pre1.tar.gz
/samba-4.8.0.tar.asc /samba-4.8.0.tar.asc
/samba-4.8.1.tar.xz /samba-4.8.1.tar.xz
/samba-4.8.1.tar.asc /samba-4.8.1.tar.asc
/samba-4.8.2.tar.xz
/samba-4.8.2.tar.asc

View File

@ -1,228 +0,0 @@
From ae206fe3027873138d36240b3be8bc582ab0aac6 Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn@samba.org>
Date: Fri, 5 Jan 2018 10:50:57 +0100
Subject: [PATCH 1/2] smbspool: Improve URI handling code
This also checks that the URI given via the environment variables
starts with smb://
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
Reviewed-by: David Disseldorp <ddiss@samba.org>
(cherry picked from commit a6eac8f64989235e7a297c14e349d98a3fc70e47)
---
source3/client/smbspool.c | 29 ++++++++++++++++++-----------
1 file changed, 18 insertions(+), 11 deletions(-)
diff --git a/source3/client/smbspool.c b/source3/client/smbspool.c
index 3b732c99234..ff32baea204 100644
--- a/source3/client/smbspool.c
+++ b/source3/client/smbspool.c
@@ -100,6 +100,8 @@ main(int argc, /* I - Number of command-line arguments */
const char *dev_uri;
const char *config_file = NULL;
TALLOC_CTX *frame = talloc_stackframe();
+ int cmp;
+ int len;
null_str[0] = '\0';
@@ -155,20 +157,25 @@ main(int argc, /* I - Number of command-line arguments */
}
/*
- * Find the URI...
- */
-
+ * Find the URI ...
+ */
dev_uri = getenv("DEVICE_URI");
- if (dev_uri) {
- strncpy(uri, dev_uri, sizeof(uri) - 1);
- } else if (strncmp(argv[1], "smb://", 6) == 0) {
- strncpy(uri, argv[1], sizeof(uri) - 1);
- } else {
- fputs("ERROR: No device URI found in DEVICE_URI environment variable or arg1 !\n", stderr);
- goto done;
+ if (dev_uri == NULL || strlen(dev_uri) == 0) {
+ dev_uri = argv[1];
}
- uri[sizeof(uri) - 1] = '\0';
+ cmp = strncmp(dev_uri, "smb://", 6);
+ if (cmp != 0) {
+ fprintf(stderr,
+ "ERROR: No valid device URI has been specified\n");
+ goto done;
+ }
+ len = snprintf(uri, sizeof(uri), "%s", dev_uri);
+ if (len >= sizeof(uri)) {
+ fprintf(stderr,
+ "ERROR: The URI is too long.\n");
+ goto done;
+ }
/*
* Extract the destination from the URI...
--
2.16.3
From c19801fa6551c601ec3e7f5a983f2bc1a9bc6597 Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn@samba.org>
Date: Thu, 3 May 2018 10:17:12 +0200
Subject: [PATCH 2/2] s3:smbspool: Fix cmdline argument handling
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13417
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
(cherry picked from commit a753ccfd946aaad320977ae8c5f483f73077c3f8)
---
source3/client/smbspool.c | 61 ++++++++++++++++++++++++-----------
source3/script/tests/test_smbspool.sh | 30 +++++++++++++++++
2 files changed, 72 insertions(+), 19 deletions(-)
diff --git a/source3/client/smbspool.c b/source3/client/smbspool.c
index ff32baea204..d6e944d547c 100644
--- a/source3/client/smbspool.c
+++ b/source3/client/smbspool.c
@@ -100,6 +100,9 @@ main(int argc, /* I - Number of command-line arguments */
const char *dev_uri;
const char *config_file = NULL;
TALLOC_CTX *frame = talloc_stackframe();
+ bool device_uri_cmdline = false;
+ const char *print_file = NULL;
+ const char *print_copies = NULL;
int cmp;
int len;
@@ -119,7 +122,12 @@ main(int argc, /* I - Number of command-line arguments */
goto done;
}
- if (argc < 7 || argc > 8) {
+ /*
+ * We need at least 5 options if the DEVICE_URI is passed via an env
+ * variable and printing data comes via stdin.
+ * We don't accept more than 7 options in total, including optional.
+ */
+ if (argc < 5 || argc > 8) {
fprintf(stderr,
"Usage: %s [DEVICE_URI] job-id user title copies options [file]\n"
" The DEVICE_URI environment variable can also contain the\n"
@@ -131,37 +139,52 @@ main(int argc, /* I - Number of command-line arguments */
}
/*
- * If we have 7 arguments, print the file named on the command-line.
- * Otherwise, print data from stdin...
- */
-
+ * If we have 6 arguments find out if we have the device_uri from the
+ * command line or the print data
+ */
if (argc == 7) {
- /*
- * Print from Copy stdin to a temporary file...
- */
+ cmp = strncmp(argv[1], "smb://", 6);
+ if (cmp == 0) {
+ device_uri_cmdline = true;
+ } else {
+ print_copies = argv[4];
+ print_file = argv[6];
+ }
+ } else if (argc == 8) {
+ device_uri_cmdline = true;
+ print_copies = argv[5];
+ print_file = argv[7];
+ }
- fp = stdin;
- copies = 1;
- } else if ((fp = fopen(argv[7], "rb")) == NULL) {
- perror("ERROR: Unable to open print file");
- goto done;
- } else {
- char *p = argv[5];
+ if (print_file != NULL) {
char *endp;
- copies = strtol(p, &endp, 10);
- if (p == endp) {
+ fp = fopen(print_file, "rb");
+ if (fp == NULL) {
+ perror("ERROR: Unable to open print file");
+ goto done;
+ }
+
+ copies = strtol(print_copies, &endp, 10);
+ if (print_copies == endp) {
perror("ERROR: Unable to determine number of copies");
goto done;
}
+ } else {
+ fp = stdin;
+ copies = 1;
}
/*
* Find the URI ...
*/
- dev_uri = getenv("DEVICE_URI");
- if (dev_uri == NULL || strlen(dev_uri) == 0) {
+ if (device_uri_cmdline) {
dev_uri = argv[1];
+ } else {
+ dev_uri = getenv("DEVICE_URI");
+ if (dev_uri == NULL || strlen(dev_uri) == 0) {
+ dev_uri = "";
+ }
}
cmp = strncmp(dev_uri, "smb://", 6);
diff --git a/source3/script/tests/test_smbspool.sh b/source3/script/tests/test_smbspool.sh
index 8f9426f87ba..899b34d0e40 100755
--- a/source3/script/tests/test_smbspool.sh
+++ b/source3/script/tests/test_smbspool.sh
@@ -135,6 +135,36 @@ testit "smbspool print example.ps" \
$samba_smbspool smb://$USERNAME:$PASSWORD@$SERVER_IP/print1 200 $USERNAME "Testprint" 1 "options" $SRCDIR/testdata/printing/example.ps || \
failed=$(expr $failed + 1)
+testit "vlp verify example.ps" \
+ test_vlp_verify \
+ || failed=$(expr $failed + 1)
+
+testit "smbspool print example.ps via stdin" \
+ $samba_smbspool smb://$USERNAME:$PASSWORD@$SERVER_IP/print1 200 $USERNAME "Testprint" 1 "options" < $SRCDIR/testdata/printing/example.ps || \
+ failed=$(expr $failed + 1)
+
+testit "vlp verify example.ps" \
+ test_vlp_verify \
+ || failed=$(expr $failed + 1)
+
+DEVICE_URI="smb://$USERNAME:$PASSWORD@$SERVER_IP/print1"
+export DEVICE_URI
+testit "smbspool print DEVICE_URI example.ps" \
+ $samba_smbspool 200 $USERNAME "Testprint" 1 "options" $SRCDIR/testdata/printing/example.ps || \
+ failed=$(expr $failed + 1)
+unset DEVICE_URI
+
+testit "vlp verify example.ps" \
+ test_vlp_verify \
+ || failed=$(expr $failed + 1)
+
+DEVICE_URI="smb://$USERNAME:$PASSWORD@$SERVER_IP/print1"
+export DEVICE_URI
+testit "smbspool print DEVICE_URI example.ps via stdin" \
+ $samba_smbspool 200 $USERNAME "Testprint" 1 "options" < $SRCDIR/testdata/printing/example.ps || \
+ failed=$(expr $failed + 1)
+unset DEVICE_URI
+
testit "vlp verify example.ps" \
test_vlp_verify \
|| failed=$(expr $failed + 1)
--
2.16.3

View File

@ -8,11 +8,11 @@
%define main_release 1 %define main_release 1
%define samba_version 4.8.1 %define samba_version 4.8.2
%define talloc_version 2.1.11 %define talloc_version 2.1.11
%define tdb_version 1.3.15 %define tdb_version 1.3.15
%define tevent_version 0.9.36 %define tevent_version 0.9.36
%define ldb_version 1.3.2 %define ldb_version 1.3.3
# This should be rc1 or nil # This should be rc1 or nil
%define pre_release %nil %define pre_release %nil
@ -122,8 +122,6 @@ Source14: samba.pamd
Source200: README.dc Source200: README.dc
Source201: README.downgrade Source201: README.downgrade
Patch0: samba-4.8.2-fix_smbspool_cmdline.patch
Requires(pre): /usr/sbin/groupadd Requires(pre): /usr/sbin/groupadd
Requires(post): systemd Requires(post): systemd
Requires(preun): systemd Requires(preun): systemd
@ -3553,6 +3551,9 @@ fi
%endif # with_clustering_support %endif # with_clustering_support
%changelog %changelog
* Wed May 16 2018 Guenther Deschner <gdeschner@redhat.com> - 4.8.2-0
- Update to Samba 4.8.2
* Wed May 09 2018 Andreas Schneider <asn@redhat.com> - 4.8.1-1 * Wed May 09 2018 Andreas Schneider <asn@redhat.com> - 4.8.1-1
- resolves: #1574177 - Fix smbspool command line argument handling - resolves: #1574177 - Fix smbspool command line argument handling

View File

@ -1,2 +1,2 @@
SHA512 (samba-4.8.1.tar.xz) = fa65631ad32f415bcfea10e2946117db0aab8c44ebea85b9b57ac9cf67811448a77dc07faba7f8ffe9ea3b5001f6164921e1692c136dcf07f8a7fd42e2992388 SHA512 (samba-4.8.2.tar.xz) = 4557d515789e2f5bfeb2f67d98c479ac26d2aebca286ed50d9103a6edb79a3a1d95049224cd77713e9f3084bc8ea4800629fb19d761ae96eb1bc4c77d7d5b10c
SHA512 (samba-4.8.1.tar.asc) = 97e9c972c958ee0072350a724b70766fe1aec1ad35fccb2ba48cf14ebbd32052c17e859a6efb45b124629a8fee024f5d26a7f570fb936576e714daaef904e48b SHA512 (samba-4.8.2.tar.asc) = c78ced882897188c74380cc2ff4b2c575d59c28e9eab52330a7dfef029247a814c2df5f4a18920867e54ac49c4ad984093b0068bbc6e870f9fa061a0a6b80595