1/*++ 2/* NAME 3/* safe_getenv 3 4/* SUMMARY 5/* guarded getenv() 6/* SYNOPSIS 7/* #include <safe.h> 8/* 9/* char *safe_getenv(const name) 10/* char *name; 11/* DESCRIPTION 12/* The \fBsafe_getenv\fR() routine reads the named variable from the 13/* environment, provided that the unsafe() routine agrees. 14/* SEE ALSO 15/* unsafe(3), detect non-user privileges 16/* LICENSE 17/* .ad 18/* .fi 19/* The Secure Mailer license must be distributed with this software. 20/* AUTHOR(S) 21/* Wietse Venema 22/* IBM T.J. Watson Research 23/* P.O. Box 704 24/* Yorktown Heights, NY 10598, USA 25/*--*/ 26 27/* System library. */ 28 29#include <sys_defs.h> 30#include <stdlib.h> 31 32/* Utility library. */ 33 34#include "safe.h" 35 36/* safe_getenv - read environment variable with guard */ 37 38char *safe_getenv(const char *name) 39{ 40 return (unsafe() == 0 ? getenv(name) : 0); 41} 42