Skip to content
Browse files

Support using virtual paths in the web server

  • Loading branch information...
1 parent 2cf07a7 commit ce0d32e91e06b9a909c8e665ca531cccb40433ea @lattera lattera committed Jan 16, 2012
View
6 sites/all/modules/wayfair/vulnscan/helpers.inc
@@ -257,13 +257,17 @@ function get_all_sites_assoc() {
function list_scans($user) {
$scans = array();
$base = variable_get('vulnscan_scan_output_location', '');
+ $alias = variable_get('vulnscan_alias', '');
if (strlen($base) == 0)
return $scans;
if (is_dir($base . '/' . $user->uid) == false)
return $scans;
+ if (strlen($alias) == 0)
+ $alias = $base;
+
$basedir = dir($base . '/' . $user->uid);
while (($server = $basedir->read()) !== FALSE) {
if ($server[0] == '.')
@@ -276,7 +280,7 @@ function list_scans($user) {
if ($scan[0] == '.')
continue;
- $scans[$server][$scan] = $base . '/' . $user->uid . '/' . $server . '/' . $scan;
+ $scans[$server][$scan] = $alias . '/' . $user->uid . '/' . $server . '/' . $scan;
}
$serverdir->close();
}
View
13 sites/all/modules/wayfair/vulnscan/vulnscan.admin.inc
@@ -35,6 +35,14 @@ function vulnscan_admin_settings($form, &$form_state) {
'#size' => 60,
);
+ $form['vulnscan_scanner_settings']['alias'] = array(
+ '#type' => 'textfield',
+ '#title' => t('Web Server Virtual Path'),
+ '#description' => t('Virtual Path to the scanner output location'),
+ '#default_value' => variable_get('vulnscan_alias', ''),
+ '#size' => 60,
+ );
+
/* Server settings */
$form['vulnscan_server_settings'] = array(
'#type' => 'fieldset',
@@ -74,6 +82,9 @@ function vulnscan_admin_settings_submit($form, &$form_state) {
if (isset($form_state['values']['scan_output_location']))
variable_set('vulnscan_scan_output_location', $form_state['values']['scan_output_location']);
+ if (isset($form_state['values']['alias']))
+ variable_set('vulnscan_alias', $form_state['values']['alias']);
+
/* Save the new server */
if (isset($form_state['values']['new_server']) && strlen($form_state['values']['new_server']))
if (add_server($form_state['values']['new_server']) == false)
@@ -85,8 +96,6 @@ function vulnscan_admin_settings_submit($form, &$form_state) {
}
function vulnscan_admin_settings_servergroup($form, &$form_state) {
-// form_set_error('new_servergroup', t('form_state: @state', array('@state' => var_export($form_state, TRUE))));
-// form_set_error('new_servergroup', t('form_state: @state', array('@state' => var_export($form_state, TRUE))));
$groups = get_all_server_groups_assoc();
$form['vulnscan_servergroup'] = array(
View
2 sites/all/modules/wayfair/vulnscan/vulnscan.install
@@ -92,6 +92,7 @@ function vulnscan_schema() {
function vulnscan_install() {
variable_set('vulnscan_skipfish_location', '/usr/local/bin/skipfish -u -o \'%{DIR}\' -C \'Server_80=%{SERVER}\' -C \'Server_81=%{SERVER}\' \'%{SITE}\'');
variable_set('vulnscan_scan_output_location', '/scans');
+ variable_set('vulnscan_alias', '/scans');
db_insert('vulnscan_sites')
->fields(array(
@@ -112,4 +113,5 @@ function vulnscan_install() {
function vulnscan_uninstall() {
variable_del('vulnscan_skipfish_location');
variable_del('vulnscan_scan_output_location');
+ variable_del('vulnscan_alias');
}

0 comments on commit ce0d32e

Please sign in to comment.
Something went wrong with that request. Please try again.