aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--asn1/kerberos/packet-kerberos-template.c6
-rw-r--r--wsutil/Makefile.common1
-rw-r--r--wsutil/ws_diag_control.h96
3 files changed, 103 insertions, 0 deletions
diff --git a/asn1/kerberos/packet-kerberos-template.c b/asn1/kerberos/packet-kerberos-template.c
index 8d1cb5f512..3254c0907e 100644
--- a/asn1/kerberos/packet-kerberos-template.c
+++ b/asn1/kerberos/packet-kerberos-template.c
@@ -81,6 +81,8 @@
#include <epan/dissectors/packet-gssapi.h>
#include <epan/dissectors/packet-smb-common.h>
+#include <wsutil/ws_diag_control.h>
+
void proto_register_kerberos(void);
void proto_reg_handoff_kerberos(void);
@@ -280,6 +282,8 @@ read_keytab_file(const char *filename _U_)
static krb5_context krb5_ctx;
+USES_APPLE_DEPRECATED_API
+
void
read_keytab_file(const char *filename)
{
@@ -416,6 +420,8 @@ decrypt_krb5_data(proto_tree *tree _U_, packet_info *pinfo,
return NULL;
}
+USES_APPLE_RST
+
#elif defined(HAVE_HEIMDAL_KERBEROS)
static krb5_context krb5_ctx;
diff --git a/wsutil/Makefile.common b/wsutil/Makefile.common
index cb595977c1..5e8ba72e70 100644
--- a/wsutil/Makefile.common
+++ b/wsutil/Makefile.common
@@ -127,6 +127,7 @@ libwsutil_nonrepl_INCLUDES = \
u3.h \
unicode-utils.h \
ws_cpuid.h \
+ ws_diag_control.h \
ws_mempbrk.h \
ws_version_info.h
diff --git a/wsutil/ws_diag_control.h b/wsutil/ws_diag_control.h
new file mode 100644
index 0000000000..375ab85171
--- /dev/null
+++ b/wsutil/ws_diag_control.h
@@ -0,0 +1,96 @@
+/* ws_diag_control.h
+ * Turn compiler diagnostic messages on and off.
+ *
+ * From FreeRADIUS build.h.
+ *
+ * @copyright 2013 The FreeRADIUS server project
+ *
+ * That project is covered by the GPLv2, so:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+#ifndef __WS_DIAG_CONTROL_H__
+#define __WS_DIAG_CONTROL_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define XSTRINGIFY(x) #x
+
+/*
+ * Macros for controlling warnings in GCC >= 4.2 and clang >= 2.8
+ */
+#define DIAG_JOINSTR(x,y) XSTRINGIFY(x ## y)
+#define DIAG_DO_PRAGMA(x) _Pragma (#x)
+
+/* check the gcc or clang version
+
+ pragma GCC diagnostic error/warning/ignored -Wxxx was introduced
+ in gcc 4.2.0
+ pragma GCC diagnostic push/pop was introduced in gcc 4.6.0
+
+ pragma clang diagnostic error/warning/ignored -Wxxx and
+ pragma clang diagnostic push/pop were introduced in clang 2.8 */
+
+#if defined(__GNUC__) && ((__GNUC__ * 100) + __GNUC_MINOR__) >= 402
+ /* gcc version is >= 4.2.0; we can use "GCC diagnostic ignored/warning
+ -Wxxx" */
+# define DIAG_PRAGMA(x) DIAG_DO_PRAGMA(GCC diagnostic x)
+# if ((__GNUC__ * 100) + __GNUC_MINOR__) >= 406
+ /* gcc version is >= 4.6.0: we can use "GCC diagnostic push/pop" */
+# define DIAG_OFF(x) DIAG_PRAGMA(push) DIAG_PRAGMA(ignored DIAG_JOINSTR(-W,x))
+# define DIAG_ON(x) DIAG_PRAGMA(pop)
+# else
+ /* gcc version is between 4.2.0 and 4.6.0:
+ we can use "GCC diagnostic ignored/warning -Wxxx", but not
+ "GCC diagnostic push/pop" */
+# define DIAG_OFF(x) DIAG_PRAGMA(ignored DIAG_JOINSTR(-W,x))
+# define DIAG_ON(x) DIAG_PRAGMA(warning DIAG_JOINSTR(-W,x))
+# endif
+#elif defined(__clang__) && ((__clang_major__ * 100) + __clang_minor__ >= 208)
+ /* clang version is >= 2.8: we can use "clang diagnostic ignored -Wxxx"
+ and "clang diagnostic push/pop" */
+# define DIAG_PRAGMA(x) DIAG_DO_PRAGMA(clang diagnostic x)
+# define DIAG_OFF(x) DIAG_PRAGMA(push) DIAG_PRAGMA(ignored DIAG_JOINSTR(-W,x))
+# define DIAG_ON(x) DIAG_PRAGMA(pop)
+#else
+ /* no gcc or clang, or gcc version < 4.2.0, or clang version < 2.8:
+ we can't do anything */
+# define DIAG_OFF(x)
+# define DIAG_ON(x)
+#endif
+
+/*
+ * For dealing with APIs which are only deprecated in OS X (like the
+ * OpenSSL and MIT/Heimdal Kerberos APIs).
+ *
+ * Dear Apple: this is a cross-platform program, and we're not
+ * going to use your Shiny New Frameworks on OS X unless there's
+ * a sufficiently clear benefit to make it worth our while to have
+ * both OS X and non-OS X versions of the code.
+ */
+#ifdef __APPLE__
+# define USES_APPLE_DEPRECATED_API DIAG_OFF(deprecated-declarations)
+# define USES_APPLE_RST DIAG_ON(deprecated-declarations)
+#else
+# define USES_APPLE_DEPRECATED_API
+# define USES_APPLE_RST
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* __WS_DIAG_CONTROL_H__ */