home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / bsd_srcs / kerberosIV / krb / get_request.c < prev    next >
Encoding:
C/C++ Source or Header  |  1990-06-25  |  1.5 KB  |  56 lines

  1. /*
  2.  * $Source: /usr/src/kerberosIV/krb/RCS/get_request.c,v $
  3.  * $Author: kfall $
  4.  *
  5.  * Copyright 1985, 1986, 1987, 1988 by the Massachusetts Institute
  6.  * of Technology.
  7.  *
  8.  * For copying and distribution information, please see the file
  9.  * <mit-copyright.h>.
  10.  */
  11.  
  12. #ifndef lint
  13. static char *rcsid_get_request_c =
  14. "$Header: /usr/src/kerberosIV/krb/RCS/get_request.c,v 4.8 90/06/25 20:56:06 kfall Exp $";
  15. #endif /* lint */
  16.  
  17. #include <mit-copyright.h>
  18. #include <des.h>
  19. #include <krb.h>
  20. #include <prot.h>
  21.  
  22. /*
  23.  * This procedure is obsolete.  It is used in the kerberos_slave
  24.  * code for Version 3 tickets.
  25.  *
  26.  * This procedure sets s_name, and instance to point to
  27.  * the corresponding fields from tne nth request in the packet.
  28.  * it returns the lifetime requested.  Garbage will be returned
  29.  * if there are less than n requests in the packet.
  30.  */
  31.  
  32. get_request(pkt, n, s_name, instance)
  33.     KTEXT pkt;            /* The packet itself */
  34.     int n;            /* Which request do we want */
  35.     char **s_name;        /* Service name to be filled in */
  36.     char **instance;        /* Instance name to be filled in */
  37. {
  38.     /* Go to the beginning of the request list */
  39.     char *ptr = (char *) pkt_a_realm(pkt) + 6 +
  40.     strlen((char *)pkt_a_realm(pkt));
  41.  
  42.     /* Read requests until we hit the right one */
  43.     while (n-- > 1) {
  44.         ptr++;
  45.         ptr += 1 + strlen(ptr);
  46.         ptr += 1 + strlen(ptr);
  47.     }
  48.  
  49.     /* Set the arguments to point to the right place */
  50.     *s_name = 1 + ptr;
  51.     *instance = 2 + ptr + strlen(*s_name);
  52.  
  53.     /* Return the requested lifetime */
  54.     return((int) *ptr);
  55. }
  56.