From: Ally Sommers dropbear.sh@gmail.com
--- server/fd.c | 10 ++-------- server/sock.c | 6 ++++++ 2 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/server/fd.c b/server/fd.c index 8bc44096071..027a1aa0500 100644 --- a/server/fd.c +++ b/server/fd.c @@ -1953,12 +1953,6 @@ struct fd *open_fd( struct fd *root, const char *name, struct unicode_str nt_nam
if (fd->unix_fd == -1) { - if (stat( name, &st )) - { - file_set_error(); - goto error; - } - /* check for trailing slash on file path */ if ((errno == ENOENT || (errno == ENOTDIR && !(options & FILE_DIRECTORY_FILE))) && name[strlen(name) - 1] == '/') { @@ -1971,7 +1965,7 @@ struct fd *open_fd( struct fd *root, const char *name, struct unicode_str nt_nam * without lock support. Contrary to POSIX, Linux returns ENXIO in this * case, so we also check that error code here. */ - else if ((errno == EOPNOTSUPP || errno == ENXIO) && S_ISSOCK(st.st_mode) && (options & FILE_DELETE_ON_CLOSE)) + else if ((errno == EOPNOTSUPP || errno == ENXIO) && !stat(name, &st) && S_ISSOCK(st.st_mode) && (options & FILE_DELETE_ON_CLOSE)) ; /* no error, go to regular deletion code path */ else { @@ -1983,9 +1977,9 @@ struct fd *open_fd( struct fd *root, const char *name, struct unicode_str nt_nam
fd->nt_name = dup_nt_name( root, nt_name, &fd->nt_namelen ); fd->unix_name = NULL; - /* st was set from the file name if the file could not be opened */ if (fd->unix_fd != -1) fstat( fd->unix_fd, &st ); + /* st was set from the file name in case of sockets */ *mode = st.st_mode;
/* only bother with an inode for normal files and directories */ diff --git a/server/sock.c b/server/sock.c index b22621ec92e..d1433e862d9 100644 --- a/server/sock.c +++ b/server/sock.c @@ -1954,6 +1954,12 @@ static int init_socket( struct sock *sock, int family, int type, int protocol ) return -1; }
+ if (unix_family == AF_UNIX && unix_type == SOCK_DGRAM) + { + set_win32_error(WSAEAFNOSUPPORT); + return -1; + } + sockfd = socket( unix_family, unix_type, unix_protocol );
#ifdef linux