File: signed.nasl

package info (click to toggle)
openvas-libnasl 2.0.2-2
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 2,836 kB
  • ctags: 1,247
  • sloc: ansic: 15,545; sh: 8,294; yacc: 1,050; makefile: 234; perl: 9
file content (29 lines) | stat: -rw-r--r-- 842 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# test script with a valid signature.  If this file is modified the
# corresponding signature file has to be updated too.

# Determines whether the script being executed is authenticated.
function display_authentication_status()
{
  local_var s;

  # There doesn't seem to be a built-in way to check the authentication
  # status directly, so we do this by trying to call a function that can
  # only be called when the script is authenticated.  We use file_stat
  # because it meets a number of requirements:
  #  1. Only returns NULL when the script is not authenticated
  #  2. Does not rely on certain files or commands being present on the system
  #  3. Doesn't have side effects.

  s = file_stat("/");

  if (s != NULL)
    {
      display("YES\n");
    }
  else
    {
      display("NO\n");
    }
}

display_authentication_status();