*nix Documentation Project
·  Home
 +   man pages
·  Linux HOWTOs
·  FreeBSD Tips
·  *niX Forums

  man pages->FreeBSD man pages -> _secure_path (3)              
Title
Content
Arch
Section
 

_SECURE_PATH(3)

Contents


NAME    [Toc]    [Back]

     _secure_path -- determine if a file appears to be secure

LIBRARY    [Toc]    [Back]

     System Utilities Library (libutil, -lutil)

SYNOPSIS    [Toc]    [Back]

     #include <sys/types.h>
     #include <libutil.h>

     int
     _secure_path(const char *path, uid_t uid, gid_t gid);

DESCRIPTION    [Toc]    [Back]

     This function does some basic security checking on a given path.  It is
     intended to be used by processes running with root privileges in order to
     decide whether or not to trust the contents of a given file.  It uses a
     method often used to detect system compromise.

     A file is considered `secure' if it meets the following conditions:

     1.   The file exists, and is a regular file (not a symlink, device special
 or named pipe, etc.),

     2.   Is not world writable.

     3.   Is owned by the given uid or uid 0, if uid is not -1,

     4.   Is not group writable or it has group ownership by the given gid, if
	  gid is not -1.

RETURN VALUES    [Toc]    [Back]

     This function returns zero if the file exists and may be considered
     secure, -2 if the file does not exist, and -1 otherwise to indicate a
     security failure.	The syslog(3) function is used to log any failure of
     this function, including the reason, at LOG_ERR priority.

BUGS    [Toc]    [Back]

     The checks carried out are rudimentary and no attempt is made to eliminate
 race conditions between use of this function and access to the file
     referenced.

SEE ALSO    [Toc]    [Back]

      
      
     lstat(2), syslog(3)

HISTORY    [Toc]    [Back]

     Code from which this function was derived was contributed to the FreeBSD
     project by Berkeley Software Design, Inc.


FreeBSD 5.2.1			  May 2, 1997			 FreeBSD 5.2.1
[ Back ]
 Similar pages
Name OS Title
secure_path NetBSD determine if a file appears to be ``secure''
getwscrn IRIX returns the screen upon which the current window appears
rqsread IRIX reads the information out of an ELF file that is needed to determine if the file needs to be requickstarted
isastream Tru64 Determine if a file descriptor refers to a STREAMS file
sftp OpenBSD secure file transfer program
securettys Tru64 Secure terminal database file
sftp FreeBSD Secure file transfer program
ssh2_config Tru64 Configuration file for the Secure Shell client
sftp2 Tru64 Secure Shell file transfer client
sftp Tru64 Secure Shell file transfer client
Copyright © 2004-2005 DeniX Solutions SRL
newsletter delivery service