From: Jelmer Vernooij Date: Wed, 22 Oct 2008 02:30:54 +0000 (+0200) Subject: Remove pstring usage. X-Git-Url: http://git.samba.org/samba.git/?p=kai%2Fsamba.git;a=commitdiff_plain;h=1d5beb7294d939504864c9b1203a5d7dcde7041a Remove pstring usage. --- diff --git a/source4/nsswitch/wb_common.c b/source4/nsswitch/wb_common.c index 2ae85dcb1eb..6cf4223043b 100644 --- a/source4/nsswitch/wb_common.c +++ b/source4/nsswitch/wb_common.c @@ -168,7 +168,7 @@ static int winbind_named_pipe_sock(const char *dir) { struct sockaddr_un sunaddr; struct stat st; - pstring path; + char *path; int fd; int wait_time; int slept; @@ -186,24 +186,18 @@ static int winbind_named_pipe_sock(const char *dir) /* Connect to socket */ - strncpy(path, dir, sizeof(path) - 1); - path[sizeof(path) - 1] = '\0'; - - strncat(path, "/", sizeof(path) - 1 - strlen(path)); - path[sizeof(path) - 1] = '\0'; - - strncat(path, WINBINDD_SOCKET_NAME, sizeof(path) - 1 - strlen(path)); - path[sizeof(path) - 1] = '\0'; + asprintf(&path, "%s/%s", dir, WINBINDD_SOCKET_NAME); ZERO_STRUCT(sunaddr); sunaddr.sun_family = AF_UNIX; strncpy(sunaddr.sun_path, path, sizeof(sunaddr.sun_path) - 1); + SAFE_FREE(path); /* If socket file doesn't exist, don't bother trying to connect with retry. This is an attempt to make the system usable when the winbindd daemon is not running. */ - if (lstat(path, &st) == -1) { + if (lstat(sunaddr.sun_path, &st) == -1) { return -1; }