diff --git a/BUILD b/BUILD index 9786728..5812bbb 100644 --- a/BUILD +++ b/BUILD @@ -21,10 +21,12 @@ genrule( cc_library( name = "headers", srcs = glob([ + "src/common/**/*.h", "src/include/**/*.h", "src/interfaces/libpq/*.h", ]) + ["src/port/pg_config_paths.h"], includes = [ + "src/common", "src/include", "src/interfaces/libpq", "src/port", @@ -42,6 +44,22 @@ cc_library( name = "pq", srcs = [ ":pg_config", + "@postgres//:src/common/base64.c", + "@postgres//:src/common/cryptohash.c", + "@postgres//:src/common/encnames.c", + "@postgres//:src/common/hmac.c", + "@postgres//:src/common/ip.c", + "@postgres//:src/common/link-canary.c", + "@postgres//:src/common/md5.c", + "@postgres//:src/common/md5_common.c", + "@postgres//:src/common/pg_prng.c", + "@postgres//:src/common/saslprep.c", + "@postgres//:src/common/scram-common.c", + "@postgres//:src/common/sha1.c", + "@postgres//:src/common/sha2.c", + "@postgres//:src/common/string.c", + "@postgres//:src/common/unicode_norm.c", + "@postgres//:src/common/wchar.c", "@postgres//:src/interfaces/libpq/fe-auth.c", "@postgres//:src/interfaces/libpq/fe-auth-scram.c", "@postgres//:src/interfaces/libpq/fe-connect.c", @@ -56,6 +74,27 @@ cc_library( "@postgres//:src/interfaces/libpq/legacy-pqsignal.c", "@postgres//:src/interfaces/libpq/libpq-events.c", "@postgres//:src/interfaces/libpq/pqexpbuffer.c", + "@postgres//:src/port/chklocale.c", + "@postgres//:src/port/explicit_bzero.c", + "@postgres//:src/port/inet_net_ntop.c", + "@postgres//:src/port/noblock.c", + "@postgres//:src/port/pg_strong_random.c", + "@postgres//:src/port/pgstrcasecmp.c", + "@postgres//:src/port/snprintf.c", + "@postgres//:src/port/strerror.c", + "@postgres//:src/port/thread.c", + ] + select({ + "@platforms//os:linux": [ + "@libpq//:getpeereid.linux.c", + "@postgres//:src/port/strlcat.c", + "@postgres//:src/port/strlcpy.c", + ], + "//conditions:default": [], + }), + defines = [ + "FRONTEND", + "HAVE_STRERROR_R", + "STRERROR_R_INT", ], linkstatic = True, visibility = ["//visibility:public"], diff --git a/getpeereid.linux.c b/getpeereid.linux.c new file mode 100644 index 0000000..677ddb3 --- /dev/null +++ b/getpeereid.linux.c @@ -0,0 +1,16 @@ +#include "c.h" + +#include +#include +#include +#include + +/* + * BSD-style getpeereid() for platforms that lack it. + */ +int +getpeereid(int sock, uid_t *uid, gid_t *gid) +{ /* No implementation available on this platform */ + errno = ENOSYS; + return -1; +} \ No newline at end of file