aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGilles Chehade <gilles@poolp.org>2020-12-02 00:13:25 +0100
committerGilles Chehade <gilles@poolp.org>2020-12-02 00:13:25 +0100
commit6e67b052824f088fed9dc0304d43b8431f99e8a0 (patch)
tree8f8619fe9bd338daf6d37c4896d68e6ea6ee2e54
parentMerge branch 'openssl-ecdsa' of ssh://github.com/OpenSMTPD/OpenSMTPD into openssl-ecdsa (diff)
parentproper get_progname use in smtpctl (diff)
downloadOpenSMTPD-6e67b052824f088fed9dc0304d43b8431f99e8a0.tar.xz
OpenSMTPD-6e67b052824f088fed9dc0304d43b8431f99e8a0.zip
Merge branch 'master' into openssl-ecdsa
-rw-r--r--README.md4
-rw-r--r--configure.ac4
-rw-r--r--openbsd-compat/openbsd-compat.h2
-rw-r--r--openbsd-compat/setproctitle.c5
-rw-r--r--usr.sbin/smtpd/smtpctl.c4
-rw-r--r--usr.sbin/smtpd/smtpd.c7
6 files changed, 14 insertions, 12 deletions
diff --git a/README.md b/README.md
index ce5f1a3e..bc35c16b 100644
--- a/README.md
+++ b/README.md
@@ -1,10 +1,10 @@
# OpenSMTPD
-[![Version](https://img.shields.io/badge/Version-6.6.3p1-brihtgreen.svg)](https://github.com/OpenSMTPD/OpenSMTPD/releases/tag/6.6.3p1)
+[![Version](https://img.shields.io/badge/Version-6.7.1p1-brihtgreen.svg)](https://github.com/OpenSMTPD/OpenSMTPD/releases/tag/6.7.1p1)
[![Coverity Scan analysis](https://scan.coverity.com/projects/278/badge.svg)](https://scan.coverity.com/projects/opensmtpd-opensmtpd)
[![Packaging status](https://repology.org/badge/tiny-repos/opensmtpd.svg)](https://repology.org/project/opensmtpd/versions)
[![License: ISC](https://img.shields.io/badge/License-ISC-blue.svg)](https://www.isc.org/licenses/)
-[![Clang Analysis](https://opensmtpd.email/reports/clang/badge.svg)](https://opensmtpd.email/reports/clang/index.html)
+
OpenSMTPD is a FREE implementation of the server-side SMTP protocol as
diff --git a/configure.ac b/configure.ac
index 28f1be1f..d46aeae7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2046,6 +2046,10 @@ AM_CONDITIONAL([NEED_PROGNAME], [test "x$ac_cv_libc_defines___progname" != "xyes
##
+AM_COND_IF([NEED_PROGNAME], [AC_DEFINE([NEED_PROGNAME], [1], [Define to 1 if NEED_PROGNAME])])
+AM_COND_IF([NEED_SETPROCTITLE], [AC_DEFINE([NEED_SETPROCTITLE], [1], [Define to 1 if NEED_SETPROCTITLE])])
+
+
AC_CONFIG_FILES([Makefile
openbsd-compat/Makefile
mk/Makefile
diff --git a/openbsd-compat/openbsd-compat.h b/openbsd-compat/openbsd-compat.h
index ec0ae516..dcb643f1 100644
--- a/openbsd-compat/openbsd-compat.h
+++ b/openbsd-compat/openbsd-compat.h
@@ -96,7 +96,7 @@ const char *inet_ntop(int af, const void *src, char *dst, socklen_t size);
char *strsep(char **stringp, const char *delim);
#endif
-#ifndef HAVE_SETPROCTITLE
+#ifdef NEED_SETPROCTITLE
void setproctitle(const char *fmt, ...);
void compat_init_setproctitle(int argc, char *argv[]);
#endif
diff --git a/openbsd-compat/setproctitle.c b/openbsd-compat/setproctitle.c
index eef70c14..71e1595e 100644
--- a/openbsd-compat/setproctitle.c
+++ b/openbsd-compat/setproctitle.c
@@ -68,8 +68,7 @@ static size_t argv_env_len = 0;
void
compat_init_setproctitle(int argc, char *argv[])
{
-#if !defined(HAVE_SETPROCTITLE) && \
- defined(SPT_TYPE) && SPT_TYPE == SPT_REUSEARGV
+#if defined(SPT_TYPE) && SPT_TYPE == SPT_REUSEARGV
extern char **environ;
char *lastargv = NULL;
char **envp = environ;
@@ -156,8 +155,6 @@ setproctitle(const char *fmt, ...)
pst.pst_command = ptitle;
pstat(PSTAT_SETCMD, pst, strlen(ptitle), 0, 0);
#elif SPT_TYPE == SPT_REUSEARGV
-/* debug("setproctitle: copy \"%s\" into len %d",
- buf, argv_env_len); */
len = strlcpy(argv_start, ptitle, argv_env_len);
for(; len < argv_env_len; len++)
argv_start[len] = SPT_PADCHAR;
diff --git a/usr.sbin/smtpd/smtpctl.c b/usr.sbin/smtpd/smtpctl.c
index b255ed3d..1cc37994 100644
--- a/usr.sbin/smtpd/smtpctl.c
+++ b/usr.sbin/smtpd/smtpctl.c
@@ -1066,8 +1066,8 @@ main(int argc, char **argv)
int privileged;
char *argv_mailq[] = { "show", "queue", NULL };
-#ifndef HAVE___PROGNAME
- __progname = ssh_get_progname(argv[0]);
+#ifdef NEED_PROGNAME
+ __progname = get_progname(argv[0]);
#endif
/* check that smtpctl was installed setgid */
diff --git a/usr.sbin/smtpd/smtpd.c b/usr.sbin/smtpd/smtpd.c
index 45e37c33..9307fc3b 100644
--- a/usr.sbin/smtpd/smtpd.c
+++ b/usr.sbin/smtpd/smtpd.c
@@ -520,11 +520,11 @@ main(int argc, char *argv[])
char *rexec = NULL;
struct smtpd *conf;
-#ifndef HAVE___PROGNAME
+#ifdef NEED_PROGNAME
__progname = get_progname(argv[0]);
#endif
+ __progname = xstrdup(__progname);
-#ifndef HAVE_SETPROCTITLE
/* Save argv. Duplicate so setproctitle emulation doesn't clobber it */
saved_argc = argc;
saved_argv = xcalloc(argc + 1, sizeof(*saved_argv));
@@ -532,14 +532,15 @@ main(int argc, char *argv[])
saved_argv[i] = xstrdup(argv[i]);
saved_argv[i] = NULL;
+#ifdef NEED_SETPROCTITLE
/* Prepare for later setproctitle emulation */
compat_init_setproctitle(argc, argv);
argv = saved_argv;
+#endif
/* this is to work around GNU getopt + portable setproctitle() fuckery */
save_argc = saved_argc;
save_argv = saved_argv;
-#endif
if ((conf = config_default()) == NULL)
err(1, NULL);