summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog4
-rw-r--r--acconfig.h5
-rw-r--r--configure.in16
-rw-r--r--sftp-glob.c22
4 files changed, 38 insertions, 9 deletions
diff --git a/ChangeLog b/ChangeLog
index 8c3daff67..87a4ec649 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,8 @@
2 - (djm) Reorder tests and library inclusion for Krb4/AFS to try to 2 - (djm) Reorder tests and library inclusion for Krb4/AFS to try to
3 resolve linking conflicts with libcrypto. Report and suggested fix 3 resolve linking conflicts with libcrypto. Report and suggested fix
4 from Holger Trapp <Holger.Trapp@Informatik.TU-Chemnitz.DE> 4 from Holger Trapp <Holger.Trapp@Informatik.TU-Chemnitz.DE>
5 - (djm) Work around Solaris' broken struct dirent. Diagnosis and suggested
6 fix from Philippe Levan <levan@epix.net>
5 7
620010327 820010327
7 - Attempt sync with sshlogin.c w/ OpenBSD (mainly CVS ID) 9 - Attempt sync with sshlogin.c w/ OpenBSD (mainly CVS ID)
@@ -4730,4 +4732,4 @@
4730 - Wrote replacements for strlcpy and mkdtemp 4732 - Wrote replacements for strlcpy and mkdtemp
4731 - Released 1.0pre1 4733 - Released 1.0pre1
4732 4734
4733$Id: ChangeLog,v 1.1022 2001/03/28 03:03:42 djm Exp $ 4735$Id: ChangeLog,v 1.1023 2001/03/28 04:35:30 djm Exp $
diff --git a/acconfig.h b/acconfig.h
index 57b5e6076..928277a36 100644
--- a/acconfig.h
+++ b/acconfig.h
@@ -1,4 +1,4 @@
1/* $Id: acconfig.h,v 1.108 2001/03/17 01:15:38 mouring Exp $ */ 1/* $Id: acconfig.h,v 1.109 2001/03/28 04:35:30 djm Exp $ */
2 2
3#ifndef _CONFIG_H 3#ifndef _CONFIG_H
4#define _CONFIG_H 4#define _CONFIG_H
@@ -308,6 +308,9 @@
308/* Define if your system glob() function has gl_matchc options in glob_t */ 308/* Define if your system glob() function has gl_matchc options in glob_t */
309#undef GLOB_HAS_GL_MATCHC 309#undef GLOB_HAS_GL_MATCHC
310 310
311/* Define in your struct dirent expects you to allocate extra space for d_name */
312#undef BROKEN_ONE_BYTE_DIRENT_D_NAME
313
311@BOTTOM@ 314@BOTTOM@
312 315
313/* ******************* Shouldn't need to edit below this line ************** */ 316/* ******************* Shouldn't need to edit below this line ************** */
diff --git a/configure.in b/configure.in
index 638877edd..f6a0a6926 100644
--- a/configure.in
+++ b/configure.in
@@ -1,4 +1,4 @@
1# $Id: configure.in,v 1.268 2001/03/28 03:03:42 djm Exp $ 1# $Id: configure.in,v 1.269 2001/03/28 04:35:30 djm Exp $
2 2
3AC_INIT(ssh.c) 3AC_INIT(ssh.c)
4 4
@@ -404,6 +404,20 @@ AC_EGREP_CPP(FOUNDIT,
404 ] 404 ]
405) 405)
406 406
407AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
408AC_TRY_RUN(
409 [
410#include <sys/types.h>
411#include <dirent.h>
412int main(void){struct dirent d;return(sizeof(d.d_name)<=sizeof(char));}
413 ],
414 [AC_MSG_RESULT(yes)],
415 [
416 AC_MSG_RESULT(no)
417 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
418 ]
419)
420
407# Check whether user wants S/Key support 421# Check whether user wants S/Key support
408SKEY_MSG="no" 422SKEY_MSG="no"
409AC_ARG_WITH(skey, 423AC_ARG_WITH(skey,
diff --git a/sftp-glob.c b/sftp-glob.c
index 79dca00f1..f1252eecc 100644
--- a/sftp-glob.c
+++ b/sftp-glob.c
@@ -65,7 +65,9 @@ void *fudge_opendir(const char *path)
65 65
66struct dirent *fudge_readdir(struct SFTP_OPENDIR *od) 66struct dirent *fudge_readdir(struct SFTP_OPENDIR *od)
67{ 67{
68 static struct dirent ret; 68 /* Solaris needs sizeof(dirent) + path length (see below) */
69 static char buf[sizeof(struct dirent) + MAXPATHLEN];
70 struct dirent *ret = (struct dirent *)buf;
69#ifdef __GNU_LIBRARY__ 71#ifdef __GNU_LIBRARY__
70 static int inum = 1; 72 static int inum = 1;
71#endif /* __GNU_LIBRARY__ */ 73#endif /* __GNU_LIBRARY__ */
@@ -73,22 +75,30 @@ struct dirent *fudge_readdir(struct SFTP_OPENDIR *od)
73 if (od->dir[od->offset] == NULL) 75 if (od->dir[od->offset] == NULL)
74 return(NULL); 76 return(NULL);
75 77
76 memset(&ret, 0, sizeof(ret)); 78 memset(buf, 0, sizeof(buf));
77 strlcpy(ret.d_name, od->dir[od->offset++]->filename,
78 sizeof(ret.d_name));
79 79
80 /*
81 * Solaris defines dirent->d_name as a one byte array and expects
82 * you to hack around it.
83 */
84#ifdef BROKEN_ONE_BYTE_DIRENT_D_NAME
85 strlcpy(ret->d_name, od->dir[od->offset++]->filename, MAXPATHLEN);
86#else
87 strlcpy(ret->d_name, od->dir[od->offset++]->filename,
88 sizeof(ret->d_name));
89#endif
80#ifdef __GNU_LIBRARY__ 90#ifdef __GNU_LIBRARY__
81 /* 91 /*
82 * Idiot glibc uses extensions to struct dirent for readdir with 92 * Idiot glibc uses extensions to struct dirent for readdir with
83 * ALTDIRFUNCs. Not that this is documented anywhere but the 93 * ALTDIRFUNCs. Not that this is documented anywhere but the
84 * source... Fake an inode number to appease it. 94 * source... Fake an inode number to appease it.
85 */ 95 */
86 ret.d_ino = inum++; 96 ret->d_ino = inum++;
87 if (!inum) 97 if (!inum)
88 inum = 1; 98 inum = 1;
89#endif /* __GNU_LIBRARY__ */ 99#endif /* __GNU_LIBRARY__ */
90 100
91 return(&ret); 101 return(ret);
92} 102}
93 103
94void fudge_closedir(struct SFTP_OPENDIR *od) 104void fudge_closedir(struct SFTP_OPENDIR *od)