[SCM] Samba Shared Repository - branch v4-10-test updated

Karolin Seeger kseeger at samba.org
Fri Mar 22 12:51:02 UTC 2019


The branch, v4-10-test has been updated
       via  c8e8d97959d s3:lib: Fix the debug message for adding cache entries.
       via  f6df8d97686 s4:librpc: Fix installation of Samba
       via  eb632754830 ctdb-tests: Add some testing for IPv4-mapped IPv6 address parsing
       via  909cecd3606 ctdb: Initialize addr struct to zero before reparsing as IPV4
       via  fc4e3273316 ctdb-packaging: Test package requires tcpdump
       via  755f624e2bb ctdb-packaging: ctdb package should not own system library directory
       via  84aad2ea7d5 s3:client: Fix smbspool device uri handling
       via  c6f1719b5e2 s3:client: Make sure we work on a copy of the title
       via  0db9487434a s3:client: Evaluate the AUTH_INFO_REQUIRED variable set by cups
       via  18515064c9b s3:client: Pass DEVICE_URI and AUTH_INFO_REQUIRED env to smbspool
       via  d3ed17e74e7 s3:script: Fix jobid check in test_smbspool.sh
       via  4cafdc7f2eb ctdb-tests: Build cluster mutex path manually
       via  5f1d98c233e ndr_spoolss_buf: fix out of scope use of stack variable in NDR_SPOOLSS_PUSH_ENUM_OUT()
       via  f515f1a5486 ctdb-version: Simplify version string usage
       via  6401d809566 ctdb-build: Drop creation of .distversion in tarball
       via  2b30986174d ctdb-build: use a fixed ctdb_version.h using SAMBA_VERSION_STRING
      from  3170d75b5f1 VERSION: Bump version up to 4.10.1...

https://git.samba.org/?p=samba.git;a=shortlog;h=v4-10-test


- Log -----------------------------------------------------------------
commit c8e8d97959dd5f3ae9ac7556ee0282baec861326
Author: Andreas Schneider <asn at samba.org>
Date:   Thu Jan 17 13:58:14 2019 +0100

    s3:lib: Fix the debug message for adding cache entries.
    
    To get correct values, we need to cast 'timeout' to 'long int' first in
    order to do calculation in that integer space! Calculations are don in
    the space of the lvalue!
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13848
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Volker Lendecke <vl at samba.org>
    (cherry picked from commit 5822449a7340f53987ce4c04851652427f5b49e8)
    
    Autobuild-User(v4-10-test): Karolin Seeger <kseeger at samba.org>
    Autobuild-Date(v4-10-test): Fri Mar 22 12:50:24 UTC 2019 on sn-devel-144

commit f6df8d976866cad14da492d6f581c9fdeb0c82b3
Author: Andreas Schneider <asn at samba.org>
Date:   Wed Mar 20 11:09:21 2019 +0100

    s4:librpc: Fix installation of Samba
    
    This breaks installation of Samba 4.10 on Fedora.
    
    https://bugzilla.samba.org/show_bug.cgi?id=13847
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Alexander Bokovoy <ab at samba.org>
    
    (cherry picked from commit bf469343f577e2d78df0e38d80e7976b351eaf0d)

commit eb63275483035550ac7760d83fbbdef357f3860b
Author: Martin Schwenke <martin at meltin.net>
Date:   Thu Mar 14 16:32:02 2019 +1100

    ctdb-tests: Add some testing for IPv4-mapped IPv6 address parsing
    
    ctdb_sock_addr values are hashed in some contexts.  This means that
    all of the memory used for the ctdb_sock_addr should be consistent
    regardless of how parsing is done.  The first 2 cases are just sanity
    checks but the 3rd case involving an IPv4-mapped IPv6 address is the
    real target of this test addition.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13839
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at samba.org>
    (cherry picked from commit d9286701cd9253bf3b42cac3d850ae8c23743e6d)

commit 909cecd3606c0811bd91a631569441681f05e568
Author: Zhu Shangzhong <zhu.shangzhong at zte.com.cn>
Date:   Tue Mar 12 20:49:48 2019 +0800

    ctdb: Initialize addr struct to zero before reparsing as IPV4
    
    Failed to kill the tcp connection that using IPv4-mapped IPv6 address
    (e.g. ctdb_killtcp eth0 ::ffff:192.168.200.44:2049
    ::ffff:192.168.200.45:863).
    
    When the ctdb_killtcp is used to kill the tcp connection, the IPs and
    ports in the connection will be parsed to conn.client and conn.server
    (call stack: main->ctdb_sock_addr_from_string->ip_from_string). In
    the ip_from_string, as we are using IPv4-mapped IPv6 addresses, the
    ipv6_from_string will be used to parse ip to addr.ip6 first. The next
    step the ipv4_from_string will be used to reparse ip to addr.ip.
    
    As a result, the data that dump from conn.server is "2 0 8 1 192 168
    200 44 0 0 0 0 0 0 0 0 0 0 255 255 192 168 200 44 0 0 0 0", the data
    from conn.client is "2 0 3 95 192 168 200 45 0 0 0 0 0 0 0 0 0 0 255 255
    192 168 200 45 0 0 0 0". The connection will be add to conn_list by
    ctdb_connection_list_add. Then the reset_connections_send uses conn_list
    as parameter to start to reset connections in the conn_list.
    
    In the reset_connections_send, the database "connections" will be
    created. The connections from conn_list will be written to the
    database(call db_hash_add), and use the data that dump from conn_client
    and conn_server as key.
    
    In the reset_connections_capture_tcp_handler, the
    ctdb_sys_read_tcp_packet will receive data on the raw socket. And
    extract the IPs and ports from the tcp packet. when extracting IP and
    port, the tcp4_extract OR tcp6_extract will be used. Then we got the
    new conn.client and conn.server. the data that dump from the
    conn.server is "2 0 8 1 192 168 200 44 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
    0 0 0", the data from conn.client is "2 0 3 95 192 168 200 45 0 0 0 0 0
    0 0 0 0 0 0 0 0 0 0 0 0 0 0 0". Finally, we use the data as key to check
    if this connection is one being reset(call db_hash_delete). The
    db_hash_delete will return ENOENT. Because the two key that being used
    by db_hash_delete and db_hash_add are different.
    
    So, the TCP RST will be NOT sent for the connection forever. We should
    initialize addr struct to zero before reparsing as IPV4 in the
    ip_from_string.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13839
    
    Signed-off-by: Zhu Shangzhong <zhu.shangzhong at zte.com.cn>
    Reviewed-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at samba.org>
    (cherry picked from commit 539b5ff32b32b7c75dfaaa119e41f5af6ff1e6fc)

commit fc4e3273316e252585fcd0119e84780d4ff704dc
Author: Martin Schwenke <martin at meltin.net>
Date:   Wed Mar 6 19:16:55 2019 +1100

    ctdb-packaging: Test package requires tcpdump
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13838
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at samba.org>
    (cherry picked from commit 957c38b65ca060eabe1e676f8dfb54839d706155)

commit 755f624e2bbca22da44b9b9352aa095bc3603db3
Author: Martin Schwenke <martin at meltin.net>
Date:   Wed Mar 6 14:36:01 2019 +1100

    ctdb-packaging: ctdb package should not own system library directory
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13838
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at samba.org>
    (cherry picked from commit b2b8dce4fc56c27ef0131104b316346565369dd7)

commit 84aad2ea7d53d8d7645bbd9e4c9ce6b09f6016c5
Author: Andreas Schneider <asn at samba.org>
Date:   Tue Mar 12 11:40:30 2019 +0100

    s3:client: Fix smbspool device uri handling
    
    If we are executed as a CUPS backend, argv[0] is set to the device uri.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13832
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Bryan Mason <bmason at redhat.com>
    Signed-off-by: Guenther Deschner <gd at samba.org>
    
    (cherry picked from commit 69d7a496d3bf52eaa10e81132bb61430863fdd8a)

commit c6f1719b5e25984afc3168bdcd8efdb301108afd
Author: Andreas Schneider <asn at samba.org>
Date:   Tue Mar 12 10:09:14 2019 +0100

    s3:client: Make sure we work on a copy of the title
    
    We can't be sure we can write to the input buffer.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13832
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Bryan Mason <bmason at redhat.com>
    Signed-off-by: Guenther Deschner <gd at samba.org>
    (cherry picked from commit 129ae27946318a075e99c9e6d1bacf8963f72282)

commit 0db9487434a27da6cce956a7a6b68e4d00093b9d
Author: Andreas Schneider <asn at samba.org>
Date:   Fri Jan 4 09:21:24 2019 +0100

    s3:client: Evaluate the AUTH_INFO_REQUIRED variable set by cups
    
    This should not switch to username,password if cups has been configured
    to use negotiate (Kerberos authentication).
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13832
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Bryan Mason <bmason at redhat.com>
    Signed-off-by: Guenther Deschner <gd at samba.org>
    (cherry picked from commit 5274b09fbaa5e45cc58f3301818d4e9f6a402845)

commit 18515064c9bc91259fb56c5efef42855d32a8bf8
Author: Andreas Schneider <asn at samba.org>
Date:   Tue Mar 12 09:40:58 2019 +0100

    s3:client: Pass DEVICE_URI and AUTH_INFO_REQUIRED env to smbspool
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13832
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Bryan Mason <bmason at redhat.com>
    Signed-off-by: Guenther Deschner <gd at samba.org>
    (cherry picked from commit 43160184d254a57f87bb2adeba47f48d8539533a)

commit d3ed17e74e7a24edbd7fc0f34ebd3221fe4e09f5
Author: Andreas Schneider <asn at samba.org>
Date:   Tue Mar 12 10:15:05 2019 +0100

    s3:script: Fix jobid check in test_smbspool.sh
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13832
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Bryan Mason <bmason at redhat.com>
    Signed-off-by: Guenther Deschner <gd at samba.org>
    (cherry picked from commit fad5e4eaeb9202c1b63c42ea09254c17c473e33a)

commit 4cafdc7f2eb810b34159642d988d23ed76762070
Author: Martin Schwenke <martin at meltin.net>
Date:   Thu Mar 7 15:53:31 2019 +1100

    ctdb-tests: Build cluster mutex path manually
    
    CTDB_CLUSTER_MUTEX_HELPER can't be depended on because it is only set
    when the tests are not installed and setting it unconditionally for
    this particular use would be wrong.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13800
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at samba.org>
    (cherry picked from commit a215d2017f95974913a7e97c25e5fc613bb79c26)

commit 5f1d98c233e968c1495fe222d8bbc9d035b6bb73
Author: Stefan Metzmacher <metze at samba.org>
Date:   Fri Mar 1 15:48:18 2019 +0100

    ndr_spoolss_buf: fix out of scope use of stack variable in NDR_SPOOLSS_PUSH_ENUM_OUT()
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13818
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: David Disseldorp <ddiss at samba.org>
    Reviewed-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Björn Jacke <bjacke at samba.org>
    Reviewed-by: Günther Deschner <gd at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    Reviewed-by: Garming Sam <garming at catalyst.net.nz>
    (cherry picked from commit 6da3664f8a11397fd3fb38e89c2432b8bf321e59)

commit f515f1a5486b04521a919e2962a0d288bbc08abc
Author: Amitay Isaacs <amitay at samba.org>
Date:   Fri Mar 15 12:14:27 2019 +1100

    ctdb-version: Simplify version string usage
    
    There is no need to write SAMBA_VERSION_STRING as CTDB_VERSION_STRING.
    Wherever required use SAMBA_VERSION_STRING directly.
    
    Avoids the confusion with two version.h files.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13789
    
    Signed-off-by: Amitay Isaacs <amitay at samba.org>
    Reviewed-by: Martin Schwenke <martin at meltin.net>
    
    Autobuild-User(master): Amitay Isaacs <amitay at samba.org>
    Autobuild-Date(master): Fri Mar 15 06:31:50 UTC 2019 on sn-devel-144
    
    (cherry picked from commit edd4a23d7632af51f4d7b4287917b7fa0dced963)

commit 6401d80956630c58ff6941858b382cabfed48ab2
Author: Martin Schwenke <martin at meltin.net>
Date:   Thu Mar 7 17:53:25 2019 +1100

    ctdb-build: Drop creation of .distversion in tarball
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13789
    
    Signed-off-by: Amitay Isaacs <amitay at gmail.com>
    Reviewed-by: Martin Schwenke <martin at meltin.net>
    (cherry picked from commit 148306674d0e4706adca3e5dcbb779c51a2c03da)

commit 2b30986174d721796b40aaedb3b9eda1b25af778
Author: Stefan Metzmacher <metze at samba.org>
Date:   Fri Jun 16 12:15:25 2017 +0200

    ctdb-build: use a fixed ctdb_version.h using SAMBA_VERSION_STRING
    
    This way we don't get constant rebuild as SAMBA_VERSION_STRING
    is "4.7.0pre1.DEVELOPERBUILD" for the binaries under bin/
    instead of "4.7.0pre1.GIT.59e51f6".
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13789
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Martin Schwenke <martin at meltin.net>
    (cherry picked from commit 05c28fee21c0cc986cb8301f4199595cdb13faee)

-----------------------------------------------------------------------

Summary of changes:
 ctdb/.gitignore                        |   1 -
 ctdb/common/version.c                  |  20 -----
 ctdb/common/version.h                  |  18 ----
 ctdb/packaging/RPM/ctdb.spec.in        |   4 +-
 ctdb/protocol/protocol_util.c          |   3 +
 ctdb/server/ctdb_daemon.c              |   4 +-
 ctdb/tests/local_daemons.sh            |   3 +-
 ctdb/tests/src/protocol_util_test.c    |  19 ++++
 ctdb/tools/ctdb.c                      |   4 +-
 ctdb/wscript                           |  25 +-----
 librpc/ndr/ndr_spoolss_buf.c           |   4 +-
 source3/client/smbspool.c              | 160 +++++++++++++++++++++++++--------
 source3/client/smbspool_krb5_wrapper.c |  24 ++++-
 source3/lib/gencache.c                 |   8 +-
 source3/script/tests/test_smbspool.sh  |   4 +-
 source4/librpc/wscript_build           |   8 --
 16 files changed, 183 insertions(+), 126 deletions(-)
 delete mode 100644 ctdb/common/version.c
 delete mode 100644 ctdb/common/version.h


Changeset truncated at 500 lines:

diff --git a/ctdb/.gitignore b/ctdb/.gitignore
index a634aeb8b45..f0534b3afd1 100644
--- a/ctdb/.gitignore
+++ b/ctdb/.gitignore
@@ -27,7 +27,6 @@ tests/takeover/ctdb_takeover.pyc
 tests/eventscripts/var
 tests/eventscripts/etc/iproute2
 tests/eventscripts/etc-ctdb/policy_routing
-include/ctdb_version.h
 packaging/RPM/ctdb.spec
 doc/*.[1-7]
 doc/*.[1-7].html
diff --git a/ctdb/common/version.c b/ctdb/common/version.c
deleted file mode 100644
index e34e98c09ef..00000000000
--- a/ctdb/common/version.c
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
-   CTDB version string
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, see <http://www.gnu.org/licenses/>.
-*/
-
-#include "ctdb_version.h"
-
-const char ctdb_version_string[] = CTDB_VERSION_STRING;
diff --git a/ctdb/common/version.h b/ctdb/common/version.h
deleted file mode 100644
index 1cf1c5d0cab..00000000000
--- a/ctdb/common/version.h
+++ /dev/null
@@ -1,18 +0,0 @@
-/*
-   CTDB version string
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, see <http://www.gnu.org/licenses/>.
-*/
-
-extern const char ctdb_version_string[];
diff --git a/ctdb/packaging/RPM/ctdb.spec.in b/ctdb/packaging/RPM/ctdb.spec.in
index d25735e06e0..efece159bdc 100644
--- a/ctdb/packaging/RPM/ctdb.spec.in
+++ b/ctdb/packaging/RPM/ctdb.spec.in
@@ -222,7 +222,7 @@ fi
 %{_bindir}/onnode
 %dir %{_libexecdir}/ctdb
 %{_libexecdir}/ctdb/*
-%dir %{_libdir}
+%dir %{_libdir}/ctdb
 %{_libdir}/ctdb/lib*
 %dir %{_datadir}/ctdb/events
 %{_datadir}/ctdb/events/*
@@ -258,7 +258,7 @@ development libraries for ctdb
 Summary: CTDB test suite
 Group: Development/Tools
 Requires: ctdb = %{version}
-Requires: nc
+Requires: nc, tcpdump
 
 %description tests
 test suite for ctdb
diff --git a/ctdb/protocol/protocol_util.c b/ctdb/protocol/protocol_util.c
index 75427e44f50..a09292c72a9 100644
--- a/ctdb/protocol/protocol_util.c
+++ b/ctdb/protocol/protocol_util.c
@@ -251,6 +251,9 @@ static int ip_from_string(const char *str, ctdb_sock_addr *addr)
 		if (memcmp(&addr->ip6.sin6_addr.s6_addr[0],
 			   ipv4_mapped_prefix,
 			   sizeof(ipv4_mapped_prefix)) == 0) {
+                        /* Initialize addr struct to zero before reparsing as IPV4 */
+                        ZERO_STRUCTP(addr);
+
 			/* Reparse as IPv4 */
 			ret = ipv4_from_string(p+1, &addr->ip);
 		}
diff --git a/ctdb/server/ctdb_daemon.c b/ctdb/server/ctdb_daemon.c
index aac331dd1dd..a8691388d4a 100644
--- a/ctdb/server/ctdb_daemon.c
+++ b/ctdb/server/ctdb_daemon.c
@@ -36,7 +36,7 @@
 #include "lib/util/blocking.h"
 #include "lib/util/become_daemon.h"
 
-#include "common/version.h"
+#include "version.h"
 #include "ctdb_private.h"
 #include "ctdb_client.h"
 
@@ -1237,7 +1237,7 @@ int ctdb_start_daemon(struct ctdb_context *ctdb, bool do_fork)
 
 	ctdb->ctdbd_pid = getpid();
 	DEBUG(DEBUG_ERR, ("Starting CTDBD (Version %s) as PID: %u\n",
-			  ctdb_version_string, ctdb->ctdbd_pid));
+			  SAMBA_VERSION_STRING, ctdb->ctdbd_pid));
 	ctdb_create_pidfile(ctdb);
 
 	/* create a unix domain stream socket to listen to */
diff --git a/ctdb/tests/local_daemons.sh b/ctdb/tests/local_daemons.sh
index 07cf1e9b135..3c3897feb50 100755
--- a/ctdb/tests/local_daemons.sh
+++ b/ctdb/tests/local_daemons.sh
@@ -193,7 +193,8 @@ local_daemons_setup ()
 
 	_recovery_lock="${directory}/rec.lock"
 	if $_recovery_lock_use_command ; then
-		_recovery_lock="! ${CTDB_CLUSTER_MUTEX_HELPER} ${_recovery_lock}"
+		_helper="${CTDB_SCRIPTS_HELPER_BINDIR}/ctdb_mutex_fcntl_helper"
+		_recovery_lock="! ${_helper} ${_recovery_lock}"
 	fi
 
 	if [ -n "$_socket_wrapper" ] ; then
diff --git a/ctdb/tests/src/protocol_util_test.c b/ctdb/tests/src/protocol_util_test.c
index 178ce1d6429..edd2a3411a0 100644
--- a/ctdb/tests/src/protocol_util_test.c
+++ b/ctdb/tests/src/protocol_util_test.c
@@ -52,6 +52,20 @@ static void test_sock_addr_from_string_bad(const char *ip, bool with_port)
 	assert(ret == EINVAL);
 }
 
+static void test_sock_addr_from_string_memcmp(const char *ip1,
+					      const char* ip2)
+{
+	ctdb_sock_addr sa1, sa2;
+	int ret;
+
+	ret = ctdb_sock_addr_from_string(ip1, &sa1, false);
+	assert(ret == 0);
+	ret = ctdb_sock_addr_from_string(ip2, &sa2, false);
+	assert(ret == 0);
+	ret = memcmp(&sa1, &sa2, sizeof(ctdb_sock_addr));
+	assert(ret == 0);
+}
+
 static void test_sock_addr_cmp(const char *ip1, const char *ip2,
 			       bool with_port, int res)
 {
@@ -329,6 +343,11 @@ int main(int argc, char *argv[])
 	test_sock_addr_from_string_bad("junk", false);
 	test_sock_addr_from_string_bad("0.0.0.0:0 trailing junk", true);
 
+	test_sock_addr_from_string_memcmp("127.0.0.1", "127.0.0.1");
+	test_sock_addr_from_string_memcmp("fe80::6af7:28ff:fefa:d136",
+					  "fe80::6af7:28ff:fefa:d136");
+	test_sock_addr_from_string_memcmp("::ffff:192.0.2.128", "192.0.2.128");
+
 	test_sock_addr_cmp("127.0.0.1", "127.0.0.1" , false, 0);
 	test_sock_addr_cmp("127.0.0.1", "127.0.0.2" , false, -1);
 	test_sock_addr_cmp("127.0.0.2", "127.0.0.1" , false, 1);
diff --git a/ctdb/tools/ctdb.c b/ctdb/tools/ctdb.c
index ee64566ba04..0fbe54c9f83 100644
--- a/ctdb/tools/ctdb.c
+++ b/ctdb/tools/ctdb.c
@@ -30,7 +30,7 @@
 #include <tevent.h>
 #include <tdb.h>
 
-#include "common/version.h"
+#include "version.h"
 #include "lib/util/debug.h"
 #include "lib/util/samba_util.h"
 #include "lib/util/sys_rw.h"
@@ -718,7 +718,7 @@ static int run_helper(TALLOC_CTX *mem_ctx, const char *command,
 static int control_version(TALLOC_CTX *mem_ctx, struct ctdb_context *ctdb,
 			   int argc, const char **argv)
 {
-	printf("%s\n", ctdb_version_string);
+	printf("%s\n", SAMBA_VERSION_STRING);
 	return 0;
 }
 
diff --git a/ctdb/wscript b/ctdb/wscript
index c2f1956a916..4adf60046c3 100644
--- a/ctdb/wscript
+++ b/ctdb/wscript
@@ -340,15 +340,6 @@ def configure(conf):
             else:
                 Logs.info("  %s: no" % (m))
 
-def gen_ctdb_version(task):
-    fp = open(task.outputs[0].bldpath(task.env), 'w')
-    fp.write('/* This file is auto-generated from waf */\n')
-    fp.write('#include "version.h"\n')
-    fp.write('\n')
-    fp.write('#define CTDB_VERSION_STRING "%s"\n' % get_version_string())
-    fp.close()
-
-
 def build(bld):
     if bld.env.standalone_ctdb:
         # enable building of public headers in the build tree
@@ -357,12 +348,6 @@ def build(bld):
     if bld.env.standalone_ctdb:
         bld.SAMBA_MKVERSION('version.h', '%s/VERSION' % vdir)
 
-    t = bld.SAMBA_GENERATOR('ctdb-version-header',
-                            target='include/ctdb_version.h',
-                            rule=gen_ctdb_version,
-                            dep_vars=['VERSION'])
-    t.env.VERSION = get_version_string()
-
     bld.env.PKGCONFIGDIR = '${LIBDIR}/pkgconfig'
 
     bld.RECURSE('lib/replace')
@@ -427,7 +412,7 @@ def build(bld):
                                              pidfile.c run_proc.c
                                              hash_count.c
                                              run_event.c event_script.c
-                                             sock_client.c version.c
+                                             sock_client.c
                                              cmdline.c path.c conf.c line.c
                                           '''),
                         deps='''samba-util sys_rw tevent-util
@@ -1181,14 +1166,6 @@ def manpages(ctx):
 def distonly(ctx):
     samba_dist.DIST_FILES('VERSION:VERSION', extend=True)
 
-    version = get_version()
-
-    distfile = open('.distversion', 'w')
-    for field in version.vcs_fields:
-        distfile.write('%s=%s\n' % (field, str(version.vcs_fields[field])))
-    distfile.close()
-    samba_dist.DIST_FILES('ctdb/.distversion:.distversion', extend=True)
-
     t = 'ctdb.spec'
     sed_expr1 = 's/@VERSION@/%s/g' % get_version_string()
     sed_expr2 = 's/@RELEASE@/%s/g' % '1'
diff --git a/librpc/ndr/ndr_spoolss_buf.c b/librpc/ndr/ndr_spoolss_buf.c
index c1d175fcbe5..244d692dca8 100644
--- a/librpc/ndr/ndr_spoolss_buf.c
+++ b/librpc/ndr/ndr_spoolss_buf.c
@@ -43,7 +43,8 @@
 } while(0)
 
 #define NDR_SPOOLSS_PUSH_ENUM_OUT(fn) do { \
-	struct ndr_push *_ndr_info;\
+	DATA_BLOB _data_blob_info = data_blob_null;\
+	struct ndr_push *_ndr_info = NULL;\
 	_r.in.level	= r->in.level;\
 	_r.in.buffer	= r->in.buffer;\
 	_r.in.offered	= r->in.offered;\
@@ -56,7 +57,6 @@
 			"SPOOLSS Buffer: *r->out.info but there's no r->in.buffer");\
 	}\
 	if (r->in.buffer) {\
-		DATA_BLOB _data_blob_info;\
 		_ndr_info = ndr_push_init_ctx(ndr);\
 		NDR_ERR_HAVE_NO_MEMORY(_ndr_info);\
 		_ndr_info->flags= ndr->flags;\
diff --git a/source3/client/smbspool.c b/source3/client/smbspool.c
index 4f312a6d294..5efaa091913 100644
--- a/source3/client/smbspool.c
+++ b/source3/client/smbspool.c
@@ -61,18 +61,20 @@
  * Local functions...
  */
 
-static int      get_exit_code(struct cli_state * cli, NTSTATUS nt_status, bool use_kerberos);
+static int      get_exit_code(struct cli_state * cli, NTSTATUS nt_status);
 static void     list_devices(void);
 static struct cli_state *smb_complete_connection(const char *, const char *,
 	int, const char *, const char *, const char *, const char *, int, bool *need_auth);
 static struct cli_state *smb_connect(const char *, const char *, int, const
 	char *, const char *, const char *, const char *, bool *need_auth);
-static int      smb_print(struct cli_state *, char *, FILE *);
+static int      smb_print(struct cli_state *, const char *, FILE *);
 static char    *uri_unescape_alloc(const char *);
 #if 0
 static bool     smb_encrypt;
 #endif
 
+static const char *auth_info_required;
+
 /*
  * 'main()' - Main entry for SMB backend.
  */
@@ -98,10 +100,12 @@ main(int argc,			/* I - Number of command-line arguments */
 	char            empty_str[] = "";
 	int             tries = 0;
 	bool		need_auth = true;
-	const char     *dev_uri;
+	const char     *dev_uri = NULL;
+	const char     *env = NULL;
 	const char     *config_file = NULL;
 	TALLOC_CTX     *frame = talloc_stackframe();
-	bool device_uri_cmdline = false;
+	const char *print_user = NULL;
+	const char *print_title = NULL;
 	const char *print_file = NULL;
 	const char *print_copies = NULL;
 	int cmp;
@@ -138,21 +142,81 @@ main(int argc,			/* I - Number of command-line arguments */
 	}
 
 	/*
-	 * If we have 6 arguments find out if we have the device_uri from the
-	 * command line or the print data
+	 * Find out if we have the device_uri in the command line.
+	 *
+	 * If we are started as a CUPS backend argv[0] is normally the
+	 * device_uri!
 	 */
-	if (argc == 7) {
-		cmp = strncmp(argv[1], "smb://", 6);
-		if (cmp == 0) {
-			device_uri_cmdline = true;
+	if (argc == 8) {
+		/*
+		 * smbspool <uri> <job> <user> <title> <copies> <options> <file>
+		 * 0        1     2     3      4       5        6         7
+		 */
+
+		dev_uri = argv[1];
+
+		print_user = argv[3];
+		print_title = argv[4];
+		print_copies = argv[5];
+		print_file = argv[7];
+	} else if (argc == 7) {
+		int cmp1;
+		int cmp2;
+
+		/*
+		 * <uri>    <job> <user> <title> <copies> <options> <file>
+		 * smbspool <uri> <job>  <user>  <title>  <copies>  <options>
+		 * smbspool <job> <user> <title> <copies> <options> <file> | DEVICE_URI
+		 */
+		cmp1 = strncmp(argv[0], "smb://", 6);
+		cmp2 = strncmp(argv[1], "smb://", 6);
+
+		if (cmp1 == 0) {
+			/*
+			 * <uri>    <job> <user> <title> <copies> <options> <file>
+			 * 0        1     2      3       4        5         6
+			 */
+			dev_uri = argv[0];
+
+			print_user = argv[2];
+			print_title = argv[3];
+			print_copies = argv[4];
+			print_file = argv[6];
+		} else if (cmp2 == 0) {
+			/*
+			 * smbspool <uri> <job>  <user>  <title>  <copies>  <options>
+			 * 0        1     2      3       4        5         6
+			 */
+			dev_uri = argv[1];
+
+			print_user = argv[3];
+			print_title = argv[4];
+			print_copies = argv[5];
+			print_file = NULL;
 		} else {
+			/*
+			 * smbspool <job> <user> <title> <copies> <options> <file> | DEVICE_URI
+			 * 0        1     2      3       4        5         6
+			 */
+			print_user = argv[2];
+			print_title = argv[3];
 			print_copies = argv[4];
 			print_file = argv[6];
 		}
-	} else if (argc == 8) {
-		device_uri_cmdline = true;
-		print_copies = argv[5];
-		print_file = argv[7];
+	} else if (argc == 6) {
+		/*
+		 * <uri>    <job> <user> <title> <copies> <options>
+		 * smbspool <job> <user> <title> <copies> <options> | DEVICE_URI
+		 * 0        1     2      3       4        5
+		 */
+		cmp = strncmp(argv[0], "smb://", 6);
+		if (cmp == 0) {
+			dev_uri = argv[0];
+		}
+
+		print_user = argv[2];
+		print_title = argv[3];
+		print_copies = argv[4];
 	}
 
 	if (print_file != NULL) {
@@ -177,15 +241,19 @@ main(int argc,			/* I - Number of command-line arguments */
 	/*
 	 * Find the URI ...
 	 */
-	if (device_uri_cmdline) {
-		dev_uri = argv[1];
-	} else {
-		dev_uri = getenv("DEVICE_URI");
-		if (dev_uri == NULL || strlen(dev_uri) == 0) {
-			dev_uri = "";
+	if (dev_uri == NULL) {
+		env = getenv("DEVICE_URI");
+		if (env != NULL && env[0] != '\0') {
+			dev_uri = env;
 		}
 	}
 
+	if (dev_uri == NULL) {
+		fprintf(stderr,
+			"ERROR: No valid device URI has been specified\n");
+		goto done;
+	}
+
 	cmp = strncmp(dev_uri, "smb://", 6);
 	if (cmp != 0) {
 		fprintf(stderr,
@@ -199,6 +267,11 @@ main(int argc,			/* I - Number of command-line arguments */
 		goto done;
 	}
 
+	auth_info_required = getenv("AUTH_INFO_REQUIRED");
+	if (auth_info_required == NULL) {
+		auth_info_required = "none";
+	}
+
 	/*
          * Extract the destination from the URI...
          */
@@ -234,6 +307,10 @@ main(int argc,			/* I - Number of command-line arguments */
 		server = uri + 6;
 	}
 
+	if (password != empty_str) {
+		auth_info_required = "username,password";
+	}
+
 	tmp = server;
 
 	if ((sep = strchr_m(tmp, '/')) == NULL) {
@@ -291,8 +368,14 @@ main(int argc,			/* I - Number of command-line arguments */
 	load_interfaces();
 
 	do {
-		cli = smb_connect(workgroup, server, port, printer,
-			username, password, argv[3], &need_auth);
+		cli = smb_connect(workgroup,
+				  server,
+				  port,
+				  printer,
+				  username,
+				  password,
+				  print_user,
+				  &need_auth);
 		if (cli == NULL) {
 			if (need_auth) {
 				exit(2);
@@ -328,7 +411,7 @@ main(int argc,			/* I - Number of command-line arguments */
          */
 
 	for (i = 0; i < copies; i++) {
-		status = smb_print(cli, argv[4] /* title */ , fp);
+		status = smb_print(cli, print_title, fp);
 		if (status != 0) {
 			break;
 		}
@@ -353,8 +436,7 @@ done:
 
 static int
 get_exit_code(struct cli_state * cli,
-	      NTSTATUS nt_status,
-	      bool use_kerberos)
+	      NTSTATUS nt_status)
 {
 	int i;
 
@@ -381,10 +463,7 @@ get_exit_code(struct cli_state * cli,
 		}
 
 		if (cli) {
-			if (use_kerberos)
-				fputs("ATTR: auth-info-required=negotiate\n", stderr);
-			else
-				fputs("ATTR: auth-info-required=username,password\n", stderr);
+			fprintf(stderr, "ATTR: auth-info-required=%s\n", auth_info_required);


-- 
Samba Shared Repository



More information about the samba-cvs mailing list