0

I have an a member server with a windows PDC with active directory. Security=ads.

I am trying to set an environment variable(credential cache) using C:

setenv("CCACHE","cache_name",1);

However, when i do a getenv("CCACHE"), its still showing the old value of the variable. Can someone help me with this?

EDIT: I am basically trying to set the ccache for kerberos authentication. Calling the fn const char * krb5_cc_default_name(krb5_context context) still returns the old value for the cache.

According to MIT kerberos documentation,

The default credential cache name is cached in context between calls to this function, so if the value of KRB5CCNAME changes in the process environment after the first call to this function on, that change will not be reflected in later calls with the same context. The caller can invoke krb5_cc_set_default_name() with a NULL value of name to clear the cached value and force the default name to be recomputed.

I have tried that but it still returns the old value.

xerocool
  • 1
  • 4
  • you didn't mention what language/script/shell you are using. Anyway, I found you this [link](http://pubs.opengroup.org/onlinepubs/009695399/functions/setenv.html) – strongline May 07 '15 at 13:00
  • Have edited the question. Hope its more clear now. – xerocool May 08 '15 at 03:42

1 Answers1

0

From other thread: The environment variables are set within the context of your program.

When your program exits, you're back in the context from where your program was started.

see this thread ->. This thread covers other situations as well, e.g. different process in same program.

strongline
  • 592
  • 2
  • 8
  • But I called getenv() in the very next line(after using setenv()). It should atleast show the newly set value there. – xerocool May 08 '15 at 03:59