home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / unix / ultrix / 9051 < prev    next >
Encoding:
Text File  |  1992-12-22  |  1.9 KB  |  74 lines

  1. Path: sparky!uunet!noc.near.net!bigboote.WPI.EDU!nntp!gshapiro
  2. From: gshapiro@monkeyboy.WPI.EDU (Gregory Neil Shapiro)
  3. Newsgroups: comp.unix.ultrix
  4. Subject: Re: Gatekeeper's FTPD with Kerberos and BIND/Hesiod
  5. Date: 22 Dec 92 20:04:17
  6. Organization: Worcester Polytechnic Institute, Worcester, MA 01609-2280
  7. Lines: 61
  8. Message-ID: <GSHAPIRO.92Dec22200417@monkeyboy.WPI.EDU>
  9. References: <senetza.725060188@honte>
  10. NNTP-Posting-Host: monkeyboy.wpi.edu
  11. In-reply-to: senetza@sigma.uleth.ca's message of 22 Dec 92 21:36:28 GMT
  12.  
  13.  
  14. Here is the code I use to get Kerberos running before I request auth
  15. information.  Modify your code like this:
  16.  
  17. init_krb();
  18. <get auth information you need>
  19. end_krb();
  20.  
  21. You must compile your program with the following libraries: 
  22.  
  23. auth ckrb krb des
  24.  
  25. ie 
  26.  
  27. cc prog.c init_krb.o -o prog -lauth -lckrb -lkrb -ldes
  28.  
  29. Here is init_krb.c:
  30.  
  31. #include <sys/types.h>
  32. #include <auth.h>
  33. #include <krb.h>
  34. #include <pwd.h>
  35. #include <stdio.h>
  36. #include <strings.h>
  37.  
  38. char krb_ticket_name[100];
  39.  
  40. void init_krb()
  41. {
  42.   char hostname[100];
  43.  
  44.   if (gethostname(hostname, sizeof(hostname)) < 0) {
  45.     perror("gethostname");
  46.     exit(1);
  47.   }
  48.   if (strchr(hostname, '.'))
  49.     *(strchr(hostname, '.')) = 0;
  50.   
  51.   sprintf(krb_ticket_name, "/var/dss/kerberos/tkt/tkt.%d", getpid());
  52.   krb_set_tkt_string(krb_ticket_name);
  53.  
  54.   config_auth();
  55.  
  56.   if (krb_svc_init("hesiod", hostname, (char *)NULL, 0, (char *)NULL, 
  57.            (char *)NULL) != KSUCCESS) {
  58.     fprintf(stderr, "Couldn't initialize Kerberos\n");
  59.     exit(1);
  60.   }
  61. }
  62.  
  63. void end_krb()
  64. {
  65.   unlink(krb_ticket_name);
  66. }
  67.  
  68. --
  69.  ____________________________________________________________________________
  70.  Gregory Neil Shapiro                                    gshapiro@wpi.wpi.edu
  71.             Academic Systems Integrator, College Computer Center
  72.                        Worcester Polytechnic Institute
  73.  ____________________________________________________________________________
  74.