Content-type: text/html Manpage of SAFE_OPEN_REGISTER_PATH_WARNING_CALLBACK

SAFE_OPEN_REGISTER_PATH_WARNING_CALLBACK

Section: (3)
Updated: 2011-07-26
Index Return to Main Contents
 

NAME

safe_open_register_path_warning_callback - register a callback to warn the application when a path is being manipulated in the safe open and fopen replacement functions  

SYNOPSIS

#include safe_open.h

typedef int (*safe_open_pw_callback)(const char *fn);

safe_open_pw_callback safe_open_register_path_warning_callback(safe_open_pw_callback func);  

DESCRIPTION

safe_open_register_path_warning_callback is used to register a function that is called when one of the safe open or fopen replacement functions (see SEE ALSO section for the complete list) detects that the file name is being manipulated during operation.

This provides the application with a warning mechanism that an attack on the file name may be occurring. An application may expect to see an occasional false positive depending upon its design, but repeated warnings almost certainly indicates an active attack or a misconfigured or designed application.  

Callback function description

The registered callback function is called with the file name that caused the path manipulation to be detected in fn.

The expected use of this function is to log the file name that caused the path manipulation to be detected to allow an active attack to be detected.

Other potential uses would be to immediately cause the program to exit, or returning a non-zero value and having the function return an error immediately (-1 for the open(2) replacements and NULL for the fopen (3) replacements).  

Callback function return value

If 0 is returned from the callback, the function that detected the manipulation will retry the operation as if no callback were registered. If a non-zero value is returned the function that detected the manipulation will immediately return an error to its caller.  

RETURN VALUE

The previous callback function is returned.  

ERRORS

None.  

AUTHOR

James A. Kupsch  

SEE ALSO

safe_open_wrapper(3) safe_open_wrapper_follow(3) safe_open_no_create(3) safe_open_no_create_follow(3) safe_create_fail_if_exists(3) safe_create_keep_if_exists(3) safe_create_keep_if_exists_follow(3) safe_create_replace_if_exists(3) safe_fopen_wrapper(3) safe_fopen_wrapper_follow(3) safe_fopen_no_create(3) safe_fopen_no_create_follow(3) safe_fcreate_fail_if_exists(3) safe_fcreate_keep_if_exists(3) safe_fcreate_keep_if_exists_follow(3) safe_fcreate_replace_if_exists(3)


 

Index

NAME
SYNOPSIS
DESCRIPTION
Callback function description
Callback function return value
RETURN VALUE
ERRORS
AUTHOR
SEE ALSO

This document was created by man2html, using the manual pages.
Time: 15:16:59 GMT, August 12, 2011