at/at-secure_getenv.patch

58 lines
1.5 KiB
Diff

---
at.c | 10 +++++++++-
configure.ac | 6 ++++--
2 files changed, 13 insertions(+), 3 deletions(-)
Index: at-3.2.0/at.c
===================================================================
--- at-3.2.0.orig/at.c
+++ at-3.2.0/at.c
@@ -97,6 +97,14 @@
#define DEFAULT_QUEUE 'a'
#define BATCH_QUEUE 'b'
+#ifndef HAVE_SECURE_GETENV
+# ifdef HAVE___SECURE_GETENV
+# define secure_getenv __secure_getenv
+# else
+# error neither secure_getenv nor __secure_getenv is available
+# endif
+#endif
+
enum {
ATQ, BATCH, ATRM, AT, CAT
}; /* what program we want to run */
@@ -372,7 +380,7 @@ writefile(time_t runtimer, char queue)
*/
mailname = getlogin();
if (mailname == NULL)
- mailname = getenv("LOGNAME");
+ mailname = secure_getenv("LOGNAME");
if (mailname == NULL || mailname[0] == '\0' || getpwnam(mailname) == NULL) {
pass_entry = getpwuid(real_uid);
if (pass_entry != NULL)
Index: at-3.2.0/configure.ac
===================================================================
--- at-3.2.0.orig/configure.ac
+++ at-3.2.0/configure.ac
@@ -17,8 +17,9 @@ AC_SUBST(VERSION)
AC_CANONICAL_HOST
dnl Checks for programs.
-
-AC_PROG_CC
+AC_USE_SYSTEM_EXTENSIONS
+AC_PROG_CC_STDC
+AC_SYS_LARGEFILE
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_YACC
@@ -56,6 +57,7 @@ AC_CHECK_LIB(fl,yywrap,
PKG_CHECK_MODULES([HX], [libHX])
+AC_CHECK_FUNCS([__secure_getenv secure_getenv])
dnl Checks for header files.
AC_HEADER_DIRENT
AC_HEADER_STDC