From 16052f05e56f0ef58fdd3a7e32a7e5c6ec7ca0f7 Mon Sep 17 00:00:00 2001 From: david Date: Thu, 16 Oct 2008 17:04:06 +0000 Subject: [PATCH] Add an example of testing for the availability of the openssl module in nselib/openssl.luadoc. --- nselib/openssl.luadoc | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/nselib/openssl.luadoc b/nselib/openssl.luadoc index cf1b3eaef..15119e235 100644 --- a/nselib/openssl.luadoc +++ b/nselib/openssl.luadoc @@ -2,6 +2,19 @@ -- \n\n -- This module is a wrapper for OpenSSL functions that provide encryption and -- decryption, hashing, and multiprecision integers. +-- \n\n +-- The openssl module may not always be available--it depends on whether +-- OpenSSL support was enabled at compile time. Scripts using the module should +-- be made to fail gracefully using code like the following: +-- \n\n +-- if not pcall(require, "openssl") then +-- action = function(host, port) +-- stdnse.print_debug(2, "Skipping \"%s\" because OpenSSL is missing.", id) +-- end +-- end +-- action = action or function(host, port) +-- ... +-- end -- @author Sven Klemm -- @copyright See nmaps COPYING for licence