svn commit: samba r24935 - in branches/4.0-spoolsstest: . source/libcli/nbt source/librpc/rpc source/rpc_server/spoolss source/torture/rpc

jelmer at samba.org jelmer at samba.org
Mon Sep 3 12:46:37 GMT 2007


Author: jelmer
Date: 2007-09-03 12:46:35 +0000 (Mon, 03 Sep 2007)
New Revision: 24935

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=24935

Log:
Fix bug in librpc/ that caused a crash when an only IP address was specified.
Modified:
   branches/4.0-spoolsstest/
   branches/4.0-spoolsstest/source/libcli/nbt/nbtname.c
   branches/4.0-spoolsstest/source/librpc/rpc/dcerpc_connect.c
   branches/4.0-spoolsstest/source/librpc/rpc/dcerpc_smb.c
   branches/4.0-spoolsstest/source/rpc_server/spoolss/dcesrv_spoolss.c
   branches/4.0-spoolsstest/source/torture/rpc/spoolss_notify.c


Changeset:

Property changes on: branches/4.0-spoolsstest
___________________________________________________________________
Name: bzr:revision-info
...skipped...
Name: bzr:revision-id:v3-trunk0
...skipped...

Modified: branches/4.0-spoolsstest/source/libcli/nbt/nbtname.c
===================================================================
--- branches/4.0-spoolsstest/source/libcli/nbt/nbtname.c	2007-09-03 12:46:29 UTC (rev 24934)
+++ branches/4.0-spoolsstest/source/libcli/nbt/nbtname.c	2007-09-03 12:46:35 UTC (rev 24935)
@@ -401,7 +401,7 @@
 	n->scope = NULL;
 	n->type = type;
 
-	if (is_ipaddress(name)) {
+	if (is_ipaddress(name) || name == NULL) {
 		n->name = "*SMBSERVER";
 		return;
 	}

Modified: branches/4.0-spoolsstest/source/librpc/rpc/dcerpc_connect.c
===================================================================
--- branches/4.0-spoolsstest/source/librpc/rpc/dcerpc_connect.c	2007-09-03 12:46:29 UTC (rev 24934)
+++ branches/4.0-spoolsstest/source/librpc/rpc/dcerpc_connect.c	2007-09-03 12:46:35 UTC (rev 24935)
@@ -110,7 +110,10 @@
 	   remote rpc server */
 	conn->in.dest_host              = s->io.binding->host;
 	conn->in.port                   = 0;
-	conn->in.called_name            = s->io.binding->target_hostname;
+	if (s->io.binding->target_hostname == NULL)
+		conn->in.called_name = "*SMBSERVER";
+	else
+		conn->in.called_name            = s->io.binding->target_hostname;
 	conn->in.service                = "IPC$";
 	conn->in.service_type           = NULL;
 	conn->in.workgroup              = lp_workgroup();

Modified: branches/4.0-spoolsstest/source/librpc/rpc/dcerpc_smb.c
===================================================================
--- branches/4.0-spoolsstest/source/librpc/rpc/dcerpc_smb.c	2007-09-03 12:46:29 UTC (rev 24934)
+++ branches/4.0-spoolsstest/source/librpc/rpc/dcerpc_smb.c	2007-09-03 12:46:35 UTC (rev 24935)
@@ -430,7 +430,9 @@
 	/* if we don't have a binding on this pipe yet, then create one */
 	if (p->binding == NULL) {
 		NTSTATUS status;
-		char *s = talloc_asprintf(p, "ncacn_np:%s", tree->session->transport->socket->hostname);
+		char *s;
+		SMB_ASSERT(tree->session->transport->socket->hostname != NULL);
+		s = talloc_asprintf(p, "ncacn_np:%s", tree->session->transport->socket->hostname);
 		if (s == NULL) return NULL;
 		status = dcerpc_parse_binding(p, s, &p->binding);
 		talloc_free(s);

Modified: branches/4.0-spoolsstest/source/rpc_server/spoolss/dcesrv_spoolss.c
===================================================================
--- branches/4.0-spoolsstest/source/rpc_server/spoolss/dcesrv_spoolss.c	2007-09-03 12:46:29 UTC (rev 24934)
+++ branches/4.0-spoolsstest/source/rpc_server/spoolss/dcesrv_spoolss.c	2007-09-03 12:46:35 UTC (rev 24935)
@@ -1133,6 +1133,7 @@
 	NTSTATUS status;
 	struct spoolss_ReplyOpenPrinter rop;
 	struct cli_credentials *creds;
+	struct policy_handle notify_handle;
 
 	DEBUG(2, ("Received RFFPCNex from %s\n", r->in.str));
 
@@ -1161,11 +1162,13 @@
 	}
 
 	ZERO_STRUCT(rop);
-	rop.in.server_name = NULL;
+	rop.in.server_name = lp_netbios_name();
+	W_ERROR_HAVE_NO_MEMORY(rop.in.server_name);
 	rop.in.printer_local = 0;
 	rop.in.type = REG_NONE;
 	rop.in.unknown1 = 0;
 	rop.in.unknown2 = 0;
+	rop.out.handle = &notify_handle;
 
 	status = dcerpc_spoolss_ReplyOpenPrinter(p, mem_ctx, &rop);
 	if (NT_STATUS_IS_ERR(status)) {

Modified: branches/4.0-spoolsstest/source/torture/rpc/spoolss_notify.c
===================================================================
--- branches/4.0-spoolsstest/source/torture/rpc/spoolss_notify.c	2007-09-03 12:46:29 UTC (rev 24934)
+++ branches/4.0-spoolsstest/source/torture/rpc/spoolss_notify.c	2007-09-03 12:46:35 UTC (rev 24935)
@@ -30,6 +30,7 @@
 #include "smb_server/smb_server.h"
 #include "lib/socket/netif.h"
 #include "dlinklist.h"
+#include "ntvfs/ntvfs.h"
 
 static NTSTATUS spoolss__op_bind(struct dcesrv_call_state *dce_call, const struct dcesrv_interface *iface)
 {
@@ -222,6 +223,8 @@
 	torture_assert_ntstatus_ok(tctx, dcerpc_register_ep_server(&ep_server),
 				  "unable to register spoolss server");
 
+	lp_set_cmdline("dcerpc endpoint servers", "spoolss");
+
 	address = iface_n_ip(0);
 	torture_comment(tctx, "Listening for callbacks on %s\n", address);
 	status = smbsrv_add_socket(p->conn->event_ctx, &single_ops, address);
@@ -256,8 +259,7 @@
 
 	status = dcerpc_spoolss_RemoteFindFirstPrinterChangeNotifyEx(p, tctx, &r);
 
-	torture_assert_ntstatus_ok(tctx, status, 
-				   "FFPCNEx failed");
+	torture_assert_ntstatus_ok(tctx, status, "FFPCNEx failed");
 	
 	torture_assert_werr_ok(tctx, r.out.result, "error return code for FFPCNEx");
 
@@ -286,6 +288,8 @@
 	struct torture_rpc_tcase *tcase = torture_suite_add_rpc_iface_tcase(suite, 
 									"notify", &ndr_table_spoolss);
 
+
+	ntvfs_init();
 	torture_rpc_tcase_add_test(tcase, "testRFFPCNEx", test_RFFPCNEx);
 	
 	return suite;



More information about the samba-cvs mailing list