From 87325613962ced1d58249e37a0375f0a3e857098 Mon Sep 17 00:00:00 2001
From: Volker Lendecke <vl@samba.org>
Date: Mon, 3 Jan 2022 13:33:22 +0100
Subject: [PATCH] lib: Remove unused tstream_npa_socketpair()

This was used in the pre samba-dcerpcd source3 rpc server.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
---
 libcli/named_pipe_auth/npa_tstream.c | 83 ----------------------------
 libcli/named_pipe_auth/npa_tstream.h | 10 ----
 2 files changed, 93 deletions(-)

diff --git a/libcli/named_pipe_auth/npa_tstream.c b/libcli/named_pipe_auth/npa_tstream.c
index 85d0aa482d3..506c4a35681 100644
--- a/libcli/named_pipe_auth/npa_tstream.c
+++ b/libcli/named_pipe_auth/npa_tstream.c
@@ -1388,86 +1388,3 @@ int _tstream_npa_accept_existing_recv(
 	tevent_req_received(req);
 	return 0;
 }
-
-
-/* SOCKETPAIR for internal rpc communication */
-
-/* file_type is FILE_TYPE_BYTE_MODE_PIPE or FILE_TYPE_MESSAGE_MODE_PIPE */
-int _tstream_npa_socketpair(uint16_t file_type,
-			    TALLOC_CTX *mem_ctx1,
-			    struct tstream_context **pstream1,
-			    TALLOC_CTX *mem_ctx2,
-			    struct tstream_context **pstream2,
-			    const char *location)
-{
-	struct tstream_context *stream1 = NULL;
-	struct tstream_context *stream2 = NULL;
-	int fds[2];
-	int fd1;
-	int fd2;
-	int rc;
-	bool ok;
-
-	rc = socketpair(AF_UNIX, SOCK_STREAM, 0, fds);
-	if (rc == -1) {
-		return -1;
-	}
-	fd1 = fds[0];
-	fd2 = fds[1];
-
-	ok = smb_set_close_on_exec(fd1);
-	if (!ok) {
-		goto close_fail;
-	}
-
-	ok = smb_set_close_on_exec(fd2);
-	if (!ok) {
-		goto close_fail;
-	}
-
-	rc = set_blocking(fd1, false);
-	if (rc == -1) {
-		goto close_fail;
-	}
-
-	rc = set_blocking(fd2, false);
-	if (rc == -1) {
-		goto close_fail;
-	}
-
-	rc = _tstream_npa_existing_socket(mem_ctx1,
-					  fd1,
-					  file_type,
-					  &stream1,
-					  location);
-	if (rc == -1) {
-		goto close_fail;
-	}
-
-	rc = _tstream_npa_existing_socket(mem_ctx2,
-					  fd2,
-					  file_type,
-					  &stream2,
-					  location);
-	if (rc == -1) {
-		int sys_errno = errno;
-		talloc_free(stream1);
-		close(fd2);
-		errno = sys_errno;
-		return -1;
-	}
-
-	*pstream1 = stream1;
-	*pstream2 = stream2;
-
-	return 0;
-
-close_fail:
-	{
-		int sys_errno = errno;
-		close(fd1);
-		close(fd2);
-		errno = sys_errno;
-		return -1;
-	}
-}
diff --git a/libcli/named_pipe_auth/npa_tstream.h b/libcli/named_pipe_auth/npa_tstream.h
index 5b08a40b672..1d7e93dc0fa 100644
--- a/libcli/named_pipe_auth/npa_tstream.h
+++ b/libcli/named_pipe_auth/npa_tstream.h
@@ -142,14 +142,4 @@ int _tstream_npa_accept_existing_recv(
 					  session_info, \
 					  __location__)
 
-int _tstream_npa_socketpair(uint16_t file_type,
-			    TALLOC_CTX *mem_ctx1,
-			    struct tstream_context **pstream1,
-			    TALLOC_CTX *mem_ctx2,
-			    struct tstream_context **pstream2,
-			    const char *location);
-#define tstream_npa_socketpair(ft, mem1, stream1, mem2, stream2) \
-	_tstream_npa_socketpair(ft, mem1, stream1, mem2, stream2, \
-				__location__)
-
 #endif /* NPA_TSTREAM_H */