home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!noc.near.net!bigboote.WPI.EDU!nntp!gshapiro
- From: gshapiro@monkeyboy.WPI.EDU (Gregory Neil Shapiro)
- Newsgroups: comp.unix.ultrix
- Subject: Re: Gatekeeper's FTPD with Kerberos and BIND/Hesiod
- Date: 22 Dec 92 20:04:17
- Organization: Worcester Polytechnic Institute, Worcester, MA 01609-2280
- Lines: 61
- Message-ID: <GSHAPIRO.92Dec22200417@monkeyboy.WPI.EDU>
- References: <senetza.725060188@honte>
- NNTP-Posting-Host: monkeyboy.wpi.edu
- In-reply-to: senetza@sigma.uleth.ca's message of 22 Dec 92 21:36:28 GMT
-
-
- Here is the code I use to get Kerberos running before I request auth
- information. Modify your code like this:
-
- init_krb();
- <get auth information you need>
- end_krb();
-
- You must compile your program with the following libraries:
-
- auth ckrb krb des
-
- ie
-
- cc prog.c init_krb.o -o prog -lauth -lckrb -lkrb -ldes
-
- Here is init_krb.c:
-
- #include <sys/types.h>
- #include <auth.h>
- #include <krb.h>
- #include <pwd.h>
- #include <stdio.h>
- #include <strings.h>
-
- char krb_ticket_name[100];
-
- void init_krb()
- {
- char hostname[100];
-
- if (gethostname(hostname, sizeof(hostname)) < 0) {
- perror("gethostname");
- exit(1);
- }
- if (strchr(hostname, '.'))
- *(strchr(hostname, '.')) = 0;
-
- sprintf(krb_ticket_name, "/var/dss/kerberos/tkt/tkt.%d", getpid());
- krb_set_tkt_string(krb_ticket_name);
-
- config_auth();
-
- if (krb_svc_init("hesiod", hostname, (char *)NULL, 0, (char *)NULL,
- (char *)NULL) != KSUCCESS) {
- fprintf(stderr, "Couldn't initialize Kerberos\n");
- exit(1);
- }
- }
-
- void end_krb()
- {
- unlink(krb_ticket_name);
- }
-
- --
- ____________________________________________________________________________
- Gregory Neil Shapiro gshapiro@wpi.wpi.edu
- Academic Systems Integrator, College Computer Center
- Worcester Polytechnic Institute
- ____________________________________________________________________________
-