Skip to content

Commit

Permalink
Merge branch 'main' into glib-warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
mattmundell authored Sep 27, 2023
2 parents 87de275 + 437bb8c commit 161d9dd
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 38 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/build-container.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: greenbone/actions/is-latest-tag@v3
id: latest
- name: Setup container meta information
id: meta
uses: docker/metadata-action@v4
uses: docker/metadata-action@v5
with:
images: ${{ github.repository }}-build
labels: |
Expand Down Expand Up @@ -65,17 +65,17 @@ jobs:
fi
- name: Login to DockerHub
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- run: echo "Build and push ${{ steps.meta.outputs.tags }}"
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
uses: docker/setup-buildx-action@v3
- name: Build and push
uses: docker/build-push-action@v4
uses: docker/build-push-action@v5
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/ci-c.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
name: Check C Source Code Formatting
runs-on: "ubuntu-latest"
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Check Source Format
run: |
clang-format -i -style=file src/*.{c,h}
Expand All @@ -25,7 +25,7 @@ jobs:
- greenbone/gsad-build:stable
container: ${{ matrix.container }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Configure and compile gsad
run: |
mkdir build
Expand All @@ -39,7 +39,7 @@ jobs:
runs-on: ubuntu-latest
container: greenbone/gsad-build:stable
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Configure and compile gsad
run: |
cmake -B build -DCMAKE_BUILD_TYPE=Debug -DBUILD_TESTING=1 .
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/container.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: greenbone/actions/is-latest-tag@v3
id: latest
- name: Setup container meta information
id: meta
uses: docker/metadata-action@v4
uses: docker/metadata-action@v5
with:
images: ${{ github.repository }}
labels: |
Expand Down Expand Up @@ -57,16 +57,16 @@ jobs:
fi
- name: Login to Docker Registry
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
uses: docker/setup-buildx-action@v3
- name: Build and push Container image
uses: docker/build-push-action@v4
uses: docker/build-push-action@v5
with:
context: .
push: ${{ github.event_name != 'pull_request' && (github.ref_type == 'tag' || github.ref_name == 'main') }}
Expand Down
65 changes: 43 additions & 22 deletions src/gsad_http_handler.c
Original file line number Diff line number Diff line change
Expand Up @@ -753,57 +753,78 @@ handle_static_config (http_connection_t *connection, const char *method,
NULL);
}

http_handler_t *
init_http_handlers ()
static http_handler_t *
make_url_handlers ()
{
http_handler_t *method_router;
http_handler_t *gmp_post_handler;
http_handler_t *url_handlers;

http_validator = gvm_validator_new ();
gvm_validator_add (http_validator, "slave_id", SLAVE_ID_REGEXP);
gvm_validator_add (http_validator, "token", TOKEN_REGEXP);

handlers = http_handler_new (handle_validate);

method_router = method_router_new ();
gmp_post_handler = http_handler_new (handle_gmp_post);

http_handler_add (handlers, method_router);
http_handler_t *gmp_handler, *gmp_url_handler;
http_handler_t *system_report_handler, *system_report_url_handler;
http_handler_t *logout_handler, *logout_url_handler;

url_handlers = url_handler_new ("^/(img|js|css|locales)/.+$",
http_handler_new (handle_static_file));

// Add simpler handlers.

url_handler_add_func (url_handlers, "^/robots\\.txt$", handle_static_file);

url_handler_add_func (url_handlers, "^/config\\.*js$", handle_static_config);
url_handler_add_func (url_handlers, "^/static/(img|js|css|media)/.+$",
handle_static_file);
url_handler_add_func (url_handlers, "^/manual/.+$", handle_static_file);

http_handler_t *gmp_handler = http_handler_new (handle_setup_user);
// Create /gmp handler.

gmp_handler = http_handler_new (handle_setup_user);
http_handler_add (gmp_handler, http_handler_new (handle_setup_credentials));
http_handler_add (gmp_handler, http_handler_new (handle_gmp_get));
http_handler_t *gmp_url_handler = url_handler_new ("^/gmp$", gmp_handler);
gmp_url_handler = url_handler_new ("^/gmp$", gmp_handler);

// Create /system_report handler.

http_handler_t *system_report_handler = http_handler_new (handle_setup_user);
system_report_handler = http_handler_new (handle_setup_user);
http_handler_add (system_report_handler,
http_handler_new (handle_setup_credentials));
http_handler_add (system_report_handler,
http_handler_new (handle_system_report));
http_handler_t *system_report_url_handler =
system_report_url_handler =
url_handler_new ("^/system_report/.+$", system_report_handler);

http_handler_t *logout_handler = http_handler_new (handle_get_user);
// Create /logout handler.

logout_handler = http_handler_new (handle_get_user);
http_handler_add (logout_handler, http_handler_new (handle_logout));
http_handler_t *logout_url_handler =
url_handler_new ("^/logout/?$", logout_handler);
logout_url_handler = url_handler_new ("^/logout/?$", logout_handler);

// Add the handlers.

http_handler_add (url_handlers, gmp_url_handler);
http_handler_add (url_handlers, system_report_url_handler);
http_handler_add (url_handlers, logout_url_handler);

http_handler_add (url_handlers, http_handler_new (handle_index));

return url_handlers;
}

http_handler_t *
init_http_handlers ()
{
http_handler_t *method_router, *gmp_post_handler, *url_handlers;

http_validator = gvm_validator_new ();
gvm_validator_add (http_validator, "slave_id", SLAVE_ID_REGEXP);
gvm_validator_add (http_validator, "token", TOKEN_REGEXP);

handlers = http_handler_new (handle_validate);

method_router = method_router_new ();
gmp_post_handler = http_handler_new (handle_gmp_post);

http_handler_add (handlers, method_router);

url_handlers = make_url_handlers ();

method_router_set_get_handler (method_router, url_handlers);
method_router_set_post_handler (method_router, gmp_post_handler);

Expand Down

0 comments on commit 161d9dd

Please sign in to comment.