Add missing function exports to library files
QA scan found 4 library files with functions that weren't exported, making them unavailable in subshells and nested calls. Added export statements for: - lib/attack-signatures.sh: 3 functions - lib/http-attack-analyzer.sh: 5 functions - lib/email-functions.sh: 18 functions - lib/rate-anomaly-detector.sh: 9 functions Total: 35 functions now properly exported This ensures functions are available when libraries are sourced by scripts that spawn subshells or use process substitution.
This commit is contained in:
@@ -311,3 +311,8 @@ get_category_name() {
|
||||
*) echo "$category" ;;
|
||||
esac
|
||||
}
|
||||
|
||||
# Export functions for use in subshells
|
||||
export -f check_attack_pattern
|
||||
export -f detect_all_attack_signatures
|
||||
export -f get_category_name
|
||||
|
||||
@@ -291,3 +291,23 @@ if ! type detect_control_panel &>/dev/null; then
|
||||
fi
|
||||
}
|
||||
fi
|
||||
|
||||
# Export functions for use in subshells
|
||||
export -f detect_mta
|
||||
export -f get_mail_log_path
|
||||
export -f get_mailbox_base_path
|
||||
export -f validate_email
|
||||
export -f get_email_domain
|
||||
export -f get_email_local
|
||||
export -f format_size
|
||||
export -f check_mta_running
|
||||
export -f get_mta_version
|
||||
export -f get_queue_count
|
||||
export -f check_dns_record
|
||||
export -f get_primary_ip
|
||||
export -f is_valid_ip
|
||||
export -f get_reverse_dns
|
||||
export -f send_test_email
|
||||
export -f parse_exim_email
|
||||
export -f get_log_date_range
|
||||
export -f count_by_sender
|
||||
|
||||
@@ -293,3 +293,10 @@ format_threat_display() {
|
||||
echo " URI: ${URI:0:100}"
|
||||
[ -n "$SIGNATURES" ] && echo " Signatures: $SIGNATURES"
|
||||
}
|
||||
|
||||
# Export functions for use in subshells
|
||||
export -f analyze_http_log_line
|
||||
export -f analyze_http_log_batch
|
||||
export -f monitor_http_log_realtime
|
||||
export -f parse_http_analysis_result
|
||||
export -f format_threat_display
|
||||
|
||||
@@ -246,3 +246,14 @@ start_rate_cleanup_task() {
|
||||
|
||||
echo $! # Return PID of cleanup task
|
||||
}
|
||||
|
||||
# Export functions for use in subshells
|
||||
export -f record_request
|
||||
export -f detect_rate_anomaly
|
||||
export -f analyze_request_pattern
|
||||
export -f cleanup_rate_tracking
|
||||
export -f get_current_rate
|
||||
export -f is_flooding
|
||||
export -f format_rate_anomaly
|
||||
export -f init_rate_tracking
|
||||
export -f start_rate_cleanup_task
|
||||
|
||||
Reference in New Issue
Block a user