Skip to content

Commit f7822ee

Browse files
committed
gssapi: add shim for old __res_nsearch version
Release note: none. Epic: none.
1 parent 5fdc01e commit f7822ee

File tree

3 files changed

+33
-8
lines changed

3 files changed

+33
-8
lines changed

build/bazelutil/cc/BUILD.bazel

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
cc_library(
2+
name = "resolver_compat",
3+
srcs = ["res_compat.c"],
4+
visibility = ["//visibility:public"],
5+
alwayslink = True,
6+
)
7+
8+
cc_library(
9+
name = "resolver_libs",
10+
linkopts = [
11+
"-Wl,--push-state,--no-as-needed",
12+
"-lresolv",
13+
"-Wl,--pop-state",
14+
],
15+
visibility = ["//visibility:public"],
16+
)

build/bazelutil/cc/res_compat.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// res_compat.c
2+
#include <resolv.h>
3+
4+
// Provide a weak __res_nsearch for old krb5 objects.
5+
// Forward to the public res_nsearch symbol on modern glibc.
6+
__attribute__((weak))
7+
int __res_nsearch(res_state statp,
8+
const char *dname,
9+
int class,
10+
int type,
11+
unsigned char *answer,
12+
int anslen) {
13+
return res_nsearch(statp, dname, class, type, answer, anslen);
14+
}

pkg/ccl/gssapiccl/BUILD.bazel

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,12 @@ go_library(
1111
"//conditions:default": ["empty.go"],
1212
}),
1313
cdeps = select({
14-
"@io_bazel_rules_go//go/platform:linux": ["//c-deps:libkrb5"],
14+
"@io_bazel_rules_go//go/platform:linux": [
15+
"//c-deps:libkrb5", "//build/bazelutil/cc:resolver_compat","//build/bazelutil/cc:resolver_libs",
16+
],
1517
"//conditions:default": [],
1618
}),
1719
cgo = True,
18-
clinkopts = select({
19-
# NB: On Ubuntu, res_nsearch is found in the resolv_wrapper library,
20-
# found in the libresolv-wrapper package.
21-
"//build/toolchains:is_dev_linux": ["-ldl -lresolv -lresolv_wrapper"],
22-
"@io_bazel_rules_go//go/platform:linux": ["-ldl -lresolv"],
23-
"//conditions:default": [],
24-
}),
2520
importpath = "github.com/cockroachdb/cockroach/pkg/ccl/gssapiccl",
2621
visibility = ["//visibility:public"],
2722
deps = select({

0 commit comments

Comments
 (0)