Skip to content

Commit

Permalink
[agroal#378] Vault Implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
fluca1978 authored and ashu3103 committed Mar 2, 2024
1 parent ba82fd1 commit 00da164
Show file tree
Hide file tree
Showing 58 changed files with 3,508 additions and 897 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ jobs:
run: sudo apt update -y
- name: Install libev
run: sudo apt install -y libev4 libev-dev
- name: Install cJSON
run: sudo apt install -y libcjson1 libcjson-dev
- name: Install systemd
run: sudo apt install -y libsystemd-dev
- name: Install rst2man
Expand Down Expand Up @@ -63,6 +65,8 @@ jobs:
run: brew install openssl
- name: Install libev
run: brew install libev
- name: Install cJSON
run: brew install cjson
- name: Install rst2man
run: brew install docutils
- name: Install clang
Expand Down
3 changes: 2 additions & 1 deletion AUTHORS
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
pgagroal was created by the following authors:

Jesper Pedersen <jesper.pedersen@redhat.com>
Jesper Pedersen <jesper.pedersen@comcast.net>
David Fetter <david@fetter.org>
Will Leinweber <will@bitfission.com>
Junduo Dong <andj4cn@gmail.com>
Luca Ferrari <fluca1978@gmail.com>
Nikita Bugrovsky <nbugrovs@redhat.com>
Lawrence Wu <lawrence910426@gmail.com>
Yongting You <2010youy01@gmail.com>
Ashutosh Sharma <ash2003sharma@gmail.com>
12 changes: 11 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
cmake_minimum_required(VERSION 3.14.0)

set(VERSION_MAJOR "1")
set(VERSION_MINOR "6")
set(VERSION_MINOR "7")
set(VERSION_PATCH "0")
set(VERSION_STRING ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH})

Expand Down Expand Up @@ -78,6 +78,16 @@ else ()
message(FATAL_ERROR "rst2man needed")
endif()

# search for cJSON library
# <https://github.com/DaveGamble/cJSON>
find_package(cJSON)
if (cJSON_FOUND)
message(STATUS "cJSON found version ${CJSON_VERSION}")
else ()
message(FATAL_ERROR "cJSON needed")
endif()


if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
find_package(Libatomic)
if (LIBATOMIC_FOUND)
Expand Down
2 changes: 1 addition & 1 deletion CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ projects.
This code of conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community.

Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting a maintainer of the project, Jesper Pedersen <jesper.pedersen@redhat.com>.
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting a maintainer of the project, Jesper Pedersen <jesper.pedersen@comcast.net>.

### pgagroal Events Code of Conduct

Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

Copyright (C) 2023 Red Hat
Copyright (C) 2024 The pgagroal community

Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
Expand Down
23 changes: 21 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,31 @@ See [Architecture](./doc/ARCHITECTURE.md) for the architecture of `pgagroal`.
* [OpenSSL](http://www.openssl.org/)
* [systemd](https://www.freedesktop.org/wiki/Software/systemd/)
* [rst2man](https://docutils.sourceforge.io/)
* [libatomic](https://gcc.gnu.org/wiki/Atomic)
* [cJSON](https://github.com/DaveGamble/cJSON)

On Rocky Linux (and similar) operating systems, the dependencies
can be installed via `dnf(8)` as follows:

```sh
dnf install git gcc cmake make \
libev libev-devel \
openssl openssl-devel \
systemd systemd-devel \
python3-docutils \
libatomic \
cjson cjson-devel
```

Please note that, on Rocky Linux, in order to install the `python3-docutils`
package (that provides `rst2man` executable), you need to enable the `crb` repository:

```sh
dnf install git gcc cmake make libev libev-devel openssl openssl-devel systemd systemd-devel python3-docutils
dnf config-manager --set-enabled crb
```

Alternative [clang 8+](https://clang.llvm.org/) can be used.

Alternatively to GCC, [clang 8+](https://clang.llvm.org/) can be used.

### Release build

Expand Down
51 changes: 51 additions & 0 deletions cmake/FindcJSON.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# FindcJSON.cmake
# Tries to find cJSON libraries on the system
# (e.g., on Rocky Linux: cjson and cjson-devel)
#
# Inspired by <https://sources.debian.org/src/monado/21.0.0~dfsg1-1/cmake/FindcJSON.cmake/>
#
# If cJSON is found, sets the following variables:
# - CJSON_INCLUDE_DIRS
# - CJSON_LIBRARIES
# - CJSON_VERSION
#
# In the header file cJSON.h the library version is specified as:
# #define CJSON_VERSION_MAJOR 1
# #define CJSON_VERSION_MINOR 7
# #define CJSON_VERSION_PATCH 14


find_path(
CJSON_INCLUDE_DIR
NAMES cjson/cJSON.h
PATH_SUFFIXES include)
find_library(
CJSON_LIBRARY
NAMES cjson
PATH_SUFFIXES lib)

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(cJSON REQUIRED_VARS CJSON_INCLUDE_DIR
CJSON_LIBRARY)
if(CJSON_FOUND)
# these variables are needed for the build
set( CJSON_INCLUDE_DIRS "${CJSON_INCLUDE_DIR}" )
set( CJSON_LIBRARIES "${CJSON_LIBRARY}" )

# try to get out the library version from the headers
file(STRINGS "${CJSON_INCLUDE_DIR}/cjson/cJSON.h"
CJSON_VERSION_MAJOR REGEX "^#define[ \t]+CJSON_VERSION_MAJOR[ \t]+[0-9]+")
file(STRINGS "${CJSON_INCLUDE_DIR}/cjson/cJSON.h"
CJSON_VERSION_MINOR REGEX "^#define[ \t]+CJSON_VERSION_MINOR[ \t]+[0-9]+")
file(STRINGS "${CJSON_INCLUDE_DIR}/cjson/cJSON.h"
CJSON_VERSION_PATCH REGEX "^#define[ \t]+CJSON_VERSION_PATCH[ \t]+[0-9]+")
string(REGEX REPLACE "[^0-9]+" "" CJSON_VERSION_MAJOR "${CJSON_VERSION_MAJOR}")
string(REGEX REPLACE "[^0-9]+" "" CJSON_VERSION_MINOR "${CJSON_VERSION_MINOR}")
string(REGEX REPLACE "[^0-9]+" "" CJSON_VERSION_PATCH "${CJSON_VERSION_PATCH}")
set(CJSON_VERSION "${CJSON_VERSION_MAJOR}.${CJSON_VERSION_MINOR}.${CJSON_VERSION_PATCH}")
unset(CJSON_VERSION_MINOR)
unset(CJSON_VERSION_MAJOR)
unset(CJSON_VERSION_PATCH)
endif()

mark_as_advanced( CJSON_INCLUDE_DIR CJSON_LIBRARY )
2 changes: 1 addition & 1 deletion contrib/shell_comp/pgagroal_comp.bash
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ pgagroal_cli_completions()
COMPREPLY+=($(compgen -W "server prometheus" "${COMP_WORDS[2]}"))
;;
conf)
COMPREPLY+=($(compgen -W "reload get set" "${COMP_WORDS[2]}"))
COMPREPLY+=($(compgen -W "reload get set ls" "${COMP_WORDS[2]}"))
;;
status)
COMPREPLY+=($(compgen -W "details" "${COMP_WORDS[2]}"))
Expand Down
2 changes: 1 addition & 1 deletion contrib/shell_comp/pgagroal_comp.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ function _pgagroal_cli_conf()
{
local line
_arguments -C \
"1: :(reload get set)" \
"1: :(reload get set ls)" \
"*::arg:->args"
}

Expand Down
16 changes: 16 additions & 0 deletions contrib/valgrind/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Valgrind

The [Valgrind](https://valgrind.org/) tool suite provides a number of debugging and profiling tools that help you make your programs faster and more correct. The most popular and the default of these tools is called **Memcheck**. It can detect many memory-related errors that can lead to crashes and unpredictable behaviour.

# Run memory management detection

``` bash
valgrind --leak-check=full --show-leak-kinds=all --log-file=%p.log --trace-children=yes --track-origins=yes --read-var-info=yes ./pgagroal -c pgagroal.conf -a pgagroal_hba.conf
```

# Generate valgrind report with suppressed rules

``` bash
valgrind --suppressions=../../contrib/valgrind/pgagroal.supp --leak-check=full --show-leak-kinds=all --log-file=%p.log --trace-children=yes --track-origins=yes --read-var-info=yes ./pgagroal -c pgagroal.conf -a pgagroal_hba.conf
```

Loading

0 comments on commit 00da164

Please sign in to comment.