git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@864 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Johan Danielsson
1996-10-20 16:47:54 +00:00
parent 309846037c
commit dbdb412ba0
25 changed files with 595 additions and 479 deletions

48
Makefile Normal file
View File

@@ -0,0 +1,48 @@
# Generated automatically from Makefile.in by configure.
CC = cc -std1
CFLAGS = -g
#YACC=bison -y
YACC = yacc
SOURCES = cache.c principal.c principal_p.c data.c context.c misc.c \
krbhst.c get_port.c send_to_kdc.c der.c e.c d.c str2key.c \
get_in_tkt.c get_in_tkt_pw.c der_put.c constants.c get_addrs.c \
k5_der.c
OBJECTS = $(SOURCES:%.c=%.o) config_file.o
all: kinit klist
%.o: %.c
$(CC) -c $(CFLAGS) -I. -I/usr/athena/include $< -o $@
kinit: kinit.o libkrb5.a
$(CC) -o kinit kinit.o libkrb5.a -L/usr/athena/lib -ldes
klist: klist.o libkrb5.a
$(CC) -o klist klist.o libkrb5.a -L/usr/athena/lib -ldes
tt: test.o libkrb5.a
$(CC) -o tt test.o libkrb5.a
test.o: krb5.h
libkrb5.a: $(OBJECTS)
ar cr libkrb5.a $(OBJECTS)
ranlib libkrb5.a
config_file.o: config_file.c
config_file.c: config_file.y
$(YACC) -p __k5cf_ $<
mv -f y.tab.c config_file.c
clean:
rm -f *.o *~ libkrb5.a tt core \#* config_file.c
$(OBJECTS): krb5_locl.h krb5.h

View File

@@ -9,7 +9,9 @@ CC = @CC@
DEFS = @DEFS@
YACC = @YACC@
CFLAGS = -g -I$(srcdir) -Iasn1 -I.
CFLAGS = -g -I$(srcdir) -Iasn1 -I. -I/usr/athena/include
LIBS = -L/usr/athena/lib -ldes
SOURCES = cache.c principal.c principal_p.c data.c context.c misc.c \
krbhst.c get_port.c send_to_kdc.c str2key.c \
@@ -21,10 +23,10 @@ OBJECTS = $(SOURCES:%.c=%.o) config_file.o
all: kinit klist
kinit: kinit.o libkrb5.a
$(CC) -o kinit kinit.o libkrb5.a -Lasn1 -lasn1 -L/usr/local/lib -ldes
$(CC) -o kinit kinit.o libkrb5.a -Lasn1 -lasn1 $(LIBS)
klist: klist.o libkrb5.a
$(CC) -o klist klist.o libkrb5.a -L/usr/local/lib -ldes
$(CC) -o klist klist.o libkrb5.a $(LIBS)
tt: test.o libkrb5.a
$(CC) -o tt test.o libkrb5.a

View File

@@ -3,6 +3,7 @@
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include "der.h"

View File

@@ -3,6 +3,7 @@
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include "der.h"

View File

@@ -19,6 +19,7 @@ init_generate (char *filename)
fprintf (codefile,
"/* Generated from %s */\n"
"/* Do not edit */\n\n"
"#include <stdio.h>\n"
"#include <stdlib.h>\n"
"#include <time.h>\n"
"#include <der.h>\n"
@@ -222,7 +223,7 @@ encode_type (char *name, Type *t)
break;
for (m = t->members->prev; m && tag != m->val; m = m->prev) {
char *s = malloc(1 + strlen(name) + 1 + strlen(m->gen_name) + 3);
char *s = malloc(2 + strlen(name) + 1 + strlen(m->gen_name) + 3);
sprintf (s, "%s(%s)->%s", m->optional ? "" : "&", name, m->gen_name);
if (m->optional)
@@ -424,7 +425,7 @@ decode_type (char *name, Type *t)
"len = reallen;\n");
for (m = t->members; m && tag != m->val; m = m->next) {
char *s = malloc(1 + strlen(name) + 1 + strlen(m->gen_name) + 3);
char *s = malloc(2 + strlen(name) + 1 + strlen(m->gen_name) + 3);
sprintf (s, "%s(%s)->%s", m->optional ? "" : "&", name, m->gen_name);
fprintf (codefile, "{\n"

View File

@@ -10,10 +10,15 @@
#include "symbol.h"
#include "parse.h"
char *strdup(char *);
void error_message(char *, ...);
static unsigned lineno = 1;
static char filename[256];
%}
%%
INTEGER { return INTEGER; }
SEQUENCE { return SEQUENCE; }
@@ -28,21 +33,23 @@ OPTIONAL { return OPTIONAL; }
BEGIN { return TBEGIN; }
END { return END; }
DEFINITIONS { return DEFINITIONS; }
[][|{},()] { return *yytext; }
,|\{|\}|\(|\)|\[|\]|\| { return *yytext; }
::= { return EEQUAL; }
--[^\n]*\n { ; }
-?[0-9]+ { yylval.constant = atoi(yytext); return CONSTANT; }
[A-Za-z][-A-Za-z0-9_]* { yylval.name = strdup (yytext); return IDENTIFIER; }
[ \t] ;
\n { lineno++; }
. { fprintf(stderr, "Ignoring char(%c)\n", *yytext); }
. { error_message("Ignoring char(%c)\n", *yytext); }
%%
#ifndef yywrap /* XXX */
int
yywrap ()
{
return 1;
}
#endif
void
error_message (char *format, ...)

View File

@@ -12,6 +12,8 @@
static Type *new_type (Typetype t);
void yyerror (char *);
char *strdup(char *);
%}
%union {
@@ -167,6 +169,7 @@ new_type (Typetype tt)
t->members = NULL;
t->subtype = NULL;
t->symbol = NULL;
return t;
}
static void

20
cache.c
View File

@@ -442,16 +442,16 @@ krb5_cc_read_cred (int fd,
int8_t dummy8;
int32_t dummy32;
return ret_principal (fd, &creds->client)
|| ret_principal (fd, &creds->server)
|| ret_keyblock (fd, &creds->session)
|| ret_times (fd, &creds->times)
|| ret_int8 (fd, &dummy8)
|| ret_int32 (fd, &dummy32)
|| ret_addrs (fd, &creds->addresses)
|| ret_authdata (fd, &creds->authdata)
|| ret_ticket (fd, &creds->ticket)
|| ret_ticket (fd, &creds->second_ticket);
return ret_principal (fd, &creds->client) ||
ret_principal (fd, &creds->server) ||
ret_keyblock (fd, &creds->session) ||
ret_times (fd, &creds->times) ||
ret_int8 (fd, &dummy8) ||
ret_int32 (fd, &dummy32) ||
ret_addrs (fd, &creds->addresses) ||
ret_authdata (fd, &creds->authdata) ||
ret_ticket (fd, &creds->ticket) ||
ret_ticket (fd, &creds->second_ticket);
}
krb5_error_code

View File

@@ -1,5 +1,11 @@
#include "krb5_locl.h"
/* XXX */
#ifdef sun
#define memmove(a,b,c) bcopy(b,a,c)
#endif
krb5_error_code
krb5_init_context(krb5_context *context)
{

5
data.c
View File

@@ -1,5 +1,10 @@
#include "krb5_locl.h"
/* XXX */
#ifdef sun
#define memmove(a,b,c) bcopy(b,a,c)
#endif
void
krb5_data_free(krb5_data *p)

22
krb5.h
View File

@@ -22,17 +22,17 @@
#endif
/* types */
typedef int32_t krb5_int32;
typedef int16_t krb5_int16;
typedef int8_t krb5_int8;
typedef int int32_t;
typedef short int16_t;
typedef char int8_t;
typedef unsigned int krb5_uint32;
typedef unsigned short krb5_uint16;
typedef unsigned char krb5_uint8;
typedef unsigned int u_int32_t;
typedef unsigned short u_int16_t;
typedef unsigned char u_int8_t;
typedef int krb5_boolean;
typedef krb5_int32 krb5_error_code;
typedef int32_t krb5_error_code;
@@ -196,7 +196,7 @@ typedef struct krb5_keytab{
typedef struct krb5_auth_context{
krb5_int32 flags;
int32_t flags;
krb5_cksumtype cksumtype;
krb5_address local_address;
@@ -205,8 +205,8 @@ typedef struct krb5_auth_context{
krb5_keyblock local_subkey;
krb5_keyblock remote_subkey;
krb5_int32 local_seqnumber;
krb5_int32 remote_seqnumber;
int32_t local_seqnumber;
int32_t remote_seqnumber;
krb5_authenticator authenticator;
@@ -217,7 +217,7 @@ typedef struct krb5_auth_context{
}krb5_auth_context;
typedef krb5_uint32 krb5_flags;
typedef u_int32_t krb5_flags;
#include <foo.h>

View File

@@ -3,6 +3,7 @@
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include "der.h"

View File

@@ -3,6 +3,7 @@
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include "der.h"

View File

@@ -19,6 +19,7 @@ init_generate (char *filename)
fprintf (codefile,
"/* Generated from %s */\n"
"/* Do not edit */\n\n"
"#include <stdio.h>\n"
"#include <stdlib.h>\n"
"#include <time.h>\n"
"#include <der.h>\n"
@@ -222,7 +223,7 @@ encode_type (char *name, Type *t)
break;
for (m = t->members->prev; m && tag != m->val; m = m->prev) {
char *s = malloc(1 + strlen(name) + 1 + strlen(m->gen_name) + 3);
char *s = malloc(2 + strlen(name) + 1 + strlen(m->gen_name) + 3);
sprintf (s, "%s(%s)->%s", m->optional ? "" : "&", name, m->gen_name);
if (m->optional)
@@ -424,7 +425,7 @@ decode_type (char *name, Type *t)
"len = reallen;\n");
for (m = t->members; m && tag != m->val; m = m->next) {
char *s = malloc(1 + strlen(name) + 1 + strlen(m->gen_name) + 3);
char *s = malloc(2 + strlen(name) + 1 + strlen(m->gen_name) + 3);
sprintf (s, "%s(%s)->%s", m->optional ? "" : "&", name, m->gen_name);
fprintf (codefile, "{\n"

View File

@@ -10,10 +10,15 @@
#include "symbol.h"
#include "parse.h"
char *strdup(char *);
void error_message(char *, ...);
static unsigned lineno = 1;
static char filename[256];
%}
%%
INTEGER { return INTEGER; }
SEQUENCE { return SEQUENCE; }
@@ -28,21 +33,23 @@ OPTIONAL { return OPTIONAL; }
BEGIN { return TBEGIN; }
END { return END; }
DEFINITIONS { return DEFINITIONS; }
[][|{},()] { return *yytext; }
,|\{|\}|\(|\)|\[|\]|\| { return *yytext; }
::= { return EEQUAL; }
--[^\n]*\n { ; }
-?[0-9]+ { yylval.constant = atoi(yytext); return CONSTANT; }
[A-Za-z][-A-Za-z0-9_]* { yylval.name = strdup (yytext); return IDENTIFIER; }
[ \t] ;
\n { lineno++; }
. { fprintf(stderr, "Ignoring char(%c)\n", *yytext); }
. { error_message("Ignoring char(%c)\n", *yytext); }
%%
#ifndef yywrap /* XXX */
int
yywrap ()
{
return 1;
}
#endif
void
error_message (char *format, ...)

View File

@@ -12,6 +12,8 @@
static Type *new_type (Typetype t);
void yyerror (char *);
char *strdup(char *);
%}
%union {
@@ -167,6 +169,7 @@ new_type (Typetype tt)
t->members = NULL;
t->subtype = NULL;
t->symbol = NULL;
return t;
}
static void

View File

@@ -442,16 +442,16 @@ krb5_cc_read_cred (int fd,
int8_t dummy8;
int32_t dummy32;
return ret_principal (fd, &creds->client)
|| ret_principal (fd, &creds->server)
|| ret_keyblock (fd, &creds->session)
|| ret_times (fd, &creds->times)
|| ret_int8 (fd, &dummy8)
|| ret_int32 (fd, &dummy32)
|| ret_addrs (fd, &creds->addresses)
|| ret_authdata (fd, &creds->authdata)
|| ret_ticket (fd, &creds->ticket)
|| ret_ticket (fd, &creds->second_ticket);
return ret_principal (fd, &creds->client) ||
ret_principal (fd, &creds->server) ||
ret_keyblock (fd, &creds->session) ||
ret_times (fd, &creds->times) ||
ret_int8 (fd, &dummy8) ||
ret_int32 (fd, &dummy32) ||
ret_addrs (fd, &creds->addresses) ||
ret_authdata (fd, &creds->authdata) ||
ret_ticket (fd, &creds->ticket) ||
ret_ticket (fd, &creds->second_ticket);
}
krb5_error_code

View File

@@ -1,5 +1,11 @@
#include "krb5_locl.h"
/* XXX */
#ifdef sun
#define memmove(a,b,c) bcopy(b,a,c)
#endif
krb5_error_code
krb5_init_context(krb5_context *context)
{

View File

@@ -1,5 +1,10 @@
#include "krb5_locl.h"
/* XXX */
#ifdef sun
#define memmove(a,b,c) bcopy(b,a,c)
#endif
void
krb5_data_free(krb5_data *p)

View File

@@ -22,17 +22,17 @@
#endif
/* types */
typedef int32_t krb5_int32;
typedef int16_t krb5_int16;
typedef int8_t krb5_int8;
typedef int int32_t;
typedef short int16_t;
typedef char int8_t;
typedef unsigned int krb5_uint32;
typedef unsigned short krb5_uint16;
typedef unsigned char krb5_uint8;
typedef unsigned int u_int32_t;
typedef unsigned short u_int16_t;
typedef unsigned char u_int8_t;
typedef int krb5_boolean;
typedef krb5_int32 krb5_error_code;
typedef int32_t krb5_error_code;
@@ -196,7 +196,7 @@ typedef struct krb5_keytab{
typedef struct krb5_auth_context{
krb5_int32 flags;
int32_t flags;
krb5_cksumtype cksumtype;
krb5_address local_address;
@@ -205,8 +205,8 @@ typedef struct krb5_auth_context{
krb5_keyblock local_subkey;
krb5_keyblock remote_subkey;
krb5_int32 local_seqnumber;
krb5_int32 remote_seqnumber;
int32_t local_seqnumber;
int32_t remote_seqnumber;
krb5_authenticator authenticator;
@@ -217,7 +217,7 @@ typedef struct krb5_auth_context{
}krb5_auth_context;
typedef krb5_uint32 krb5_flags;
typedef u_int32_t krb5_flags;
#include <foo.h>

View File

@@ -2,6 +2,12 @@
RCSID("$Id$");
/* XXX */
#ifdef sun
#define memmove(a,b,c) bcopy(b,a,c)
#endif
/* Public principal handling functions */
void

View File

@@ -10,7 +10,7 @@ send_and_recv (int fd,
struct fd_set fdset;
struct timeval timeout;
int ret;
long nbytes;
int nbytes;
if (sendto (fd, send->data, send->length, 0,
(struct sockaddr *)addr, sizeof(*addr)) < 0)

View File

@@ -2,6 +2,12 @@
RCSID("$Id$");
/* XXX */
#ifdef sun
#define memmove(a,b,c) bcopy(b,a,c)
#endif
/* Public principal handling functions */
void

View File

@@ -10,7 +10,7 @@ send_and_recv (int fd,
struct fd_set fdset;
struct timeval timeout;
int ret;
long nbytes;
int nbytes;
if (sendto (fd, send->data, send->length, 0,
(struct sockaddr *)addr, sizeof(*addr)) < 0)

View File

@@ -1,5 +1,11 @@
#include "krb5_locl.h"
/* XXX */
#ifdef sun
#define memmove(a,b,c) bcopy(b,a,c)
#endif
static void reverse(unsigned char *p)
{
unsigned char tmp[8];