|
|
f109b2 |
diff -up Linux-PAM-1.3.1/libpam/include/pam_cc_compat.h.inline Linux-PAM-1.3.1/libpam/include/pam_cc_compat.h
|
|
|
f109b2 |
--- Linux-PAM-1.3.1/libpam/include/pam_cc_compat.h.inline 2022-05-26 10:44:31.702623614 +0200
|
|
|
f109b2 |
+++ Linux-PAM-1.3.1/libpam/include/pam_cc_compat.h 2022-05-26 10:44:31.703623621 +0200
|
|
|
f109b2 |
@@ -44,4 +44,17 @@
|
|
|
f109b2 |
# define DIAG_POP_IGNORE_CAST_ALIGN /* empty */
|
|
|
f109b2 |
#endif
|
|
|
f109b2 |
|
|
|
f109b2 |
+/*
|
|
|
f109b2 |
+ * Evaluates to
|
|
|
f109b2 |
+ * 1, if the given two types are known to be the same
|
|
|
f109b2 |
+ * 0, otherwise.
|
|
|
f109b2 |
+ */
|
|
|
f109b2 |
+#if PAM_GNUC_PREREQ(3, 0)
|
|
|
f109b2 |
+# define PAM_IS_SAME_TYPE(x_, y_) \
|
|
|
f109b2 |
+ __builtin_types_compatible_p(__typeof__(x_), __typeof__(y_))
|
|
|
f109b2 |
+#else
|
|
|
f109b2 |
+/* Cannot tell whether these types are the same. */
|
|
|
f109b2 |
+# define PAM_IS_SAME_TYPE(x_, y_) 0
|
|
|
f109b2 |
+#endif
|
|
|
f109b2 |
+
|
|
|
f109b2 |
#endif /* PAM_CC_COMPAT_H */
|
|
|
f109b2 |
diff -up Linux-PAM-1.3.1/libpam/include/pam_inline.h.inline Linux-PAM-1.3.1/libpam/include/pam_inline.h
|
|
|
f109b2 |
--- Linux-PAM-1.3.1/libpam/include/pam_inline.h.inline 2022-05-26 10:44:31.703623621 +0200
|
|
|
f109b2 |
+++ Linux-PAM-1.3.1/libpam/include/pam_inline.h 2022-05-26 10:44:31.703623621 +0200
|
|
|
f109b2 |
@@ -0,0 +1,67 @@
|
|
|
f109b2 |
+/*
|
|
|
f109b2 |
+ * Copyright (c) 2020 Dmitry V. Levin <ldv@altlinux.org>
|
|
|
f109b2 |
+ *
|
|
|
f109b2 |
+ * Handy inline functions and macros providing some convenient functionality
|
|
|
f109b2 |
+ * to libpam and its modules.
|
|
|
f109b2 |
+ */
|
|
|
f109b2 |
+
|
|
|
f109b2 |
+#ifndef PAM_INLINE_H
|
|
|
f109b2 |
+#define PAM_INLINE_H
|
|
|
f109b2 |
+
|
|
|
f109b2 |
+#include "pam_cc_compat.h"
|
|
|
f109b2 |
+#include <string.h>
|
|
|
f109b2 |
+
|
|
|
f109b2 |
+/*
|
|
|
f109b2 |
+ * Evaluates to
|
|
|
f109b2 |
+ * - a syntax error if the argument is 0,
|
|
|
f109b2 |
+ * 0, otherwise.
|
|
|
f109b2 |
+ */
|
|
|
f109b2 |
+#define PAM_FAIL_BUILD_ON_ZERO(e_) (sizeof(int[-1 + 2 * !!(e_)]) * 0)
|
|
|
f109b2 |
+
|
|
|
f109b2 |
+/*
|
|
|
f109b2 |
+ * Evaluates to
|
|
|
f109b2 |
+ * 1, if the given type is known to be a non-array type
|
|
|
f109b2 |
+ * 0, otherwise.
|
|
|
f109b2 |
+ */
|
|
|
f109b2 |
+#define PAM_IS_NOT_ARRAY(a_) PAM_IS_SAME_TYPE((a_), &(a_)[0])
|
|
|
f109b2 |
+
|
|
|
f109b2 |
+/*
|
|
|
f109b2 |
+ * Evaluates to
|
|
|
f109b2 |
+ * - a syntax error if the argument is not an array,
|
|
|
f109b2 |
+ * 0, otherwise.
|
|
|
f109b2 |
+ */
|
|
|
f109b2 |
+#define PAM_MUST_BE_ARRAY(a_) PAM_FAIL_BUILD_ON_ZERO(!PAM_IS_NOT_ARRAY(a_))
|
|
|
f109b2 |
+
|
|
|
f109b2 |
+/* Evaluates to the number of elements in the specified array. */
|
|
|
f109b2 |
+#define PAM_ARRAY_SIZE(a_) (sizeof(a_) / sizeof((a_)[0]) + PAM_MUST_BE_ARRAY(a_))
|
|
|
f109b2 |
+
|
|
|
f109b2 |
+/*
|
|
|
f109b2 |
+ * Returns NULL if STR does not start with PREFIX,
|
|
|
f109b2 |
+ * or a pointer to the first char in STR after PREFIX.
|
|
|
f109b2 |
+ * The length of PREFIX is specified by PREFIX_LEN.
|
|
|
f109b2 |
+ */
|
|
|
f109b2 |
+static inline const char *
|
|
|
f109b2 |
+pam_str_skip_prefix_len(const char *str, const char *prefix, size_t prefix_len)
|
|
|
f109b2 |
+{
|
|
|
f109b2 |
+ return strncmp(str, prefix, prefix_len) ? NULL : str + prefix_len;
|
|
|
f109b2 |
+}
|
|
|
f109b2 |
+
|
|
|
f109b2 |
+#define pam_str_skip_prefix(str_, prefix_) \
|
|
|
f109b2 |
+ pam_str_skip_prefix_len((str_), (prefix_), sizeof(prefix_) - 1 + PAM_MUST_BE_ARRAY(prefix_))
|
|
|
f109b2 |
+
|
|
|
f109b2 |
+/*
|
|
|
f109b2 |
+ * Returns NULL if STR does not start with PREFIX
|
|
|
f109b2 |
+ * (ignoring the case of the characters),
|
|
|
f109b2 |
+ * or a pointer to the first char in STR after PREFIX.
|
|
|
f109b2 |
+ * The length of PREFIX is specified by PREFIX_LEN.
|
|
|
f109b2 |
+ */
|
|
|
f109b2 |
+static inline const char *
|
|
|
f109b2 |
+pam_str_skip_icase_prefix_len(const char *str, const char *prefix, size_t prefix_len)
|
|
|
f109b2 |
+{
|
|
|
f109b2 |
+ return strncasecmp(str, prefix, prefix_len) ? NULL : str + prefix_len;
|
|
|
f109b2 |
+}
|
|
|
f109b2 |
+
|
|
|
f109b2 |
+#define pam_str_skip_icase_prefix(str_, prefix_) \
|
|
|
f109b2 |
+ pam_str_skip_icase_prefix_len((str_), (prefix_), sizeof(prefix_) - 1 + PAM_MUST_BE_ARRAY(prefix_))
|
|
|
f109b2 |
+
|
|
|
f109b2 |
+#endif /* PAM_INLINE_H */
|
|
|
f109b2 |
diff -up Linux-PAM-1.3.1/libpam/Makefile.am.inline Linux-PAM-1.3.1/libpam/Makefile.am
|
|
|
f109b2 |
--- Linux-PAM-1.3.1/libpam/Makefile.am.inline 2022-05-26 10:44:31.702623614 +0200
|
|
|
f109b2 |
+++ Linux-PAM-1.3.1/libpam/Makefile.am 2022-05-26 10:45:21.146977780 +0200
|
|
|
f109b2 |
@@ -18,7 +18,8 @@ include_HEADERS = include/security/_pam_
|
|
|
f109b2 |
include/security/pam_ext.h include/security/pam_modutil.h
|
|
|
f109b2 |
|
|
|
f109b2 |
noinst_HEADERS = pam_prelude.h pam_private.h pam_tokens.h \
|
|
|
f109b2 |
- pam_modutil_private.h include/pam_cc_compat.h
|
|
|
f109b2 |
+ pam_modutil_private.h include/pam_cc_compat.h \
|
|
|
f109b2 |
+ include/pam_inline.h
|
|
|
f109b2 |
|
|
|
f109b2 |
libpam_la_LDFLAGS = -no-undefined -version-info 84:2:84
|
|
|
f109b2 |
libpam_la_LIBADD = @LIBAUDIT@ $(LIBPRELUDE_LIBS) @LIBDL@
|