~ubuntu-branches/ubuntu/maverick/krb5/maverick

« back to all changes in this revision

Viewing changes to src/lib/krb4/getst.c

  • Committer: Bazaar Package Importer
  • Author(s): Sam Hartman
  • Date: 2009-05-07 16:16:34 UTC
  • mfrom: (13.1.7 sid)
  • Revision ID: james.westby@ubuntu.com-20090507161634-xqyk0s9na0le4flj
Tags: 1.7dfsg~beta1-4
When  decrypting the TGS response fails with the subkey, try with the
session key to work around Heimdal bug, Closes: #527353 

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * getst.c
3
 
 *
4
 
 * Copyright 1987, 1988 by the Massachusetts Institute of Technology.
5
 
 *
6
 
 * For copying and distribution information, please see the file
7
 
 * <mit-copyright.h>.
8
 
 */
9
 
 
10
 
#include "mit-copyright.h"
11
 
#include "krb.h"
12
 
#include "krb4int.h"
13
 
#include "autoconf.h"
14
 
#ifdef HAVE_UNISTD_H
15
 
#include <unistd.h>
16
 
#endif
17
 
 
18
 
/*
19
 
 * getst() takes a file descriptor, a string and a count.  It reads
20
 
 * from the file until either it has read "count" characters, or until
21
 
 * it reads a null byte.  When finished, what has been read exists in
22
 
 * the given string "s".  If "count" characters were actually read, the
23
 
 * last is changed to a null, so the returned string is always null-
24
 
 * terminated.  getst() returns the number of characters read, including
25
 
 * the null terminator.
26
 
 */
27
 
 
28
 
int
29
 
getst(fd, s, n)
30
 
    int fd;
31
 
    register char *s;
32
 
    int n;
33
 
{
34
 
    register int count = n;
35
 
    while (read(fd, s, 1) > 0 && --count)
36
 
        if (*s++ == '\0')
37
 
            return (n - count);
38
 
    *s = '\0';
39
 
    return (n - count);
40
 
}