ret = krb5_get_default_config_files(&filenames);
if (ret)
return ret;
- if (envname == NULL || (kdc_config = getenv(envname)) == NULL)
+ if (envname == NULL || (kdc_config = secure_getenv(envname)) == NULL)
kdc_config = fname;
k5_buf_init_dynamic(&buf);
if (kdc_config)
struct passwd pwx, *pwd;
if (!context->profile_secure)
- homedir = getenv("HOME");
+ homedir = secure_getenv("HOME");
if (homedir == NULL) {
if (k5_getpwuid_r(geteuid(), &pwx, pwbuf, sizeof(pwbuf), &pwd) != 0)
return os_ctx->default_ccname;
/* Try the environment variable first. */
- envstr = getenv(KRB5_ENV_CCNAME);
+ envstr = secure_getenv(KRB5_ENV_CCNAME);
if (envstr != NULL) {
os_ctx->default_ccname = strdup(envstr);
return os_ctx->default_ccname;
const char *p = NULL;
if (context == NULL || !context->profile_secure)
- p = getenv("TMPDIR");
+ p = secure_getenv("TMPDIR");
*ret = strdup((p != NULL) ? p : "/tmp");
if (*ret == NULL)
return ENOMEM;
char *name = 0;
if (!secure) {
- char *env = getenv("KRB5_CONFIG");
+ char *env = secure_getenv("KRB5_CONFIG");
if (env) {
name = strdup(env);
if (!name) return ENOMEM;
if (secure) {
filepath = DEFAULT_SECURE_PROFILE_PATH;
} else {
- filepath = getenv("KRB5_CONFIG");
+ filepath = secure_getenv("KRB5_CONFIG");
if (!filepath) filepath = DEFAULT_PROFILE_PATH;
}
size_t count = 0;
profile_filespec_t *newfiles;
- file = getenv(KDC_PROFILE_ENV);
+ file = secure_getenv(KDC_PROFILE_ENV);
if (file == NULL)
file = DEFAULT_KDC_PROFILE;
*name_out = strdup(krb5_overridekeyname);
return (*name_out == NULL) ? ENOMEM : 0;
} else if (context->profile_secure == FALSE &&
- (str = getenv("KRB5_KTNAME")) != NULL) {
+ (str = secure_getenv("KRB5_KTNAME")) != NULL) {
*name_out = strdup(str);
return (*name_out == NULL) ? ENOMEM : 0;
} else if (profile_get_string(context->profile, KRB5_CONF_LIBDEFAULTS,
char *str;
if (context->profile_secure == FALSE &&
- (str = getenv("KRB5_CLIENT_KTNAME")) != NULL) {
+ (str = secure_getenv("KRB5_CLIENT_KTNAME")) != NULL) {
*name_out = strdup(str);
return (*name_out == NULL) ? ENOMEM : 0;
} else if (profile_get_string(context->profile, KRB5_CONF_LIBDEFAULTS,
{
const char *filename;
- filename = getenv("KRB5_TRACE");
+ filename = secure_getenv("KRB5_TRACE");
if (filename)
(void) krb5_set_trace_filename(context, filename);
}
krb5_rc_default_type(krb5_context context)
{
char *s;
- if ((s = getenv("KRB5RCACHETYPE")))
+ if ((s = secure_getenv("KRB5RCACHETYPE")))
return s;
else
return "dfl";
krb5_rc_default_name(krb5_context context)
{
char *s;
- if ((s = getenv("KRB5RCACHENAME")))
+ if ((s = secure_getenv("KRB5RCACHENAME")))
return s;
else
return (char *) 0;
{
char *dir;
- if (!(dir = getenv("KRB5RCACHEDIR"))) {
+ if (!(dir = secure_getenv("KRB5RCACHEDIR"))) {
#if defined(_WIN32)
if (!(dir = getenv("TEMP")))
if (!(dir = getenv("TMP")))
dir = "C:";
#else
- if (!(dir = getenv("TMPDIR"))) {
+ if (!(dir = secure_getenv("TMPDIR"))) {
#ifdef RCTMPDIR
dir = RCTMPDIR;
#else
* SUCH DAMAGES.
*/
-#include <errno.h>
-#include <string.h>
-#include <stdio.h>
-#include <stdlib.h>
+#include "pkinit.h"
#include <dlfcn.h>
-#include <unistd.h>
#include <dirent.h>
-#include "pkinit.h"
-
static void
free_list(char **list)
{
switch (idtype) {
case IDTYPE_ENVVAR:
return process_option_identity(context, plg_cryptoctx, req_cryptoctx,
- idopts, id_cryptoctx, getenv(residual));
+ idopts, id_cryptoctx,
+ secure_getenv(residual));
break;
case IDTYPE_FILE:
retval = parse_fs_options(context, idopts, residual);
} else if (strncmp(location, "DIR:", 4) == 0) {
return load_anchor_dir(store, location + 4);
} else if (strncmp(location, "ENV:", 4) == 0) {
- envloc = getenv(location + 4);
+ envloc = secure_getenv(location + 4);
if (envloc == NULL)
return ENOENT;
return load_anchor(ctx, envloc);
prf->magic = PROF_MAGIC_FILE;
if (filespec[0] == '~' && filespec[1] == '/') {
- home_env = getenv("HOME");
+ home_env = secure_getenv("HOME");
#ifdef HAVE_PWD_H
if (home_env == NULL) {
uid_t uid;