summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2008-10-22 04:30:54 +0200
committerJelmer Vernooij <jelmer@samba.org>2008-10-22 04:30:54 +0200
commit1d5beb7294d939504864c9b1203a5d7dcde7041a (patch)
tree282c4cb243597bd97e8302239595a4a2c0fd438b
parent6d9b24de782b04466ca3c1ce6f6e82d54e93d2f3 (diff)
downloadsamba-1d5beb7294d939504864c9b1203a5d7dcde7041a.tar.gz
samba-1d5beb7294d939504864c9b1203a5d7dcde7041a.tar.bz2
samba-1d5beb7294d939504864c9b1203a5d7dcde7041a.zip
Remove pstring usage.
-rw-r--r--source4/nsswitch/wb_common.c14
1 files changed, 4 insertions, 10 deletions
diff --git a/source4/nsswitch/wb_common.c b/source4/nsswitch/wb_common.c
index 2ae85dcb1e..6cf4223043 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;
}