[27462] in Kerberos
RE: GSSAPI keytab location per application
daemon@ATHENA.MIT.EDU (Daniel Kahn Gillmor)
Fri Feb 16 11:13:36 2007
MIME-Version: 1.0
Message-ID: <17877.55322.869416.984254@squeak.fifthhorseman.net>
Date: Fri, 16 Feb 2007 11:13:14 -0500
To: kerberos@mit.edu
In-Reply-To: <9362A0EF2D8D204D83E3714069C6AA05BD8E49@cosaex02.corp.cosa.de>
From: Daniel Kahn Gillmor <dkg-mit.edu@fifthhorseman.net>
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: kerberos-bounces@mit.edu
At 2007-02-16 10:30, dpeger@cosa.de said:
> Otherwise I think setting KRB5_KTNAME in some kind of startup script
> as mentioned by Daniel and Simon in the two other responses is an
> adequate solution.
you also can set the variable directly within your code with putenv(),
if you want to read the value from a config file or the command line.
For example, here's testkrb5kt.c:
#include <stdio.h>
#include <stdlib.h>
#include <krb5.h>
/*
testkrb5kt.c: a demonstration of choosing the default keytab name.
build with:
gcc -g -Wall --pedantic -o testkrb5kt testkrb5kt.c -lkrb5
*/
int main(int argc, char* argv[]) {
char inp[1024];
char buf[1024];
int ret;
krb5_context context;
if (argc > 1) {
snprintf(inp, sizeof(inp), "KRB5_KTNAME=FILE:%s", argv[1]);
putenv(inp);
}
krb5_init_context(&context);
ret = krb5_kt_default_name(context, buf, sizeof(buf));
printf("%s\n", buf);
krb5_free_context(context);
return ret;
}
hth,
--dkg
________________________________________________
Kerberos mailing list Kerberos@mit.edu
https://mailman.mit.edu/mailman/listinfo/kerberos