DragonFly On-Line Manual Pages

Search: Section:  


PRIV_CUSTOM(3)                    Subroutines                   PRIV_CUSTOM(3)

NAME

priv_register_{info,cap}_fn, priv_invoke_{info,cap}_fn - register and invoke custom privileged methods.

SYNOPSIS

#include <privman.h> int priv_register_info_fn(char *(*fnptr)(char * const *)); int priv_register_cap_fn(int (*fnptr)(char * const *)); char *priv_invoke_info_fn(int handle, char * const args[]); int priv_invoke_cap_fn(int handle, char * const args[]);

DESCRIPTION

These methods allow you to register functions to be executed inside the Privman server. The info functions return a string, the capability functions return a file descriptor. The register functions only work before priv_init(3) is invoked. They return an integer handle to identify the registered function. The handle is then passed into the invoke functions after priv_init(3) s invoked to cause the registered function to be invoked inside the context of the Privman server.

RETURN VALUE

On success, a handle is returned. On error, -1 is returned and errno is set appropriately.

ERRORS

If one of the register functions is called after priv_init(3) is invoked, errno will be EPERM. If an invalid handle is passed to either of the invoke functions, either -1 or NULL will be returned, and errno will be set to ENOENT. If the registered function returns -1 or NULL, errno will be set to the value of errno after the registered function was executed.

BUGS

There is currently no configuration option to allow setting custom methods. While the fork(2) that happens in priv_init(3) will protect the Privman servers function map from modification, any poorly written methods can trash the servers state. Write your custom methods carefully.

AUTHOR

Network Associates. Send email to <privman@nailabs.com>

SEE ALSO

priv_daemon(3) priv_execve(3) priv_fopen(3) priv_fork(3) priv_wait4(3) priv_init(3) privman_conf(5) priv_open(3) priv_pam(3) priv_rerunas(3) priv_rerespawn_as(3) privman(7) Unix OCTOBER 2002 PRIV_CUSTOM(3)

Search: Section: