diff options
author | Luke Leighton <lkcl@samba.org> | 1999-12-04 19:14:37 +0000 |
---|---|---|
committer | Luke Leighton <lkcl@samba.org> | 1999-12-04 19:14:37 +0000 |
commit | d923bc8da2cf996408194d98381409191dd81a16 (patch) | |
tree | 916b7cf8cd4b997136b801a4da10c616e0f1b3d2 /source/lib | |
parent | 06390e792cd8aa57a91c3a3d1d267fd1bcdc17a1 (diff) | |
download | samba-d923bc8da2cf996408194d98381409191dd81a16.tar.gz samba-d923bc8da2cf996408194d98381409191dd81a16.tar.xz samba-d923bc8da2cf996408194d98381409191dd81a16.zip |
jeremy is going to hate me for this.
created an "nmb-agent" utility that, yes: it connects to the 137 socket
and accepts unix socket connections which it redirects onto port 137.
it uses the name_trn_id field to filter requests to the correct
location.
name_query() and name_status() are the first victims to use this
feature (by specifying a file descriptor of -1).
Diffstat (limited to 'source/lib')
-rw-r--r-- | source/lib/util_sock.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/source/lib/util_sock.c b/source/lib/util_sock.c index fc5c2958e45..c0ca723e389 100644 --- a/source/lib/util_sock.c +++ b/source/lib/util_sock.c @@ -862,3 +862,35 @@ char *client_addr(int fd) global_client_addr_done = True; return addr_buf; } + +/******************************************************************* + opens and connects to a unix pipe socket + ******************************************************************/ +int open_pipe_sock(char *path) +{ + int sock; + struct sockaddr_un sa; + + sock = socket(AF_UNIX, SOCK_STREAM, 0); + + if (sock < 0) + { + DEBUG(0, ("unix socket open failed\n")); + return sock; + } + + ZERO_STRUCT(sa); + sa.sun_family = AF_UNIX; + safe_strcpy(sa.sun_path, path, sizeof(sa.sun_path)-1); + + DEBUG(10, ("socket open succeeded. file name: %s\n", sa.sun_path)); + + if (connect(sock, (struct sockaddr*) &sa, sizeof(sa)) < 0) + { + DEBUG(0,("socket connect to %s failed\n", sa.sun_path)); + close(sock); + return -1; + } + + return sock; +} |