HPlogo HP-UX Reference > S

secdef(3)

HP-UX 11i Version 2: December 2007 Update
» 

Technical documentation

 » Table of Contents

 » Index

NAME

secdef: open_secdef(), close_secdef(), get_secdef_str(), get_secdef_int() — security defaults configuration file routines

SYNOPSIS

#include <prot.h>

int open_secdef (void);

int close_secdef (void);

int get_secdef_str(char *parameter, char *value);

int get_secdef_int(char *parameter, char *value);

DESCRIPTION

open_secdef() opens the security configuration file /etc/default/security. This function must be called prior to calling get_secdef_str() or get_secdef_int().

close_secdef() closes the security configuration file.

get_secdef_str() and get_secdef_int() return the value of the specified parameter defined in the security configuration file. See the security(4) manpage.

Programs using these routines must be compiled with -lsec.

APPLICATION USAGE

In a multithreaded application, these interfaces are thread-safe, but not async-cancel-safe. A cancellation point may occur when a thread is executing any of these interfaces.

RETURN VALUE

open_secdef() returns a value of 0 if the open completed successfully. Otherwise, it returns -1 and leaves errno unchanged from the fstat call. get_secdef_str() and get_secdef_int() return the following:

0

The value of the specified parameter was successfully returned.

-1

The entry was not found, or the security configuration file was not opened.

-2

The format of the entry was incorrect.

EXAMPLES

This example obtains the "path" from the SU_DEFAULT_PATH=path parameter.

char supath[MAXPATHLEN+100]; if (open_secdef() == 0) { if (get_secdef_str("SU_DEFAULT_PATH", supath) == 0) printf("su path is %s", supath); close_secdef() }

FILES

/etc/default/security

Security defaults configuration file.

SEE ALSO

security(4).