[SCM] Samba Shared Repository - branch master updated

Günther Deschner gd at samba.org
Tue Jan 19 06:16:53 MST 2010


The branch, master has been updated
       via  b5186b3... s3-selftest: finally enable RPC-SPOOLSS-NOTIFY against s3.
       via  f720f75... s3-spoolss: stricter name checks when opening back-channel notify connection.
       via  c971c10... s3-selftest: use absolute path when setting SOCKET_WRAPPER_DIR.
       via  f5bba40... s4-smbtorture: support spoolss_ReplyClosePrinter server call in RPC-SPOOLSS-NOTIFY.
       via  2b68215... s4-smbtorture: restructure spoolss server implementations in RPC-SPOOLSS-NOTIFY.
       via  e0660ed... s4-smbtorture: skip ReplyOpenPrinter test in RPC-SPOOLSS-NOTIFY while testing s3.
       via  7d1c1e0... s4-smbtorture: strip trailing whitespace.
      from  6d33bb2... s3 net/i18n: update .po files

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit b5186b3e2397bd1a784d5ded2ddbb155cb061a4e
Author: Günther Deschner <gd at samba.org>
Date:   Tue Jan 19 00:31:54 2010 +0100

    s3-selftest: finally enable RPC-SPOOLSS-NOTIFY against s3.
    
    Guenther

commit f720f7512e66687f745732b86305eecec8f66d77
Author: Günther Deschner <gd at samba.org>
Date:   Tue Jan 19 00:33:57 2010 +0100

    s3-spoolss: stricter name checks when opening back-channel notify connection.
    
    Make sure to always check if the name the client passed in
    spoolss_RemoteFindFirstPrinterChangeNotifyEx is not one of our names.
    
    Guenther

commit c971c10a63841d9b850d10ce856e813e37cace36
Author: Günther Deschner <gd at samba.org>
Date:   Tue Jan 19 00:55:48 2010 +0100

    s3-selftest: use absolute path when setting SOCKET_WRAPPER_DIR.
    
    Guenther

commit f5bba4034b362d354409932f0b0cef0e4d44a08d
Author: Günther Deschner <gd at samba.org>
Date:   Tue Jan 19 00:27:50 2010 +0100

    s4-smbtorture: support spoolss_ReplyClosePrinter server call in RPC-SPOOLSS-NOTIFY.
    
    A handle obtained with spoolss_ReplyOpenPrinter will be closed with
    spoolss_ReplyClosePrinter when we call spoolss_ClosePrinter on the remote side.
    
    Guenther

commit 2b68215a226aab978e5f01470e8b4afbb291134b
Author: Günther Deschner <gd at samba.org>
Date:   Tue Jan 19 00:22:57 2010 +0100

    s4-smbtorture: restructure spoolss server implementations in RPC-SPOOLSS-NOTIFY.
    
    Guenther

commit e0660ed1bc72effa5715587e105eb5096a3d70d0
Author: Günther Deschner <gd at samba.org>
Date:   Tue Jan 19 00:19:47 2010 +0100

    s4-smbtorture: skip ReplyOpenPrinter test in RPC-SPOOLSS-NOTIFY while testing s3.
    
    Guenther

commit 7d1c1e0083362c3782b2481e11207f1ce286c129
Author: Günther Deschner <gd at samba.org>
Date:   Tue Jan 19 14:10:47 2010 +0100

    s4-smbtorture: strip trailing whitespace.
    
    Guenther

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

Summary of changes:
 selftest/selftest.pl                  |    2 +-
 source3/rpc_server/srv_spoolss_nt.c   |   20 +++++---
 source3/script/tests/selftest.sh      |    2 +-
 source3/script/tests/test_posix_s3.sh |    2 +-
 source4/torture/rpc/spoolss_notify.c  |   86 +++++++++++++++++++++++++++------
 5 files changed, 87 insertions(+), 25 deletions(-)


Changeset truncated at 500 lines:

diff --git a/selftest/selftest.pl b/selftest/selftest.pl
index 883d2a0..ba66049 100755
--- a/selftest/selftest.pl
+++ b/selftest/selftest.pl
@@ -445,7 +445,7 @@ if ($opt_socket_wrapper_pcap) {
 
 my $socket_wrapper_dir;
 if ($opt_socket_wrapper) {
-	$socket_wrapper_dir = SocketWrapper::setup_dir("$prefix/w", $opt_socket_wrapper_pcap);
+	$socket_wrapper_dir = SocketWrapper::setup_dir("$prefix_abs/w", $opt_socket_wrapper_pcap);
 	print "SOCKET_WRAPPER_DIR=$socket_wrapper_dir\n";
 } else {
 	 unless ($< == 0) { 
diff --git a/source3/rpc_server/srv_spoolss_nt.c b/source3/rpc_server/srv_spoolss_nt.c
index 0028ec0..b1513dd 100644
--- a/source3/rpc_server/srv_spoolss_nt.c
+++ b/source3/rpc_server/srv_spoolss_nt.c
@@ -2340,27 +2340,30 @@ static bool spoolss_connect_to_client(struct rpc_pipe_client **pp_pipe,
 	NTSTATUS ret;
 	struct cli_state *the_cli;
 	struct sockaddr_storage rm_addr;
+	char addr[INET6_ADDRSTRLEN];
 
 	if ( is_zero_addr((struct sockaddr *)client_ss) ) {
+		DEBUG(2,("spoolss_connect_to_client: resolving %s\n",
+			remote_machine));
 		if ( !resolve_name( remote_machine, &rm_addr, 0x20, false) ) {
 			DEBUG(2,("spoolss_connect_to_client: Can't resolve address for %s\n", remote_machine));
 			return false;
 		}
-
-		if (ismyaddr((struct sockaddr *)&rm_addr)) {
-			DEBUG(0,("spoolss_connect_to_client: Machine %s is one of our addresses. Cannot add to ourselves.\n", remote_machine));
-			return false;
-		}
+		print_sockaddr(addr, sizeof(addr), &rm_addr);
 	} else {
-		char addr[INET6_ADDRSTRLEN];
 		rm_addr = *client_ss;
 		print_sockaddr(addr, sizeof(addr), &rm_addr);
 		DEBUG(5,("spoolss_connect_to_client: Using address %s (no name resolution necessary)\n",
 			addr));
 	}
 
-	/* setup the connection */
+	if (ismyaddr((struct sockaddr *)&rm_addr)) {
+		DEBUG(0,("spoolss_connect_to_client: Machine %s is one of our addresses. Cannot add to ourselves.\n",
+			addr));
+		return false;
+	}
 
+	/* setup the connection */
 	ret = cli_full_connection( &the_cli, global_myname(), remote_machine,
 		&rm_addr, 0, "IPC$", "IPC",
 		"", /* username */
@@ -2549,6 +2552,9 @@ WERROR _spoolss_RemoteFindFirstPrinterChangeNotifyEx(pipes_struct *p,
 			!get_printer_snum(p, r->in.handle, &snum, NULL) )
 		return WERR_BADFID;
 
+	DEBUG(10,("_spoolss_RemoteFindFirstPrinterChangeNotifyEx: "
+		"client_address is %s\n", p->client_address));
+
 	if (!interpret_string_addr(&client_ss, p->client_address,
 				   AI_NUMERICHOST)) {
 		return WERR_SERVER_UNAVAILABLE;
diff --git a/source3/script/tests/selftest.sh b/source3/script/tests/selftest.sh
index 91052a7..8565185 100755
--- a/source3/script/tests/selftest.sh
+++ b/source3/script/tests/selftest.sh
@@ -82,7 +82,7 @@ COMMONCONFFILE=$LIBDIR/common.conf
 PRIVATEDIR=$PREFIX_ABS/private
 LOCKDIR=$PREFIX_ABS/lockdir
 LOGDIR=$PREFIX_ABS/logs
-SOCKET_WRAPPER_DIR=$PREFIX/sw
+SOCKET_WRAPPER_DIR=$PREFIX_ABS/sw
 CONFIGURATION="--configfile $CONFFILE"
 SAMBA4CONFIGURATION="-s $SAMBA4CONFFILE"
 NSS_WRAPPER_PASSWD="$PRIVATEDIR/passwd"
diff --git a/source3/script/tests/test_posix_s3.sh b/source3/script/tests/test_posix_s3.sh
index 26bca35..0725548 100755
--- a/source3/script/tests/test_posix_s3.sh
+++ b/source3/script/tests/test_posix_s3.sh
@@ -41,7 +41,7 @@ rpc="RPC-AUTHCONTEXT RPC-BINDSAMBA3 RPC-SAMBA3-SRVSVC RPC-SAMBA3-SHARESEC"
 rpc="$rpc RPC-SAMBA3-SPOOLSS RPC-SAMBA3-WKSSVC RPC-SAMBA3-WINREG"
 rpc="$rpc RPC-SAMBA3-GETALIASMEMBERSHIP-0"
 rpc="$rpc RPC-NETLOGSAMBA3 RPC-SAMBA3SESSIONKEY RPC-SAMBA3-GETUSERNAME"
-rpc="$rpc RPC-SVCCTL RPC-SPOOLSS RPC-SPOOLSS-WIN RPC-NTSVCS"
+rpc="$rpc RPC-SVCCTL RPC-SPOOLSS RPC-SPOOLSS-WIN RPC-SPOOLSS-NOTIFY RPC-NTSVCS"
 rpc="$rpc RPC-LSA-GETUSER RPC-LSA-LOOKUPSIDS RPC-LSA-LOOKUPNAMES"
 rpc="$rpc RPC-LSA-PRIVILEGES "
 rpc="$rpc RPC-SAMR RPC-SAMR-USERS RPC-SAMR-USERS-PRIVILEGES RPC-SAMR-PASSWORDS"
diff --git a/source4/torture/rpc/spoolss_notify.c b/source4/torture/rpc/spoolss_notify.c
index 2dbed89..c6ff706 100644
--- a/source4/torture/rpc/spoolss_notify.c
+++ b/source4/torture/rpc/spoolss_notify.c
@@ -1,19 +1,19 @@
-/* 
+/*
    Unix SMB/CIFS implementation.
    test suite for spoolss rpc notify operations
 
    Copyright (C) Jelmer Vernooij 2007
-   
+
    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, write to the Free Software
    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
@@ -23,6 +23,7 @@
 #include "system/filesys.h"
 #include "torture/rpc/rpc.h"
 #include "librpc/gen_ndr/ndr_spoolss_c.h"
+#include "librpc/gen_ndr/ndr_spoolss.h"
 #include "rpc_server/dcerpc_server.h"
 #include "rpc_server/service_rpc.h"
 #include "smbd/process_model.h"
@@ -68,7 +69,7 @@ static NTSTATUS spoolss__op_ndr_pull(struct dcesrv_call_state *dce_call, TALLOC_
 	return NT_STATUS_OK;
 }
 
-/* Note that received_packets are allocated in talloc_autofree_context(), 
+/* Note that received_packets are allocated in talloc_autofree_context(),
  * because no other context appears to stay around long enough. */
 static struct received_packet {
 	uint16_t opnum;
@@ -76,6 +77,39 @@ static struct received_packet {
 	struct received_packet *prev, *next;
 } *received_packets = NULL;
 
+static WERROR _spoolss_ReplyOpenPrinter(struct dcesrv_call_state *dce_call,
+					TALLOC_CTX *mem_ctx,
+					struct spoolss_ReplyOpenPrinter *r)
+{
+	DEBUG(1,("_spoolss_ReplyOpenPrinter\n"));
+
+	NDR_PRINT_IN_DEBUG(spoolss_ReplyOpenPrinter, r);
+
+	r->out.handle = talloc(r, struct policy_handle);
+	r->out.handle->handle_type = 42;
+	r->out.handle->uuid = GUID_random();
+	r->out.result = WERR_OK;
+
+	NDR_PRINT_OUT_DEBUG(spoolss_ReplyOpenPrinter, r);
+
+	return WERR_OK;
+}
+
+static WERROR _spoolss_ReplyClosePrinter(struct dcesrv_call_state *dce_call,
+					 TALLOC_CTX *mem_ctx,
+					 struct spoolss_ReplyClosePrinter *r)
+{
+	DEBUG(1,("_spoolss_ReplyClosePrinter\n"));
+
+	NDR_PRINT_IN_DEBUG(spoolss_ReplyClosePrinter, r);
+
+	ZERO_STRUCTP(r->out.handle);
+	r->out.result = WERR_OK;
+
+	NDR_PRINT_OUT_DEBUG(spoolss_ReplyClosePrinter, r);
+
+	return WERR_OK;
+}
 
 static NTSTATUS spoolss__op_dispatch(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, void *r)
 {
@@ -91,7 +125,12 @@ static NTSTATUS spoolss__op_dispatch(struct dcesrv_call_state *dce_call, TALLOC_
 	switch (opnum) {
 	case 58: {
 		struct spoolss_ReplyOpenPrinter *r2 = (struct spoolss_ReplyOpenPrinter *)r;
-		r2->out.result = WERR_OK;
+		r2->out.result = _spoolss_ReplyOpenPrinter(dce_call, mem_ctx, r2);
+		break;
+	}
+	case 60: {
+		struct spoolss_ReplyClosePrinter *r2 = (struct spoolss_ReplyClosePrinter *)r;
+		r2->out.result = _spoolss_ReplyClosePrinter(dce_call, mem_ctx, r2);
 		break;
 	}
 
@@ -159,7 +198,7 @@ static bool spoolss__op_interface_by_name(struct dcesrv_interface *iface, const
 		return true;
 	}
 
-	return false;	
+	return false;
 }
 
 static NTSTATUS spoolss__op_init_server(struct dcesrv_context *dce_ctx, const struct dcesrv_endpoint_server *ep_server)
@@ -180,7 +219,7 @@ static NTSTATUS spoolss__op_init_server(struct dcesrv_context *dce_ctx, const st
 	return NT_STATUS_OK;
 }
 
-static bool test_RFFPCNEx(struct torture_context *tctx, 
+static bool test_RFFPCNEx(struct torture_context *tctx,
 			  struct dcerpc_pipe *p)
 {
 	struct spoolss_OpenPrinter q;
@@ -192,6 +231,7 @@ static bool test_RFFPCNEx(struct torture_context *tctx,
 	struct dcesrv_endpoint *e;
 	struct spoolss_NotifyOption t1;
 	struct spoolss_ClosePrinter cp;
+	struct received_packet *rp;
 
 	struct policy_handle handle;
 	const char *address;
@@ -240,7 +280,7 @@ static bool test_RFFPCNEx(struct torture_context *tctx,
 	torture_assert_ntstatus_ok(tctx, status, "starting smb server");
 
 	status = dcesrv_init_context(tctx, tctx->lp_ctx, endpoints, &dce_ctx);
-	torture_assert_ntstatus_ok(tctx, status, 
+	torture_assert_ntstatus_ok(tctx, status,
 				   "unable to initialize DCE/RPC server");
 
 	/* Make sure the directory for NCALRPC exists */
@@ -284,7 +324,7 @@ static bool test_RFFPCNEx(struct torture_context *tctx,
 	status = dcerpc_spoolss_RemoteFindFirstPrinterChangeNotifyEx(p, tctx, &r);
 
 	torture_assert_ntstatus_ok(tctx, status, "FFPCNEx failed");
-	
+
 	torture_assert_werr_ok(tctx, r.out.result, "error return code for FFPCNEx");
 
 	cp.in.handle = &handle;
@@ -295,9 +335,21 @@ static bool test_RFFPCNEx(struct torture_context *tctx,
 	status = dcerpc_spoolss_ClosePrinter(p, tctx, &cp);
 	torture_assert_ntstatus_ok(tctx, status, "ClosePrinter failed");
 
-	/* We should've had an incoming packet 58 (ReplyOpenPrinter) */
+	/* We should've had an incoming packet 58 (ReplyOpenPrinter) or 60
+	 * (ReplyClosePrinter) */
+
 	torture_assert(tctx, received_packets != NULL, "no packets received");
-	torture_assert_int_equal(tctx, received_packets->opnum, 58, "invalid opnum");
+
+	for (rp = received_packets; rp; rp = rp->next) {
+		switch (rp->opnum) {
+		case 58:
+		case 60:
+			continue;
+		default:
+			torture_fail(tctx,
+				talloc_asprintf(tctx, "unexpected packet opnum %d received", rp->opnum));
+		}
+	}
 
 	/* Shut down DCE/RPC server */
 	talloc_free(dce_ctx);
@@ -315,6 +367,10 @@ static bool test_ReplyOpenPrinter(struct torture_context *tctx,
 	struct spoolss_ReplyClosePrinter s;
 	struct policy_handle h;
 
+	if (torture_setting_bool(tctx, "samba3", false)) {
+		torture_skip(tctx, "skipping ReplyOpenPrinter server implementation test against s3\n");
+	}
+
 	r.in.server_name = "earth";
 	r.in.printer_local = 2;
 	r.in.type = REG_DWORD;
@@ -343,12 +399,12 @@ static bool test_ReplyOpenPrinter(struct torture_context *tctx,
 struct torture_suite *torture_rpc_spoolss_notify(TALLOC_CTX *mem_ctx)
 {
 	struct torture_suite *suite = torture_suite_create(mem_ctx, "SPOOLSS-NOTIFY");
-	
-	struct torture_rpc_tcase *tcase = torture_suite_add_rpc_iface_tcase(suite, 
+
+	struct torture_rpc_tcase *tcase = torture_suite_add_rpc_iface_tcase(suite,
 							"notify", &ndr_table_spoolss);
 
 	torture_rpc_tcase_add_test(tcase, "testRFFPCNEx", test_RFFPCNEx);
 	torture_rpc_tcase_add_test(tcase, "testReplyOpenPrinter", test_ReplyOpenPrinter);
-	
+
 	return suite;
 }


-- 
Samba Shared Repository


More information about the samba-cvs mailing list