summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Lindstrom <mouring@eviladmin.org>2001-01-15 02:34:37 +0000
committerBen Lindstrom <mouring@eviladmin.org>2001-01-15 02:34:37 +0000
commit42202bc8cffb0932ac7e6c1eb483cd20176c01c9 (patch)
tree869bcc038453e50a38fc6c2cf7086d0b9201f502
parent200e3c9c9adfeafe431c7af1aeb7a3dd9d4ac130 (diff)
- (bal) utimes() support via utime() interface on machine that lack utimes().
-rw-r--r--ChangeLog1
-rw-r--r--acconfig.h3
-rw-r--r--bsd-misc.c12
-rw-r--r--bsd-misc.h13
-rw-r--r--configure.in19
-rw-r--r--includes.h3
6 files changed, 48 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 56da470b9..481a13321 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,6 @@
120010115 120010115
2 - (bal) sftp-server.c change to use chmod() if fchmod() does not exist. 2 - (bal) sftp-server.c change to use chmod() if fchmod() does not exist.
3 - (bal) utimes() support via utime() interface on machine that lack utimes().
3 4
420010114 520010114
5 - (stevesk) initial work for OpenBSD "support supplementary group in 6 - (stevesk) initial work for OpenBSD "support supplementary group in
diff --git a/acconfig.h b/acconfig.h
index 6f56deb0a..e2c34317d 100644
--- a/acconfig.h
+++ b/acconfig.h
@@ -103,6 +103,9 @@
103 * message at run-time. */ 103 * message at run-time. */
104#undef RSAREF 104#undef RSAREF
105 105
106/* struct timeval */
107#undef HAVE_STRUCT_TIMEVAL
108
106/* struct utmp and struct utmpx fields */ 109/* struct utmp and struct utmpx fields */
107#undef HAVE_HOST_IN_UTMP 110#undef HAVE_HOST_IN_UTMP
108#undef HAVE_HOST_IN_UTMPX 111#undef HAVE_HOST_IN_UTMPX
diff --git a/bsd-misc.c b/bsd-misc.c
index 2a0596593..2e59019bc 100644
--- a/bsd-misc.c
+++ b/bsd-misc.c
@@ -80,3 +80,15 @@ const char *strerror(int e)
80 return(sys_errlist[e]); 80 return(sys_errlist[e]);
81} 81}
82#endif 82#endif
83
84#ifndef HAVE_UTIMES
85int utimes(char *filename, struct timeval *tvp)
86{
87 struct utimbuf ub;
88
89 ub.actime = tvp->tv_sec;
90 ub.modtime = tvp->tv_usec;
91
92 return(utime(filename, &ub));
93}
94#endif
diff --git a/bsd-misc.h b/bsd-misc.h
index d8376562a..e02c66783 100644
--- a/bsd-misc.h
+++ b/bsd-misc.h
@@ -54,4 +54,17 @@ int seteuid(uid_t euid);
54const char *strerror(int e); 54const char *strerror(int e);
55#endif 55#endif
56 56
57
58#ifndef HAVE_UTIMES
59#ifndef HAVE_STRUCT_TIMEVAL
60struct timeval {
61 long tv_sec;
62 long tv_usec;
63}
64#endif /* HAVE_STRUCT_TIMEVAL */
65
66int utimes(char *filename, struct timeval *tvp);
67#endif /* HAVE_UTIMES */
68
69
57#endif /* _BSD_MISC_H */ 70#endif /* _BSD_MISC_H */
diff --git a/configure.in b/configure.in
index 1ee188565..82cb5d4bd 100644
--- a/configure.in
+++ b/configure.in
@@ -313,10 +313,10 @@ AC_CHECK_FUNC(utimes,
313) 313)
314 314
315# Checks for header files. 315# Checks for header files.
316AC_CHECK_HEADERS(bstring.h endian.h floatingpoint.h getopt.h lastlog.h limits.h login.h login_cap.h maillock.h netdb.h netgroup.h netinet/in_systm.h paths.h poll.h pty.h shadow.h security/pam_appl.h sys/bitypes.h sys/bsdtty.h sys/cdefs.h sys/poll.h sys/queue.h sys/select.h sys/stat.h sys/stropts.h sys/sysmacros.h sys/time.h sys/ttcompat.h sys/un.h stddef.h time.h ttyent.h usersec.h util.h utmp.h utmpx.h vis.h) 316AC_CHECK_HEADERS(bstring.h endian.h floatingpoint.h getopt.h lastlog.h limits.h login.h login_cap.h maillock.h netdb.h netgroup.h netinet/in_systm.h paths.h poll.h pty.h shadow.h security/pam_appl.h sys/bitypes.h sys/bsdtty.h sys/cdefs.h sys/poll.h sys/queue.h sys/select.h sys/stat.h sys/stropts.h sys/sysmacros.h sys/time.h sys/ttcompat.h sys/un.h stddef.h time.h ttyent.h usersec.h util.h utime.h utmp.h utmpx.h vis.h)
317 317
318dnl Checks for library functions. 318dnl Checks for library functions.
319AC_CHECK_FUNCS(arc4random atexit b64_ntop bcopy bindresvport_af clock fchmod freeaddrinfo futimes gai_strerror getcwd getaddrinfo getgrouplist getnameinfo getrlimit getrusage getttyent inet_aton inet_ntoa innetgr login_getcapbool md5_crypt memmove mkdtemp on_exit openpty realpath rresvport_af setdtablesize setenv seteuid setlogin setproctitle setreuid setrlimit setsid sigaction sigvec snprintf strerror strlcat strlcpy strsep strtok_r sysconf vsnprintf vhangup vis waitpid _getpty __b64_ntop) 319AC_CHECK_FUNCS(arc4random atexit b64_ntop bcopy bindresvport_af clock fchmod freeaddrinfo futimes gai_strerror getcwd getaddrinfo getgrouplist getnameinfo getrlimit getrusage getttyent inet_aton inet_ntoa innetgr login_getcapbool md5_crypt memmove mkdtemp on_exit openpty realpath rresvport_af setdtablesize setenv seteuid setlogin setproctitle setreuid setrlimit setsid sigaction sigvec snprintf strerror strlcat strlcpy strsep strtok_r sysconf utimes vsnprintf vhangup vis waitpid _getpty __b64_ntop)
320dnl Checks for time functions 320dnl Checks for time functions
321AC_CHECK_FUNCS(gettimeofday time) 321AC_CHECK_FUNCS(gettimeofday time)
322dnl Checks for libutil functions 322dnl Checks for libutil functions
@@ -825,14 +825,27 @@ if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
825 AC_DEFINE(HAVE_STRUCT_ADDRINFO) 825 AC_DEFINE(HAVE_STRUCT_ADDRINFO)
826fi 826fi
827 827
828AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
829 AC_TRY_COMPILE(
830 [ #include <sys/time.h> ],
831 [ struct timeval tv; tv.tv_sec = 1;],
832 [ ac_cv_have_struct_timeval="yes" ],
833 [ ac_cv_have_struct_timeval="no" ]
834 )
835])
836if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
837 AC_DEFINE(HAVE_STRUCT_TIMEVAL)
838 have_struct_timeval=1
839fi
840
828# If we don't have int64_t then we can't compile sftp-server. So don't 841# If we don't have int64_t then we can't compile sftp-server. So don't
829# even attempt to do it. 842# even attempt to do it.
830if test "x$ac_cv_have_int64_t" = "xno" -a \ 843if test "x$ac_cv_have_int64_t" = "xno" -a \
831 "x$ac_cv_sizeof_long_int" != "x8" -a \ 844 "x$ac_cv_sizeof_long_int" != "x8" -a \
832 "x$ac_cv_sizeof_long_long_int" = "x0" ; then 845 "x$ac_cv_sizeof_long_long_int" = "x0" ; then
833 NO_SFTP='#' 846 NO_SFTP='#'
834 AC_SUBST(NO_SFTP)
835fi 847fi
848AC_SUBST(NO_SFTP)
836 849
837dnl Checks for structure members 850dnl Checks for structure members
838OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP) 851OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
diff --git a/includes.h b/includes.h
index 96e97ca59..fc269e8eb 100644
--- a/includes.h
+++ b/includes.h
@@ -85,6 +85,9 @@ static /**/const char *const rcsid[] = { (char *)rcsid, "\100(#)" msg }
85#ifdef HAVE_SYS_SYSMACROS_H 85#ifdef HAVE_SYS_SYSMACROS_H
86# include <sys/sysmacros.h> 86# include <sys/sysmacros.h>
87#endif 87#endif
88#ifdef HAVE_UTIME_H
89# include <utime.h>
90#endif
88#ifdef HAVE_VIS_H 91#ifdef HAVE_VIS_H
89# include <vis.h> 92# include <vis.h>
90#endif 93#endif