diff options
Diffstat (limited to 'common/nslcd-prot.c')
-rw-r--r-- | common/nslcd-prot.c | 38 |
1 files changed, 0 insertions, 38 deletions
diff --git a/common/nslcd-prot.c b/common/nslcd-prot.c index 87c0066..e4d5a3c 100644 --- a/common/nslcd-prot.c +++ b/common/nslcd-prot.c @@ -55,41 +55,3 @@ to be able to tio_reset() the stream to re-read the current entity. Since group entities can grow arbitrarily large, this setting limits the number of users that can be put in a group. */ - -/* returns a socket to the server or NULL on error (see errno), - socket should be closed with fclose() */ -TFILE *nslcd_client_open() -{ - int sock; - struct sockaddr_un addr; - TFILE *fp; - int flags; - /* create a socket */ - if ((sock = socket(PF_UNIX, SOCK_STREAM, 0)) < 0) - return NULL; - /* create socket address structure */ - memset(&addr, 0, sizeof(struct sockaddr_un)); - addr.sun_family = AF_UNIX; - strncpy(addr.sun_path, NSLCD_SOCKET, sizeof(addr.sun_path)); - addr.sun_path[sizeof(addr.sun_path) - 1] = '\0'; - /* close the file descriptor on exec (ignore errors) */ - flags = fcntl(sock, F_GETFL); - if (flags >= 0) - (void)fcntl(sock, F_SETFD, flags | FD_CLOEXEC); - /* connect to the socket */ - if (connect(sock, (struct sockaddr *)&addr, SUN_LEN(&addr)) < 0) - { - (void)close(sock); - return NULL; - } - /* create a stream object */ - if ((fp = tio_fdopen(sock, READ_TIMEOUT, WRITE_TIMEOUT, - READBUFFER_MINSIZE, READBUFFER_MAXSIZE, - WRITEBUFFER_MINSIZE, WRITEBUFFER_MAXSIZE)) == NULL) - { - (void)close(sock); - return NULL; - } - /* return the stream */ - return fp; -} |