[SCM] Samba Shared Repository - branch master updated
Alexander Bokovoy
ab at samba.org
Thu May 3 14:34:02 UTC 2018
The branch, master has been updated
via a753ccf s3:smbspool: Fix cmdline argument handling
via 47713d6 vfs_virusfilter_fsav: Initialize stack pointers per README.Coding
via ca387c2 samdb: fix wrong computer container dn for newcomputer
from 8a0c7f3 ldb: Prepare to allow tests to operate on ldb_mdb (by using the GUID index)
https://git.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit a753ccfd946aaad320977ae8c5f483f73077c3f8
Author: Andreas Schneider <asn at samba.org>
Date: Thu May 3 10:17:12 2018 +0200
s3:smbspool: Fix cmdline argument handling
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13417
Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Alexander Bokovoy <ab at samba.org>
Autobuild-User(master): Alexander Bokovoy <ab at samba.org>
Autobuild-Date(master): Thu May 3 16:33:54 CEST 2018 on sn-devel-144
commit 47713d648740cf2d11436ac6bd768c23cf89ca7f
Author: Andrew Bartlett <abartlet at samba.org>
Date: Thu May 3 14:28:02 2018 +1200
vfs_virusfilter_fsav: Initialize stack pointers per README.Coding
This allows a build with --address-sanitizer
Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Alexander Bokovoy <ab at samba.org>
commit ca387c221f97421604346c141a857aba729493e7
Author: Joe Guo <joeg at catalyst.net.nz>
Date: Wed May 2 04:41:04 2018 +0000
samdb: fix wrong computer container dn for newcomputer
CN=Users --> CN=Computers
Signed-off-by: Joe Guo <joeg at catalyst.net.nz>
Reviewed-by: Alexander Bokovoy <ab at samba.org>
Reviewed-by: Rowland Penny <rpenny at samba.org>
-----------------------------------------------------------------------
Summary of changes:
python/samba/samdb.py | 2 +-
source3/client/smbspool.c | 61 +++++++++++++++++++++++-----------
source3/modules/vfs_virusfilter_fsav.c | 2 +-
source3/script/tests/test_smbspool.sh | 30 +++++++++++++++++
4 files changed, 74 insertions(+), 21 deletions(-)
Changeset truncated at 500 lines:
diff --git a/python/samba/samdb.py b/python/samba/samdb.py
index b66afb7..424a648 100644
--- a/python/samba/samdb.py
+++ b/python/samba/samdb.py
@@ -508,7 +508,7 @@ member: %s
raise Exception('Illegal computername "%s"' % computername)
samaccountname = "%s$" % cn
- computercontainer_dn = "CN=Users,%s" % self.domain_dn()
+ computercontainer_dn = "CN=Computers,%s" % self.domain_dn()
if computerou:
computercontainer_dn = self.normalize_dn_in_domain(computerou)
diff --git a/source3/client/smbspool.c b/source3/client/smbspool.c
index 3660319..389e4ea 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;
@@ -117,7 +120,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"
@@ -129,37 +137,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/modules/vfs_virusfilter_fsav.c b/source3/modules/vfs_virusfilter_fsav.c
index 2b874d7..bd22ee5 100644
--- a/source3/modules/vfs_virusfilter_fsav.c
+++ b/source3/modules/vfs_virusfilter_fsav.c
@@ -307,7 +307,7 @@ static virusfilter_result virusfilter_fsav_scan(
virusfilter_result result = VIRUSFILTER_RESULT_CLEAN;
char *report = NULL;
char *reply = NULL;
- char *reply_token, *reply_saveptr;
+ char *reply_token = NULL, *reply_saveptr = NULL;
bool ok;
DBG_INFO("Scanning file: %s/%s\n", cwd_fname, fname);
diff --git a/source3/script/tests/test_smbspool.sh b/source3/script/tests/test_smbspool.sh
index 8f9426f..899b34d 100755
--- a/source3/script/tests/test_smbspool.sh
+++ b/source3/script/tests/test_smbspool.sh
@@ -139,6 +139,36 @@ 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)
+
AUTH_INFO_REQUIRED="username,password"
export AUTH_INFO_REQUIRED
testit "smbspool_krb5(username,password) print example.ps" \
--
Samba Shared Repository
More information about the samba-cvs
mailing list