  	}
  	if (icon_name)
  		*icon_name    = g_strdup("im-" SIPE_TELEPATHY_DOMAIN);
--- 
-2.31.1
-

 src/core/sipe-tls-tester.c         |  2 +-
 src/core/sipe-tls.c                |  4 ++--
 src/telepathy/telepathy-protocol.c |  2 +-
 9 files changed, 23 insertions(+), 15 deletions(-)

diff --git a/configure.ac b/configure.ac
index 2481153..efe01b4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -327,6 +327,9 @@ AM_CONDITIONAL(SIPE_OPENSSL, [test "x$enable_openssl" != xno])
 dnl check for libxml2
 PKG_CHECK_MODULES(LIBXML2, [libxml-2.0])
 
+# dnl check for g_memdup2 in glib-2.0
+AC_CHECK_LIB(glib-2.0, g_memdup2, [GLIB_CFLAGS="$GLIB_CFLAGS -DHAVE_G_MEMDUP2=1"])
+
 dnl assumption check: sizof(uuid_t) must be 16 (see uuid.c)
 AC_MSG_CHECKING([that sizeof(uuid_t) is 16])
 ac_save_CFLAGS="$CFLAGS"
diff --git a/src/api/sipe-common.h b/src/api/sipe-common.h
index c964f15..e114fdc 100644
--- a/src/api/sipe-common.h
+++ b/src/api/sipe-common.h
@@ -51,3 +51,8 @@
 #ifdef _MSC_VER
 typedef long ssize_t;
 #endif
+
+#ifndef HAVE_G_MEMDUP2
+#define g_memdup2 g_memdup
+#endif
+
diff --git a/src/core/sip-sec-gssapi.c b/src/core/sip-sec-gssapi.c
index 873080f..4c63868 100644
--- a/src/core/sip-sec-gssapi.c

From 51c95a23bff3a024dc19e3127ca751e1458be0f0 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Mon, 5 Apr 2021 11:36:50 -0700
Subject: [PATCH] Migrate to use g_memdup2

g_memdup has been deprecated for long and latest glib-2.0 2.68+ has
turned it int an error to use old function.

The fall-back to g_memdup isn't needed because pidgin provides g_memdup2
in pidgin-sipe/1.25.0-r0/recipe-sysroot/usr/include/libpurple/glibcompat.h
based on glib-2.0 version:
  /* Backport the static inline version of g_memdup2 if we don't have g_memdup2.
   * see https://mail.gnome.org/archives/desktop-devel-list/2021-February/msg00000.html
   * for more information.
   */
  #if !GLIB_CHECK_VERSION(2, 67, 3)
  static inline gpointer
  g_memdup2(gconstpointer mem, gsize byte_size) {
          gpointer new_mem = NULL;

          if(mem && byte_size != 0) {
                  new_mem = g_malloc (byte_size);
                  memcpy (new_mem, mem, byte_size);
          }

          return new_mem;
  }
  #endif /* !GLIB_CHECK_VERSION(2, 67, 3) */

Upstream-Status: Pending
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 src/api/sipe-common.h              |  3 +++
 src/core/sip-sec-gssapi.c          |  4 ++--
 src/core/sip-sec-ntlm.c            | 12 ++++++------
 src/core/sip-sec-tls-dsk.c         |  4 ++--
