freebsd-dev/eBones/lib/libkrb/get_request.c
Mark Murray d79d4a7ced Major cleanup of eBones code:
- Get all functions prototyped or at least defined before use.
- Make code compile (Mostly) clean with -Wall set
- Start to reduce the degree to which DES aka libdes is built in.
- get all functions to the same uniform standard of definition:
int
foo(a, b)
int a;
int *b;
{
   :
}
- fix numerous bugs exposed by above processes.

Note - this replaces the previous work which used an unpopular function
 definition style.
1995-09-07 21:39:00 +00:00

56 lines
1.5 KiB
C

/*
* Copyright 1985, 1986, 1987, 1988 by the Massachusetts Institute
* of Technology.
* For copying and distribution information, please see the file
* <Copyright.MIT>.
*
* from: get_request.c,v 4.7 88/12/01 14:00:11 jtkohl Exp $
* $Id: get_request.c,v 1.3 1995/07/18 16:38:39 mark Exp $
*/
#if 0
#ifndef lint
static char *rcsid =
"$Id: get_request.c,v 1.3 1995/07/18 16:38:39 mark Exp $";
#endif /* lint */
#endif
#include <krb.h>
#include <prot.h>
/*
* This procedure is obsolete. It is used in the kerberos_slave
* code for Version 3 tickets.
*
* This procedure sets s_name, and instance to point to
* the corresponding fields from tne nth request in the packet.
* it returns the lifetime requested. Garbage will be returned
* if there are less than n requests in the packet.
*/
int
get_request(pkt, n, s_name, instance)
KTEXT pkt; /* The packet itself */
int n; /* Which request do we want */
char **s_name; /* Service name to be filled in */
char **instance; /* Instance name to be filled in */
{
/* Go to the beginning of the request list */
char *ptr = (char *) pkt_a_realm(pkt) + 6 +
strlen((char *)pkt_a_realm(pkt));
/* Read requests until we hit the right one */
while (n-- > 1) {
ptr++;
ptr += 1 + strlen(ptr);
ptr += 1 + strlen(ptr);
}
/* Set the arguments to point to the right place */
*s_name = 1 + ptr;
*instance = 2 + ptr + strlen(*s_name);
/* Return the requested lifetime */
return((int) *ptr);
}