]> granicus.if.org Git - sudo/commitdiff
Use strftime(3) instead of formatting struct tm by hand.
authorTodd C. Miller <Todd.Miller@sudo.ws>
Sat, 20 Jul 2019 02:14:44 +0000 (20:14 -0600)
committerTodd C. Miller <Todd.Miller@sudo.ws>
Sat, 20 Jul 2019 02:14:44 +0000 (20:14 -0600)
Fixes a warning on newer versions of gcc.

configure
configure.ac
plugins/sudoers/fmtsudoers.c
plugins/sudoers/parse.c

index b9634e651a6e1123b363c0a3c03713fa1fabf931..bf591dac7bf2173a3b15fff1acde4f6c647352db 100755 (executable)
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for sudo 1.8.28.
+# Generated by GNU Autoconf 2.69 for sudo 1.8.28b1.
 #
 # Report bugs to <https://bugzilla.sudo.ws/>.
 #
@@ -590,8 +590,8 @@ MAKEFLAGS=
 # Identity of this package.
 PACKAGE_NAME='sudo'
 PACKAGE_TARNAME='sudo'
-PACKAGE_VERSION='1.8.28'
-PACKAGE_STRING='sudo 1.8.28'
+PACKAGE_VERSION='1.8.28b1'
+PACKAGE_STRING='sudo 1.8.28b1'
 PACKAGE_BUGREPORT='https://bugzilla.sudo.ws/'
 PACKAGE_URL=''
 
@@ -1543,7 +1543,7 @@ if test "$ac_init_help" = "long"; then
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures sudo 1.8.28 to adapt to many kinds of systems.
+\`configure' configures sudo 1.8.28b1 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1608,7 +1608,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of sudo 1.8.28:";;
+     short | recursive ) echo "Configuration of sudo 1.8.28b1:";;
    esac
   cat <<\_ACEOF
 
@@ -1874,7 +1874,7 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-sudo configure 1.8.28
+sudo configure 1.8.28b1
 generated by GNU Autoconf 2.69
 
 Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2583,7 +2583,7 @@ cat >config.log <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by sudo $as_me 1.8.28, which was
+It was created by sudo $as_me 1.8.28b1, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   $ $0 $@
@@ -27506,7 +27506,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by sudo $as_me 1.8.28, which was
+This file was extended by sudo $as_me 1.8.28b1, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -27572,7 +27572,7 @@ _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
-sudo config.status 1.8.28
+sudo config.status 1.8.28b1
 configured by $0, generated by GNU Autoconf 2.69,
   with options \\"\$ac_cs_config\\"
 
index 65b145049df3bfa1325c286defac478180813bd8..e4055e26d974065b625b72848f765768073bc612 100644 (file)
@@ -18,7 +18,7 @@ dnl ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 dnl OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 dnl
 AC_PREREQ([2.59])
-AC_INIT([sudo], [1.8.28], [https://bugzilla.sudo.ws/], [sudo])
+AC_INIT([sudo], [1.8.28b1], [https://bugzilla.sudo.ws/], [sudo])
 AC_CONFIG_HEADER([config.h pathnames.h])
 AC_CONFIG_SRCDIR([src/sudo.c])
 dnl
index 0827e363c5dcae7055bf51b726d8b0f11a12ec7d..c93281f71e45f96495da2ed54e8c4343e1c261d5 100644 (file)
@@ -237,18 +237,14 @@ sudoers_format_cmndspec(struct sudo_lbuf *lbuf,
     if (cs->notbefore != UNSPEC && FIELD_CHANGED(prev_cs, cs, notbefore)) {
        char buf[sizeof("CCYYMMDDHHMMSSZ")];
        struct tm *tm = gmtime(&cs->notbefore);
-       (void)snprintf(buf, sizeof(buf), "%04d%02d%02d%02d%02d%02dZ",
-           tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday,
-           tm->tm_hour, tm->tm_min, tm->tm_sec);
-       sudo_lbuf_append(lbuf, "NOTBEFORE=%s ", buf);
+       if (strftime(buf, sizeof(buf), "%Y%m%d%H%M%SZ", tm) != 0)
+           sudo_lbuf_append(lbuf, "NOTBEFORE=%s ", buf);
     }
     if (cs->notafter != UNSPEC && FIELD_CHANGED(prev_cs, cs, notafter)) {
        char buf[sizeof("CCYYMMDDHHMMSSZ")];
        struct tm *tm = gmtime(&cs->notafter);
-       (void)snprintf(buf, sizeof(buf), "%04d%02d%02d%02d%02d%02dZ",
-           tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday,
-           tm->tm_hour, tm->tm_min, tm->tm_sec);
-       sudo_lbuf_append(lbuf, "NOTAFTER=%s ", buf);
+       if (strftime(buf, sizeof(buf), "%Y%m%d%H%M%SZ", tm) != 0)
+           sudo_lbuf_append(lbuf, "NOTAFTER=%s ", buf);
     }
     if (TAG_CHANGED(prev_cs, cs, tags, setenv))
        sudo_lbuf_append(lbuf, tags.setenv ? "SETENV: " : "NOSETENV: ");
index 4cea829e92c7fa1f4fe501e27324afe827b9b211..3a41330a623cc77b2bbc995ca3cc4d48e54adb7a 100644 (file)
@@ -517,20 +517,14 @@ display_priv_long(struct sudoers_parse_tree *parse_tree, struct passwd *pw,
                if (cs->notbefore != UNSPEC) {
                    char buf[sizeof("CCYYMMDDHHMMSSZ")];
                    struct tm *tm = gmtime(&cs->notbefore);
-                   (void)snprintf(buf, sizeof(buf),
-                       "%04d%02d%02d%02d%02d%02dZ",
-                       tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday,
-                       tm->tm_hour, tm->tm_min, tm->tm_sec);
-                   sudo_lbuf_append(lbuf, "    NotBefore: %s\n", buf);
+                   if (strftime(buf, sizeof(buf), "%Y%m%d%H%M%SZ", tm) != 0)
+                       sudo_lbuf_append(lbuf, "    NotBefore: %s\n", buf);
                }
                if (cs->notafter != UNSPEC) {
                    char buf[sizeof("CCYYMMDDHHMMSSZ")];
                    struct tm *tm = gmtime(&cs->notafter);
-                   (void)snprintf(buf, sizeof(buf),
-                       "%04d%02d%02d%02d%02d%02dZ",
-                       tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday,
-                       tm->tm_hour, tm->tm_min, tm->tm_sec);
-                   sudo_lbuf_append(lbuf, "    NotAfter: %s\n", buf);
+                   if (strftime(buf, sizeof(buf), "%Y%m%d%H%M%SZ", tm) != 0)
+                       sudo_lbuf_append(lbuf, "    NotAfter: %s\n", buf);
                }
                sudo_lbuf_append(lbuf, _("    Commands:\n"));
            }