diff --git a/include/rpc_dce.h b/include/rpc_dce.h
index a493691..bd2b410 100644
--- a/include/rpc_dce.h
+++ b/include/rpc_dce.h
@@ -214,27 +214,19 @@ typedef struct rpc_bind_req_info
 
   uint8 num_elements;    /* the number of elements (0x1) */
   /* 3-byte pad */
-  uint16 context_id;      /* presentation context identifier (0x0) */
-  uint8 num_syntaxes;     /* the number of syntaxes (has always been 1?)(0x1) */
 
-  RPC_IFACE abstract;     /* num and vers. of interface client is using */
-  RPC_IFACE transfer;     /* num and vers. of interface to use for replies */
+	RPC_BIND_CONTEXT contexts[4];
   
 } RPC_HDR_RB;
 
 /* RPC_RESULTS - can only cope with one reason, right now... */
 typedef struct rpc_results_info
 {
-/* uint8[] # 4-byte alignment padding, against SMB header */
-
-  uint8 num_results; /* the number of results (0x01) */
-
-/* uint8[] # 4-byte alignment padding, against SMB header */
-
   uint16 result; /* result (0x00 = accept) */
   uint16 reason; /* reason (0x00 = no reason specified) */
+  RPC_IFACE transfer; /* the transfer syntax from the request */
 
-} RPC_RESULTS;
+} RPC_RESULT;
 
 /* RPC_HDR_BA */
 typedef struct rpc_hdr_ba_info
@@ -242,8 +234,8 @@ typedef struct rpc_hdr_ba_info
   RPC_HDR_BBA bba;
 
   RPC_ADDR_STR addr    ;  /* the secondary address string, as described earlier */
-  RPC_RESULTS  res     ; /* results and reasons */
-  RPC_IFACE    transfer; /* the transfer syntax from the request */
+  uint8 num_results;     /* the number of results (0x01) */
+  RPC_RESULT results[4];
 
 } RPC_HDR_BA;
 
diff --git a/rpc_client/cli_pipe.c b/rpc_client/cli_pipe.c
index 3cfe9b0..00d9585 100644
--- a/rpc_client/cli_pipe.c
+++ b/rpc_client/cli_pipe.c
@@ -536,21 +536,25 @@ static BOOL check_bind_response(RPC_HDR_BA * hdr_ba,
 		       hdr_ba->addr.str)); return False;
 	}
 
+	if (hdr_ba->num_results < 1)
+	{
+		DEBUG(1, ("bind_rpc_pipe: Empty resultlist\n"));
+		return False;
+	}
+
 	/* check the transfer syntax */
-	if (!((hdr_ba->transfer.version == transfer->version) &&
-	      (memcmp(&hdr_ba->transfer.uuid, &transfer->uuid,
-		      sizeof(transfer->uuid)) == 0)))
+	if (! rpc_iface_equal(&(hdr_ba->results[0].transfer), transfer))
 	{
 		DEBUG(0, ("bind_rpc_pipe: transfer syntax differs\n"));
 		return False;
 	}
 
 	/* lkclXXXX only accept one result: check the result(s) */
-	if (hdr_ba->res.num_results != 0x1 || hdr_ba->res.result != 0)
+	if (hdr_ba->num_results != 0x1 || hdr_ba->results[0].result != 0)
 	{
 		DEBUG(2,
 		      ("bind_rpc_pipe: bind denied results: %d reason: %x\n",
-		       hdr_ba->res.num_results, hdr_ba->res.reason));
+		       hdr_ba->num_results, hdr_ba->results[0].reason));
 	}
 
 	DEBUG(5, ("bind_rpc_pipe: accepted!\n"));
diff --git a/rpc_parse/parse_rpc.c b/rpc_parse/parse_rpc.c
index c044d81..b718e12 100644
--- a/rpc_parse/parse_rpc.c
+++ b/rpc_parse/parse_rpc.c
@@ -430,14 +430,15 @@ BOOL make_rpc_hdr_rb(RPC_HDR_RB * rpc,
 	make_rpc_hdr_bba(&rpc->bba, max_tsize, max_rsize, assoc_gid);
 
 	rpc->num_elements = num_elements;	/* the number of elements (0x1) */
-	rpc->context_id = context_id;	/* presentation context identifier (0x0) */
-	rpc->num_syntaxes = num_syntaxes;	/* the number of syntaxes (has always been 1?)(0x1) */
+
+	rpc->contexts[0].context_id = context_id;	/* presentation context identifier (0x0) */
+	rpc->contexts[0].num_syntaxes = num_syntaxes;	/* the number of syntaxes (has always been 1?)(0x1) */
 
 	/* num and vers. of interface client is using */
-	rpc->abstract = *abstract;
+	rpc->contexts[0].abstract = *abstract;
 
 	/* num and vers. of interface to use for replies */
-	rpc->transfer = *transfer;
+	rpc->contexts[0].transfer = *transfer;
 
 	return True;
 }
@@ -447,6 +448,8 @@ reads or writes an RPC_HDR_RB structure.
 ********************************************************************/
 RPC_IO_DECLARE(smb_io_rpc_hdr_rb, RPC_HDR_RB, rpc)
 {
+	size_t i;
+
 	if (rpc == NULL)
 		return False;
 
@@ -458,13 +461,14 @@ RPC_IO_DECLARE(smb_io_rpc_hdr_rb, RPC_HDR_RB, rpc)
 
 	prs_uint8("num_elements", ps, depth, &rpc->num_elements);
 	prs_align(ps);
-	prs_uint16("context_id  ", ps, depth, &rpc->context_id);
-	prs_uint8("num_syntaxes", ps, depth, &rpc->num_syntaxes);
 
-	if(!smb_io_rpc_iface("abstract", &rpc->abstract, ps, depth))
-		return False;
-	if(!smb_io_rpc_iface("transfer", &rpc->transfer, ps, depth))
-		return False;
+	SMB_ASSERT_ARRAY(rpc->contexts, rpc->num_elements);
+
+	for (i = 0; i < rpc->num_elements; i++)
+	{
+		if (! RPC_MARSH_SUBCALL(rpc_io_rpc_bind_iface_context, rpc, contexts[i]))
+			return False;
+	}
 
 	return True;
 }
@@ -475,16 +479,21 @@ creates an RPC_RESULTS structure.
 lkclXXXX only one reason at the moment!
 
 ********************************************************************/
-static BOOL make_rpc_results(RPC_RESULTS * res,
-			     uint8 num_results, uint16 result, uint16 reason)
+static BOOL make_rpc_result(RPC_RESULT *res,
+			     uint16 result, uint16 reason,
+			     const RPC_IFACE *transfer)
 {
 	if (res == NULL)
 		return False;
 
-	res->num_results = num_results;	/* the number of results (0x01) */
 	res->result = result;	/* result (0x00 = accept) */
 	res->reason = reason;	/* reason (0x00 = no reason specified) */
 
+	if (transfer)
+		res->transfer = *transfer;
+	else
+		ZERO_STRUCT(res->transfer);
+
 	return True;
 }
 
@@ -494,22 +503,14 @@ reads or writes an RPC_RESULTS structure.
 lkclXXXX only one reason at the moment!
 
 ********************************************************************/
-static RPC_IO_DECLARE(smb_io_rpc_results, RPC_RESULTS, res)
+static RPC_IO_DECLARE(smb_io_rpc_result, RPC_RESULT, res)
 {
-	if (res == NULL)
-		return False;
-
-	prs_debug(ps, depth, desc, "smb_io_rpc_results");
-	depth++;
-
-	prs_align(ps);
-
-	prs_uint8("num_results", ps, depth, &(res->num_results));
-
-	prs_align(ps);
+	RPC_MARSHALLER_INTRO(res);
 
 	prs_uint16("result     ", ps, depth, &(res->result));
 	prs_uint16("reason     ", ps, depth, &(res->reason));
+	if(! RPC_MARSH_SUBCALL(smb_io_rpc_iface, res, transfer))
+		return False;
 
 	return True;
 }
@@ -524,18 +525,22 @@ jfm: nope two ! The pipe_addr can be NULL !
 BOOL make_rpc_hdr_ba(RPC_HDR_BA * rpc,
 		     uint16 max_tsize, uint16 max_rsize, uint32 assoc_gid,
 		     const char *pipe_addr,
-		     uint8 num_results, uint16 result, uint16 reason,
-		     RPC_IFACE * transfer)
+		     uint8 num_results,
+		     const RPC_IFACE *transfer)
 {
+	size_t i;
+
 	if (rpc == NULL || transfer == NULL)
 		return False;
 
 	make_rpc_hdr_bba(&(rpc->bba), max_tsize, max_rsize, assoc_gid);
 	make_rpc_addr_str(&(rpc->addr), pipe_addr);
-	make_rpc_results(&(rpc->res), num_results, result, reason);
+	rpc->num_results = num_results;
+	make_rpc_result(&(rpc->results[0]), 0, 0, transfer);
 
-	/* the transfer syntax from the request */
-	rpc->transfer = *transfer;
+	SMB_ASSERT_ARRAY(rpc->results, num_results);
+	for (i = 1; i < num_results; i++)
+		make_rpc_result(&(rpc->results[i]), 2, 2, NULL);
 
 	return True;
 }
@@ -545,20 +550,25 @@ reads or writes an RPC_HDR_BA structure.
 ********************************************************************/
 RPC_IO_DECLARE(smb_io_rpc_hdr_ba, RPC_HDR_BA, rpc)
 {
-	if (rpc == NULL)
-		return False;
+	size_t i;
 
-	prs_debug(ps, depth, desc, "smb_io_rpc_hdr_ba");
-	depth++;
+	RPC_MARSHALLER_INTRO_NOALIGN(rpc);
 
 	if(!smb_io_rpc_hdr_bba("", &rpc->bba, ps, depth))
 		return False;
 	if(!smb_io_rpc_addr_str("", &rpc->addr, ps, depth))
 		return False;
-	if(!smb_io_rpc_results("", &rpc->res, ps, depth))
-		return False;
-	if(!smb_io_rpc_iface("", &rpc->transfer, ps, depth))
-		return False;
+
+	prs_align(ps);
+	prs_uint8("num_results", ps, depth, &(rpc->num_results));
+
+	SMB_ASSERT_ARRAY(rpc->results, rpc->num_results);
+
+	for (i = 0; i < rpc->num_results; i++)
+	{
+		if(!RPC_MARSH_SUBCALL(smb_io_rpc_result, rpc, results[i]))
+			return False;
+	}
 
 	return True;
 }
diff --git a/rpc_server/srv_pipe_srv.c b/rpc_server/srv_pipe_srv.c
index 1c29d46..434979f 100644
--- a/rpc_server/srv_pipe_srv.c
+++ b/rpc_server/srv_pipe_srv.c
@@ -261,7 +261,7 @@ static BOOL srv_pipe_bind_and_alt_req(const struct api_cmd *api_cmd,
 	prs_struct rhdr;
 	uint32 assoc_gid;
 
-	RPC_HDR_RB *hdr_rb;
+	const RPC_HDR_RB *hdr_rb;
 	char *uuid_transfer, *uuid_abstract;
 	RPC_IFACE ret_abstract;
 
@@ -281,23 +281,23 @@ static BOOL srv_pipe_bind_and_alt_req(const struct api_cmd *api_cmd,
 
 	hdr_rb = &l->hdr_rb;
 
-	uuid_transfer = rpc_uuid_to_str(&hdr_rb->transfer.uuid);
-	uuid_abstract = rpc_uuid_to_str(&hdr_rb->abstract.uuid);
+	uuid_transfer = rpc_uuid_to_str(&hdr_rb->contexts[0].transfer.uuid);
+	uuid_abstract = rpc_uuid_to_str(&hdr_rb->contexts[0].abstract.uuid);
 
 	DEBUG(5, ("srv_pipe_bind_and_alt_req: transfer: %s, 0x%x, "
 		  "abstract: %s, 0x%x\n",
-		  uuid_transfer, hdr_rb->transfer.version,
-		  uuid_abstract, hdr_rb->abstract.version));
+		  uuid_transfer, hdr_rb->contexts[0].transfer.version,
+		  uuid_abstract, hdr_rb->contexts[0].abstract.version));
 
 	if (api_cmd->abstract
-	    && (memcmp(&hdr_rb->abstract, api_cmd->abstract,
-		       sizeof(hdr_rb->abstract)) != 0))
+	    && !rpc_iface_equal(&hdr_rb->contexts[0].abstract,
+				api_cmd->abstract))
 	{
 		char *uuid_server = rpc_uuid_to_str(&api_cmd->abstract->uuid);
 
 		DEBUG(1, ("srv_pipe_bind_and_alt_req: Client requests "
 			  "abstract %s, 0x%x, we only have %s, 0x%x\n",
-			  uuid_abstract, hdr_rb->abstract.version,
+			  uuid_abstract, hdr_rb->contexts[0].abstract.version,
 			  uuid_server, api_cmd->abstract->version));
 		safe_free(uuid_server);
 
@@ -305,7 +305,7 @@ static BOOL srv_pipe_bind_and_alt_req(const struct api_cmd *api_cmd,
 	}
 	else
 	{
-		ret_abstract = hdr_rb->transfer;
+		ret_abstract = hdr_rb->contexts[0].transfer;
 	}
 
 	safe_free(uuid_transfer);
@@ -363,20 +363,10 @@ static BOOL srv_pipe_bind_and_alt_req(const struct api_cmd *api_cmd,
 		l->auth_info = NULL;
 
 		assoc_gid = l->hdr_rb.bba.assoc_gid;
-#if 0
-		if (assoc_gid != 0)
-		{
-			l->key.pid = assoc_gid;
-		}
-#endif
 	}
 
-#if 0
 	if (assoc_gid == 0)
-	{
 		assoc_gid = sys_getpid();
-	}
-#endif
 
 	if (l->auth != NULL)
 	{
@@ -402,7 +392,7 @@ static BOOL srv_pipe_bind_and_alt_req(const struct api_cmd *api_cmd,
 			l->hdr_rb.bba.max_tsize,
 			l->hdr_rb.bba.max_rsize,
 			assoc_gid,
-			ack_pipe_name, 0x1, 0x0, 0x0, &ret_abstract);
+			ack_pipe_name, hdr_rb->num_elements, &ret_abstract);
 
 	smb_io_rpc_hdr_ba("", &l->hdr_ba, &l->rdata, 0);
 	prs_realloc_data(&l->rdata, l->rdata.offset);

