summaryrefslogtreecommitdiffstats
path: root/contrib
diff options
context:
space:
mode:
authordes <des@FreeBSD.org>2016-01-16 19:48:03 +0000
committerdes <des@FreeBSD.org>2016-01-16 19:48:03 +0000
commit5e1cc08a89aa7ec23c6c934d6a6b41065bd9ac72 (patch)
treeab2cb7025b0de37c1541f8b01e92c19b5b1fb7c6 /contrib
parentdc5c74f3f12a6f57440056448e551a0f1c335299 (diff)
downloadFreeBSD-src-5e1cc08a89aa7ec23c6c934d6a6b41065bd9ac72.zip
FreeBSD-src-5e1cc08a89aa7ec23c6c934d6a6b41065bd9ac72.tar.gz
MFH (r262530): fix is_upper() predicate (almost two years late...)
MFH (r271614): remove incorrect svn properties MFH (r274145): cast-qual bugs in tests MFH (r288070): restore correct module search path semantics Also merge upstream r854, committed to head as part of r280031, which fixes cast-qual bugs in libpam itself.
Diffstat (limited to 'contrib')
-rw-r--r--contrib/openpam/CREDITS5
-rw-r--r--contrib/openpam/configure.ac2
-rw-r--r--contrib/openpam/lib/libpam/openpam_constants.c3
-rw-r--r--contrib/openpam/lib/libpam/openpam_ctype.h10
-rw-r--r--contrib/openpam/lib/libpam/openpam_dispatch.c2
-rw-r--r--contrib/openpam/modules/pam_unix/pam_unix.c4
-rw-r--r--contrib/openpam/t/Makefile.am1
-rw-r--r--contrib/openpam/t/t_openpam_ctype.c122
-rw-r--r--contrib/openpam/t/t_openpam_readlinev.c2
-rw-r--r--contrib/openpam/t/t_openpam_readword.c2
10 files changed, 144 insertions, 9 deletions
diff --git a/contrib/openpam/CREDITS b/contrib/openpam/CREDITS
index 0a22fc4..c14f7ea 100644
--- a/contrib/openpam/CREDITS
+++ b/contrib/openpam/CREDITS
@@ -21,6 +21,7 @@ ideas:
Christos Zoulas <christos@netbsd.org>
Daniel Richard G. <skunk@iskunk.org>
Darren J. Moffat <darren.moffat@sun.com>
+ Dimitry Andric <dim@freebsd.org>
Dmitry V. Levin <ldv@altlinux.org>
Don Lewis <truckman@freebsd.org>
Emmanuel Dreyfus <manu@netbsd.org>
@@ -32,9 +33,9 @@ ideas:
Hubert Feyrer <hubert@feyrer.de>
Jason Evans <jasone@freebsd.org>
Joe Marcus Clarke <marcus@freebsd.org>
- Juli Mallett <jmallett@freebsd.org>
- Ankita Pal <pal.ankita.ankita@gmail.com>
Jörg Sonnenberger <joerg@britannica.bec.de>
+ Juli Mallett <jmallett@freebsd.org>
+ Larry Baird <lab@gta.com>
Maëlle Lesage <lesage.maelle@gmail.com>
Mark Murray <markm@freebsd.org>
Matthias Drochner <drochner@netbsd.org>
diff --git a/contrib/openpam/configure.ac b/contrib/openpam/configure.ac
index 1412b7a..bf7f905 100644
--- a/contrib/openpam/configure.ac
+++ b/contrib/openpam/configure.ac
@@ -110,7 +110,7 @@ AC_SUBST(CRYPTO_LIBS)
AC_ARG_ENABLE([developer-warnings],
AS_HELP_STRING([--enable-developer-warnings], [enable strict warnings (default is NO)]),
- [CFLAGS="${CFLAGS} -Wall -Wextra"])
+ [CFLAGS="${CFLAGS} -Wall -Wextra -Wcast-qual"])
AC_ARG_ENABLE([debugging-symbols],
AS_HELP_STRING([--enable-debugging-symbols], [enable debugging symbols (default is NO)]),
[CFLAGS="${CFLAGS} -O0 -g -fno-inline"])
diff --git a/contrib/openpam/lib/libpam/openpam_constants.c b/contrib/openpam/lib/libpam/openpam_constants.c
index 1cdd810..b718af9 100644
--- a/contrib/openpam/lib/libpam/openpam_constants.c
+++ b/contrib/openpam/lib/libpam/openpam_constants.c
@@ -137,6 +137,9 @@ const char *openpam_policy_path[] = {
const char *openpam_module_path[] = {
#ifdef OPENPAM_MODULES_DIRECTORY
OPENPAM_MODULES_DIRECTORY,
+#elif COMPAT_32BIT
+ "/usr/lib32",
+ "/usr/local/lib32",
#else
"/usr/lib",
"/usr/local/lib",
diff --git a/contrib/openpam/lib/libpam/openpam_ctype.h b/contrib/openpam/lib/libpam/openpam_ctype.h
index 5c62185..d99d34b 100644
--- a/contrib/openpam/lib/libpam/openpam_ctype.h
+++ b/contrib/openpam/lib/libpam/openpam_ctype.h
@@ -39,10 +39,18 @@
(ch >= '0' && ch <= '9')
/*
+ * Evaluates to non-zero if the argument is a hex digit.
+ */
+#define is_xdigit(ch) \
+ ((ch >= '0' && ch <= '9') || \
+ (ch >= 'a' && ch <= 'f') || \
+ (ch >= 'A' && ch <= 'F'))
+
+/*
* Evaluates to non-zero if the argument is an uppercase letter.
*/
#define is_upper(ch) \
- (ch >= 'A' && ch <= 'A')
+ (ch >= 'A' && ch <= 'Z')
/*
* Evaluates to non-zero if the argument is a lowercase letter.
diff --git a/contrib/openpam/lib/libpam/openpam_dispatch.c b/contrib/openpam/lib/libpam/openpam_dispatch.c
index 5fa068f..0cff631 100644
--- a/contrib/openpam/lib/libpam/openpam_dispatch.c
+++ b/contrib/openpam/lib/libpam/openpam_dispatch.c
@@ -117,7 +117,7 @@ openpam_dispatch(pam_handle_t *pamh,
openpam_log(PAM_LOG_LIBDEBUG, "calling %s() in %s",
pam_sm_func_name[primitive], chain->module->path);
r = (chain->module->func[primitive])(pamh, flags,
- chain->optc, (const char **)chain->optv);
+ chain->optc, (const char **)(intptr_t)chain->optv);
pamh->current = NULL;
openpam_log(PAM_LOG_LIBDEBUG, "%s: %s(): %s",
chain->module->path, pam_sm_func_name[primitive],
diff --git a/contrib/openpam/modules/pam_unix/pam_unix.c b/contrib/openpam/modules/pam_unix/pam_unix.c
index ad7dd1b..f76651d 100644
--- a/contrib/openpam/modules/pam_unix/pam_unix.c
+++ b/contrib/openpam/modules/pam_unix/pam_unix.c
@@ -74,7 +74,7 @@ pam_sm_authenticate(pam_handle_t *pamh, int flags,
#endif
struct passwd *pwd;
const char *user;
- char *crypt_password, *password;
+ const char *crypt_password, *password;
int pam_err, retry;
(void)argc;
@@ -98,7 +98,7 @@ pam_sm_authenticate(pam_handle_t *pamh, int flags,
for (retry = 0; retry < 3; ++retry) {
#ifdef OPENPAM
pam_err = pam_get_authtok(pamh, PAM_AUTHTOK,
- (const char **)&password, NULL);
+ &password, NULL);
#else
resp = NULL;
pam_err = (*conv->conv)(1, &msgp, &resp, conv->appdata_ptr);
diff --git a/contrib/openpam/t/Makefile.am b/contrib/openpam/t/Makefile.am
index 5f6a251..bf3801b 100644
--- a/contrib/openpam/t/Makefile.am
+++ b/contrib/openpam/t/Makefile.am
@@ -6,6 +6,7 @@ noinst_HEADERS = t.h
# tests
TESTS =
+TESTS += t_openpam_ctype
TESTS += t_openpam_readword
TESTS += t_openpam_readlinev
check_PROGRAMS = $(TESTS)
diff --git a/contrib/openpam/t/t_openpam_ctype.c b/contrib/openpam/t/t_openpam_ctype.c
new file mode 100644
index 0000000..e97a446
--- /dev/null
+++ b/contrib/openpam/t/t_openpam_ctype.c
@@ -0,0 +1,122 @@
+/*-
+ * Copyright (c) 2014 Dag-Erling Smørgrav
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote
+ * products derived from this software without specific prior written
+ * permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $Id$
+ */
+
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include <stdio.h>
+#include <string.h>
+
+#include "openpam_ctype.h"
+
+#include "t.h"
+
+#define OC_DIGIT "0123456789"
+#define OC_XDIGIT OC_DIGIT "ABCDEFabcdef"
+#define OC_UPPER "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+#define OC_LOWER "abcdefghijklmnopqrstuvwxyz"
+#define OC_LETTER OC_UPPER OC_LOWER
+#define OC_LWS " \t\f\r"
+#define OC_WS OC_LWS "\n"
+#define OC_P "!\"#$%&'()*+,-./" OC_DIGIT ":;<=>?@" OC_UPPER "[\\]^_`" OC_LOWER "{|}~"
+#define OC_PFCS OC_DIGIT OC_LETTER "._-"
+
+static const char oc_digit[] = OC_DIGIT;
+static const char oc_xdigit[] = OC_XDIGIT;
+static const char oc_upper[] = OC_UPPER;
+static const char oc_lower[] = OC_LOWER;
+static const char oc_letter[] = OC_LETTER;
+static const char oc_lws[] = OC_LWS;
+static const char oc_ws[] = OC_WS;
+static const char oc_p[] = OC_P;
+static const char oc_pfcs[] = OC_PFCS;
+
+#define T_OC(set) \
+ T_FUNC(t_oc_##set, "is_" #set) \
+ { \
+ char crib[256]; \
+ unsigned int i, ret; \
+ \
+ memset(crib, 0, sizeof crib); \
+ for (i = 0; oc_##set[i]; ++i) \
+ crib[(int)oc_##set[i]] = 1; \
+ for (i = ret = 0; i < sizeof crib; ++i) { \
+ if (is_##set(i) != crib[i]) { \
+ t_verbose("is_%s() incorrect " \
+ "for %#02x\n", #set, i); \
+ ++ret; \
+ } \
+ } \
+ return (ret == 0); \
+ }
+
+T_OC(digit)
+T_OC(xdigit)
+T_OC(upper)
+T_OC(lower)
+T_OC(letter)
+T_OC(lws)
+T_OC(ws)
+T_OC(p)
+T_OC(pfcs)
+
+
+/***************************************************************************
+ * Boilerplate
+ */
+
+static const struct t_test *t_plan[] = {
+ T(t_oc_digit),
+ T(t_oc_xdigit),
+ T(t_oc_upper),
+ T(t_oc_lower),
+ T(t_oc_letter),
+ T(t_oc_lws),
+ T(t_oc_ws),
+ T(t_oc_p),
+ T(t_oc_pfcs),
+ NULL
+};
+
+const struct t_test **
+t_prepare(int argc, char *argv[])
+{
+
+ (void)argc;
+ (void)argv;
+ return (t_plan);
+}
+
+void
+t_cleanup(void)
+{
+}
diff --git a/contrib/openpam/t/t_openpam_readlinev.c b/contrib/openpam/t/t_openpam_readlinev.c
index 59f2b10..9820f6e 100644
--- a/contrib/openpam/t/t_openpam_readlinev.c
+++ b/contrib/openpam/t/t_openpam_readlinev.c
@@ -255,7 +255,7 @@ T_FUNC(unterminated_line, "unterminated line")
* Boilerplate
*/
-const struct t_test *t_plan[] = {
+static const struct t_test *t_plan[] = {
T(empty_input),
T(empty_line),
T(unterminated_empty_line),
diff --git a/contrib/openpam/t/t_openpam_readword.c b/contrib/openpam/t/t_openpam_readword.c
index d2d6bd5..804c745 100644
--- a/contrib/openpam/t/t_openpam_readword.c
+++ b/contrib/openpam/t/t_openpam_readword.c
@@ -823,7 +823,7 @@ T_FUNC(escaped_double_quote_within_double_quotes,
* Boilerplate
*/
-const struct t_test *t_plan[] = {
+static const struct t_test *t_plan[] = {
T(empty_input),
T(empty_line),
T(single_whitespace),
OpenPOWER on IntegriCloud