Skip to content

Commit

Permalink
Change compile definition wording
Browse files Browse the repository at this point in the history
  • Loading branch information
sabedevops committed Sep 12, 2023
1 parent 4c9f80b commit 5f36131
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions programs/ziti-edge-tunnel/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
pkg_check_modules(LIBCAP IMPORTED_TARGET "libcap")

if (LIBACL_FOUND)
target_compile_definitions(ziti-edge-tunnel PRIVATE HAVE_LIBACL_H)
target_compile_definitions(ziti-edge-tunnel PRIVATE HAVE_LIBACL_PKG)
target_link_libraries(ziti-edge-tunnel PRIVATE PkgConfig::LIBACL)
endif()

if (LIBCAP_FOUND)
target_compile_definitions(ziti-edge-tunnel PRIVATE HAVE_LIBCAP_H)
target_compile_definitions(ziti-edge-tunnel PRIVATE HAVE_LIBCAP_PKG)
target_link_libraries(ziti-edge-tunnel PRIVATE PkgConfig::LIBCAP)
endif()

Expand Down
4 changes: 2 additions & 2 deletions programs/ziti-edge-tunnel/netif_driver/linux/resolvers.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
#ifdef HAVE_LIBACL_H
#ifdef HAVE_LIBACL_PKG
#include <sys/acl.h>
#include <acl/libacl.h>
#endif
Expand Down Expand Up @@ -423,7 +423,7 @@ void dns_update_resolvconf(const char *tun, unsigned int ifindex, const char *ad
run_command("echo 'nameserver %s' | %s -a %s", addr, RESOLVCONF, tun);
}

#ifdef HAVE_LIBACL_H
#ifdef HAVE_LIBACL_PKG
static void cleanup_acl(acl_t *acl) {
if (*acl != NULL) {
if (acl_free(*acl) == -1) {
Expand Down
2 changes: 1 addition & 1 deletion programs/ziti-edge-tunnel/netif_driver/linux/resolvers.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,6 @@ void dns_update_systemd_resolved(const char* tun, unsigned int ifindex, const ch
void dns_update_resolvconf(const char* tun, unsigned int ifindex, const char* addr);
void dns_update_etc_resolv(const char* tun, unsigned int ifindex, const char* addr);

#ifdef HAVE_LIBACL_H
#ifdef HAVE_LIBACL_PKG
void install_user_acl_etc_resolv(uid_t uid);
#endif
2 changes: 1 addition & 1 deletion programs/ziti-edge-tunnel/netif_driver/linux/tun.c
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ static void find_dns_updater() {
return;
}

#if defined(HAVE_LIBCAP_H) && defined(HAVE_LIBACL_H)
#if defined(HAVE_LIBCAP_PKG) && defined(HAVE_LIBACL_PKG)
if (euid != 0) {
uid_t ziti_uid = get_user_uid("ziti");
bool fowner_cap = has_effective_capability(CAP_FOWNER);
Expand Down
4 changes: 2 additions & 2 deletions programs/ziti-edge-tunnel/netif_driver/linux/utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#include <stdio.h>
#include <string.h>
#include <pwd.h>
#ifdef HAVE_LIBCAP_H
#ifdef HAVE_LIBCAP_PKG
#include <sys/capability.h>
#endif
#include <sys/stat.h>
Expand Down Expand Up @@ -64,7 +64,7 @@ bool is_symlink(const char *path) {
return (lstat(path, &s) == 0 && S_ISLNK(s.st_mode));
}

#ifdef HAVE_LIBCAP_H
#ifdef HAVE_LIBCAP_PKG
bool has_effective_capability(cap_value_t cap) {
cap_t caps;
cap_flag_value_t flag;
Expand Down
4 changes: 2 additions & 2 deletions programs/ziti-edge-tunnel/netif_driver/linux/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#include <stdbool.h>
#include <stdio.h>
#include <pwd.h>
#ifdef HAVE_LIBCAP_H
#ifdef HAVE_LIBCAP_PKG
#include <sys/capability.h>
#endif

Expand All @@ -26,6 +26,6 @@ int run_command_ex(bool log_nonzero_ec, const char *cmd, ...);
bool is_executable(const char *path);
bool is_symlink(const char *path);
uid_t get_user_uid(const char *username);
#ifdef HAVE_LIBCAP_H
#ifdef HAVE_LIBCAP_PKG
bool has_effective_capability(cap_value_t cap);
#endif

0 comments on commit 5f36131

Please sign in to comment.