Skip to content

Commit

Permalink
Merge branch 'main' into script-stats
Browse files Browse the repository at this point in the history
  • Loading branch information
jjnicola authored Jan 10, 2025
2 parents 5d5efde + 69838a9 commit 0c1e7bb
Show file tree
Hide file tree
Showing 81 changed files with 1,716 additions and 255 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/linting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,10 @@ jobs:
- uses: actions/checkout@v4
- run: cargo install cargo-audit
- run: cargo audit
License-Headers:
runs-on: ubuntu-latest
steps:
- name: Check out openvas-scanner
uses: actions/checkout@v4
- name: Check license headers
run: bash ./check_license_headers.bash
33 changes: 33 additions & 0 deletions check_license_headers.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/usr/bin/env bash

function comment_string () {
ext=$1
if [[ $ext == "c" || $ext == "h" || $ext == "rs" ]]; then
echo "//"
elif [[ $ext == "nasl" || $ext == "cmake" ]]; then
echo "#"
fi
}

any_missing_headers=0

exts="c h nasl cmake"

for ext in $exts; do
find . -not -path "./rust/target/*" -not -path "./rust/crates/nasl-c-lib/tmp/*" -regex ".*\.\($ext\)" -print0 | while read -d $'\0' f; do
header=$(head -n 3 "$f")
if ! [[ "$header" =~ SPDX ]]; then
echo "File does not contain license header: $f"
any_missing_headers=1

if [[ "$1" == add_header ]]; then
tmpfile=$(mktemp)
cp "$f" "$tmpfile"
comment=$(comment_string $ext)
echo -e "$comment SPDX-FileCopyrightText: 2025 Greenbone AG\n$comment\n$comment SPDX-License-Identifier: GPL-2.0-or-later WITH x11vnc-openssl-exception\n" | cat - $tmpfile > "$f"
fi
fi
done
done

exit $any_missing_headers
4 changes: 4 additions & 0 deletions misc/openvas-krb5.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
// SPDX-FileCopyrightText: 2025 Greenbone AG
//
// SPDX-License-Identifier: GPL-2.0-or-later WITH x11vnc-openssl-exception

#include "openvas-krb5.h"

#include <ctype.h>
Expand Down
4 changes: 4 additions & 0 deletions misc/openvas-krb5.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
// SPDX-FileCopyrightText: 2025 Greenbone AG
//
// SPDX-License-Identifier: GPL-2.0-or-later WITH x11vnc-openssl-exception

#include <krb5/krb5.h>
#include <stdbool.h>
#ifndef OPENVAS_KRB5
Expand Down
4 changes: 4 additions & 0 deletions nasl/nasl_krb5.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
// SPDX-FileCopyrightText: 2025 Greenbone AG
//
// SPDX-License-Identifier: GPL-2.0-or-later WITH x11vnc-openssl-exception

#include "nasl_krb5.h"

#include "../misc/openvas-krb5.h"
Expand Down
4 changes: 4 additions & 0 deletions nasl/nasl_krb5.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
// SPDX-FileCopyrightText: 2025 Greenbone AG
//
// SPDX-License-Identifier: GPL-2.0-or-later WITH x11vnc-openssl-exception

#include "nasl_lex_ctxt.h"
#include "nasl_tree.h"

Expand Down
Loading

0 comments on commit 0c1e7bb

Please sign in to comment.