telegabber/docker/resolv_shim.c
2026-05-27 01:05:51 -07:00

22 lines
1 KiB
C

// resolv_shim.c — Wrappers for glibc-internal resolver symbols.
//
// ntgcalls' CMake (cmake/FindGLib.cmake) downloads a pre-built static glib
// from pytgcalls/glib GitHub releases. That binary was compiled on an older
// glibc (manylinux2014 / CentOS 7) where __dn_expand and __res_nquery were
// linkable symbols. On bookworm's glibc 2.36 they are no longer exposed to
// the linker — only the public POSIX names (dn_expand, res_nquery) are.
//
// Since we don't control the glib build (it's downloaded, not compiled by us),
// the simplest fix is to forward the internal names to the public ones.
#include <resolv.h>
#include <arpa/nameser.h>
int __dn_expand(const unsigned char *msg, const unsigned char *eom,
const unsigned char *src, char *dst, int dstsiz) {
return dn_expand(msg, eom, src, dst, dstsiz);
}
int __res_nquery(res_state statp, const char *name, int class, int type,
unsigned char *answer, int anslen) {
return res_nquery(statp, name, class, type, answer, anslen);
}