svn commit: samba r14714 - in branches/SAMBA_4_0/source/librpc/rpc: .

abartlet at samba.org abartlet at samba.org
Sat Mar 25 11:39:10 GMT 2006


Author: abartlet
Date: 2006-03-25 11:39:09 +0000 (Sat, 25 Mar 2006)
New Revision: 14714

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

Log:
On DCE/RPC, we need the name of the remote server used on the socket,
for Kerberos.  It must be the full name contacted, not the 'called
name' we might want to use for \\server things, so add another function.

Andrew Bartlett

Modified:
   branches/SAMBA_4_0/source/librpc/rpc/dcerpc.h
   branches/SAMBA_4_0/source/librpc/rpc/dcerpc_auth.c
   branches/SAMBA_4_0/source/librpc/rpc/dcerpc_smb.c
   branches/SAMBA_4_0/source/librpc/rpc/dcerpc_smb2.c
   branches/SAMBA_4_0/source/librpc/rpc/dcerpc_sock.c


Changeset:
Modified: branches/SAMBA_4_0/source/librpc/rpc/dcerpc.h
===================================================================
--- branches/SAMBA_4_0/source/librpc/rpc/dcerpc.h	2006-03-25 11:30:06 UTC (rev 14713)
+++ branches/SAMBA_4_0/source/librpc/rpc/dcerpc.h	2006-03-25 11:39:09 UTC (rev 14714)
@@ -65,6 +65,8 @@
 
 		const char *(*peer_name)(struct dcerpc_connection *);
 
+		const char *(*target_hostname)(struct dcerpc_connection *);
+
 		/* send a request to the server */
 		NTSTATUS (*send_request)(struct dcerpc_connection *, DATA_BLOB *, BOOL trigger_read);
 

Modified: branches/SAMBA_4_0/source/librpc/rpc/dcerpc_auth.c
===================================================================
--- branches/SAMBA_4_0/source/librpc/rpc/dcerpc_auth.c	2006-03-25 11:30:06 UTC (rev 14713)
+++ branches/SAMBA_4_0/source/librpc/rpc/dcerpc_auth.c	2006-03-25 11:39:09 UTC (rev 14714)
@@ -228,7 +228,7 @@
 	}
 
 	c->status = gensec_set_target_hostname(
-		sec->generic_state, p->conn->transport.peer_name(p->conn));
+		sec->generic_state, p->conn->transport.target_hostname(p->conn));
 	if (!NT_STATUS_IS_OK(c->status)) {
 		DEBUG(1, ("Failed to set GENSEC target hostname: %s\n", 
 			  nt_errstr(c->status)));

Modified: branches/SAMBA_4_0/source/librpc/rpc/dcerpc_smb.c
===================================================================
--- branches/SAMBA_4_0/source/librpc/rpc/dcerpc_smb.c	2006-03-25 11:30:06 UTC (rev 14713)
+++ branches/SAMBA_4_0/source/librpc/rpc/dcerpc_smb.c	2006-03-25 11:39:09 UTC (rev 14714)
@@ -350,7 +350,7 @@
 }
 
 /*
-  return SMB server name
+  return SMB server name (called name)
 */
 static const char *smb_peer_name(struct dcerpc_connection *c)
 {
@@ -359,6 +359,15 @@
 }
 
 /*
+  return remote name we make the actual connection (good for kerberos) 
+*/
+static const char *smb_target_hostname(struct dcerpc_connection *c)
+{
+	struct smb_private *smb = talloc_get_type(c->transport.private, struct smb_private);
+	return smb->tree->session->transport->socket->hostname;
+}
+
+/*
   fetch the user session key 
 */
 static NTSTATUS smb_session_key(struct dcerpc_connection *c, DATA_BLOB *session_key)
@@ -462,14 +471,15 @@
 	/*
 	  fill in the transport methods
 	*/
-	c->transport.transport = NCACN_NP;
-	c->transport.private = NULL;
-	c->transport.shutdown_pipe = smb_shutdown_pipe;
-	c->transport.peer_name = smb_peer_name;
+	c->transport.transport       = NCACN_NP;
+	c->transport.private         = NULL;
+	c->transport.shutdown_pipe   = smb_shutdown_pipe;
+	c->transport.peer_name       = smb_peer_name;
+	c->transport.target_hostname = smb_target_hostname;
 
-	c->transport.send_request = smb_send_request;
-	c->transport.send_read = send_read_request;
-	c->transport.recv_data = NULL;
+	c->transport.send_request    = smb_send_request;
+	c->transport.send_read       = send_read_request;
+	c->transport.recv_data       = NULL;
 	
 	/* Over-ride the default session key with the SMB session key */
 	c->security_state.session_key = smb_session_key;

Modified: branches/SAMBA_4_0/source/librpc/rpc/dcerpc_smb2.c
===================================================================
--- branches/SAMBA_4_0/source/librpc/rpc/dcerpc_smb2.c	2006-03-25 11:30:06 UTC (rev 14713)
+++ branches/SAMBA_4_0/source/librpc/rpc/dcerpc_smb2.c	2006-03-25 11:39:09 UTC (rev 14714)
@@ -332,6 +332,16 @@
 }
 
 /*
+  return remote name we make the actual connection (good for kerberos) 
+*/
+static const char *smb2_target_hostname(struct dcerpc_connection *c)
+{
+	struct smb2_private *smb = talloc_get_type(c->transport.private, 
+						   struct smb2_private);
+	return smb->tree->session->transport->socket->hostname;
+}
+
+/*
   fetch the user session key 
 */
 static NTSTATUS smb2_session_key(struct dcerpc_connection *c, DATA_BLOB *session_key)
@@ -432,6 +442,7 @@
 	c->transport.private = NULL;
 	c->transport.shutdown_pipe = smb2_shutdown_pipe;
 	c->transport.peer_name = smb2_peer_name;
+	c->transport.target_hostname = smb2_target_hostname;
 
 	c->transport.send_request = smb2_send_request;
 	c->transport.send_read = send_read_request;

Modified: branches/SAMBA_4_0/source/librpc/rpc/dcerpc_sock.c
===================================================================
--- branches/SAMBA_4_0/source/librpc/rpc/dcerpc_sock.c	2006-03-25 11:30:06 UTC (rev 14713)
+++ branches/SAMBA_4_0/source/librpc/rpc/dcerpc_sock.c	2006-03-25 11:39:09 UTC (rev 14714)
@@ -187,11 +187,20 @@
 */
 static const char *sock_peer_name(struct dcerpc_connection *p)
 {
-	struct sock_private *sock = p->transport.private;
+	struct sock_private *sock = talloc_get_type(p->transport.private, struct sock_private);
 	return sock->server_name;
 }
 
+/*
+  return remote name we make the actual connection (good for kerberos) 
+*/
+static const char *sock_target_hostname(struct dcerpc_connection *p)
+{
+	struct sock_private *sock = talloc_get_type(p->transport.private, struct sock_private);
+	return sock->server_name;
+}
 
+
 struct pipe_open_socket_state {
 	struct dcerpc_connection *conn;
 	struct socket_context *socket_ctx;
@@ -226,15 +235,16 @@
 	/*
 	  fill in the transport methods
 	*/
-	conn->transport.transport     = s->transport;
-	conn->transport.private       = NULL;
+	conn->transport.transport       = s->transport;
+	conn->transport.private         = NULL;
 
-	conn->transport.send_request  = sock_send_request;
-	conn->transport.send_read     = sock_send_read;
-	conn->transport.recv_data     = NULL;
+	conn->transport.send_request    = sock_send_request;
+	conn->transport.send_read       = sock_send_read;
+	conn->transport.recv_data       = NULL;
 
-	conn->transport.shutdown_pipe = sock_shutdown_pipe;
-	conn->transport.peer_name     = sock_peer_name;
+	conn->transport.shutdown_pipe   = sock_shutdown_pipe;
+	conn->transport.peer_name       = sock_peer_name;
+	conn->transport.target_hostname = sock_target_hostname;
 
 	sock->sock          = s->socket_ctx;
 	sock->pending_reads = 0;



More information about the samba-cvs mailing list