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();
|