*** empty log message ***
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@301 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
		| @@ -6,7 +6,34 @@ krb5_cc_resolve(krb5_context context, | ||||
| 		krb5_ccache *id, | ||||
| 		const char *residual) | ||||
| { | ||||
|   krb5_ccache p; | ||||
|   krb5_fcache *f; | ||||
|  | ||||
|   p = ALLOC(1, krb5_ccache_data); | ||||
|    | ||||
|   if(!p) | ||||
|     return ENOMEM; | ||||
|    | ||||
|   f = ALLOC(1, krb5_fcache); | ||||
|    | ||||
|   if(!f){ | ||||
|     free(p); | ||||
|     return ENOMEM; | ||||
|   } | ||||
|   f->filename = strdup(residual); | ||||
|   if(!f->filename){ | ||||
|     free(f); | ||||
|     free(p); | ||||
|     return ENOMEM; | ||||
|   } | ||||
|    | ||||
|   p->data.data = f; | ||||
|   p->data.length = sizeof(*f); | ||||
|   p->type = 1; | ||||
|  | ||||
|   *id = p; | ||||
|    | ||||
|   return 0; | ||||
| } | ||||
|  | ||||
| krb5_error_code | ||||
| @@ -62,9 +89,9 @@ store_principal(int fd, | ||||
|   int i; | ||||
|   store_int32(fd, p->type); | ||||
|   store_int32(fd, p->ncomp); | ||||
|   store_data(fd, p->realm); | ||||
|   store_data(fd, &p->realm); | ||||
|   for(i = 0; i < p->ncomp; i++) | ||||
|     store_data(fd, p->comp[i]); | ||||
|     store_data(fd, &p->comp[i]); | ||||
|   return 0; | ||||
| } | ||||
|  | ||||
| @@ -80,37 +107,56 @@ krb5_cc_initialize(krb5_context context, | ||||
|  | ||||
|   krb5_fcache *f; | ||||
|  | ||||
|   p = getenv("KRB5CCNAME"); | ||||
|   if(p) | ||||
|     strcpy(cc, p); | ||||
|   else | ||||
|     sprintf(cc, "/tmp/krb5cc_%d", getuid()); | ||||
|   f = (krb5_fcache*)id->data.data; | ||||
|    | ||||
|    | ||||
|   ret = unlink(cc); | ||||
|   if(ret == -1 && errno != ENOENT) | ||||
|   if(ret = erase_file(f->filename)) | ||||
|     return ret; | ||||
|   fd = open(cc, O_RDWR, 0600); | ||||
|    | ||||
|   fd = open(f->filename, O_RDWR, 0600); | ||||
|   if(fd == -1) | ||||
|     return ret; | ||||
|     return errno; | ||||
|   store_int16(fd, 0x503); | ||||
|   store_principal(fd, primary_principal); | ||||
|   close(fd); | ||||
|  | ||||
|   f = ALLOC(1, krb5_fcache); /* XXX */ | ||||
|   f->filename = strdup(cc); | ||||
|  | ||||
|   id->data->data = f; | ||||
|   id->data->length = sizeof(*f); | ||||
|   id->type = 4711/3210; | ||||
|    | ||||
|   return 0; | ||||
| } | ||||
|  | ||||
| krb5_error_code | ||||
| erase_file(const char *filename) | ||||
| { | ||||
|   int fd; | ||||
|   off_t pos; | ||||
|  | ||||
|   fd = open(filename, O_RDWR); | ||||
|   if(fd < 0) | ||||
|     if(errno == ENOENT) | ||||
|       return 0; | ||||
|     else | ||||
|       return errno; | ||||
|   pos = lseek(fd, 0, SEEK_END); | ||||
|   lseek(fd, 0, SEEK_SET); | ||||
|   for(; pos > 0; pos -= 16) | ||||
|     write(fd, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0", 16); | ||||
|   close(fd); | ||||
|   unlink(filename); | ||||
|   return 0; | ||||
| } | ||||
|  | ||||
| krb5_error_code | ||||
| krb5_cc_destroy(krb5_context context, | ||||
| 		krb5_ccache id) | ||||
| { | ||||
|   krb5_fcache *f; | ||||
|   int ret; | ||||
|   f = (krb5_fcache*)id->data.data; | ||||
|  | ||||
|   ret = erase_file(f->filename); | ||||
|    | ||||
|   free(f->filename); | ||||
|   free(f); | ||||
|   free(id); | ||||
|   return ret; | ||||
| } | ||||
|  | ||||
| krb5_error_code | ||||
| @@ -139,7 +185,7 @@ krb5_cc_retrieve(krb5_context context, | ||||
| krb5_error_code | ||||
| krb5_cc_get_princ(krb5_context context, | ||||
| 		  krb5_ccache id, | ||||
| 		  krb5_pricipal *principal) | ||||
| 		  krb5_principal *principal) | ||||
| { | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -28,19 +28,19 @@ typedef struct krb5_config_section{ | ||||
|   struct krb5_config_section *next; | ||||
| }krb5_config_section; | ||||
|  | ||||
| typedef struct krb5_config_file{ | ||||
| typedef struct k5_cfile{ | ||||
|   char *filename; | ||||
|   struct krb5_config_section *sections; | ||||
| }krb5_config_file; | ||||
| }k5_cfile; | ||||
|  | ||||
|  | ||||
|  | ||||
| /* | ||||
| static char *gettoken(FILE *F); | ||||
| static void | ||||
| free_config_file(krb5_config_file *cf); | ||||
| free_config_file(k5_cfile *cf); | ||||
| static krb5_error_code | ||||
| new_config_file(krb5_config_file **cf, const char *filename); | ||||
| new_config_file(k5_cfile **cf, const char *filename); | ||||
| static void | ||||
| free_config_section(krb5_config_section *sec); | ||||
| static krb5_error_code | ||||
| @@ -50,6 +50,6 @@ free_config_relation(krb5_config_relation *rel); | ||||
| static void | ||||
| free_config_value(krb5_config_value val); | ||||
| static krb5_error_code | ||||
| parse_config_file(krb5_config_file **cf, const char *filename); | ||||
| parse_config_file(k5_cfile **cf, const char *filename); | ||||
| */ | ||||
| #endif /* __CONF_H__ */ | ||||
|   | ||||
| @@ -11,7 +11,7 @@ | ||||
| static char section[128]; | ||||
| static FILE *F; | ||||
|  | ||||
| static krb5_config_file *cf; | ||||
| static k5_cfile *cf; | ||||
|  | ||||
| static krb5_config_section *csec; | ||||
|  | ||||
| @@ -152,7 +152,7 @@ static void yyerror(char *s) | ||||
| /*----------------------------------------*/ | ||||
|  | ||||
| static void | ||||
| free_config_file(krb5_config_file *cf) | ||||
| free_config_file(k5_cfile *cf) | ||||
| { | ||||
|   if(!cf) | ||||
|     return; | ||||
| @@ -197,13 +197,13 @@ free_config_section(krb5_config_section *sec) | ||||
|  | ||||
|  | ||||
| void | ||||
| krb5_free_config_file(krb5_config_file *cf) | ||||
| krb5_free_config_file(k5_cfile *cf) | ||||
| { | ||||
|   free_config_file(cf); | ||||
| } | ||||
|  | ||||
| krb5_error_code | ||||
| krb5_get_config_tag(krb5_config_file *cf, const char *tag, char **value) | ||||
| krb5_get_config_tag(k5_cfile *cf, const char *tag, char **value) | ||||
| { | ||||
|   char *str; | ||||
|   char *p; | ||||
| @@ -237,7 +237,7 @@ krb5_get_config_tag(krb5_config_file *cf, const char *tag, char **value) | ||||
| } | ||||
|  | ||||
| krb5_error_code | ||||
| krb5_parse_config_file(krb5_config_file **cfile, const char *filename) | ||||
| krb5_parse_config_file(k5_cfile **cfile, const char *filename) | ||||
| { | ||||
|   krb5_error_code ret; | ||||
|   if(!filename) | ||||
| @@ -245,7 +245,7 @@ krb5_parse_config_file(krb5_config_file **cfile, const char *filename) | ||||
|   F = fopen(filename, "r"); | ||||
|   if(F == NULL) | ||||
|     return errno; | ||||
|   cf = ALLOC(1, krb5_config_file); | ||||
|   cf = ALLOC(1, k5_cfile); | ||||
|   if(!cf) | ||||
| 	return ENOMEM; | ||||
|   ret = yyparse(); | ||||
|   | ||||
| @@ -4,11 +4,11 @@ | ||||
| #include <sys/types.h> | ||||
| #include <stdarg.h> | ||||
|  | ||||
| /* types */ | ||||
| typedef int	int32_t; | ||||
| typedef short 	int16_t; | ||||
| typedef char 	int8_t; | ||||
| #include <sys/bitypes.h> | ||||
|  | ||||
| #include "config_file.h" | ||||
|  | ||||
| /* types */ | ||||
| typedef int32_t	krb5_int32; | ||||
| typedef int16_t	krb5_int16; | ||||
| typedef int8_t	krb5_int8; | ||||
| @@ -63,7 +63,7 @@ typedef enum krb5_preauthtype { | ||||
|  | ||||
|  | ||||
| typedef enum krb5_address_type {  | ||||
|   KRB5_ADDRESS_INET = AF_INET, | ||||
|   KRB5_ADDRESS_INET = 2, | ||||
| } krb5_address_type; | ||||
|  | ||||
| typedef struct krb5_address{ | ||||
| @@ -84,7 +84,7 @@ typedef struct krb5_keyblock{ | ||||
| typedef struct krb5_context_data{ | ||||
|   krb5_enctype *etypes; | ||||
|   char *default_realm; | ||||
|   krb5_config_file *cf; | ||||
|   k5_cfile *cf; | ||||
| } krb5_context_data; | ||||
|  | ||||
| typedef krb5_context_data *krb5_context; | ||||
| @@ -98,6 +98,26 @@ typedef struct krb5_times{ | ||||
|   krb5_time renew_till; | ||||
| } krb5_times; | ||||
|  | ||||
|  | ||||
| enum{ | ||||
|   KRB5_NT_UNKNOWNN	= 0, | ||||
|   KRB5_NT_PRINCIPAL	= 1, | ||||
|   KRB5_NT_SRV_INST	= 2, | ||||
|   KRB5_NT_SRV_HST	= 3, | ||||
|   KRB5_NT_SRV_XHST	= 4, | ||||
|   KRB5_NT_UID		= 5 | ||||
| }; | ||||
| typedef struct krb5_principal_data{ | ||||
|   int type; | ||||
|   krb5_data realm; | ||||
|   krb5_data *comp; | ||||
|   int ncomp; | ||||
| }krb5_principal_data; | ||||
|  | ||||
| typedef krb5_principal_data *krb5_principal; | ||||
| typedef const krb5_principal_data *krb5_const_principal; | ||||
|  | ||||
|  | ||||
| typedef struct krb5_ticket{ | ||||
|   int kvno; | ||||
|   krb5_principal sprinc; | ||||
| @@ -111,25 +131,6 @@ typedef struct krb5_ticket{ | ||||
| #define KRB5_PARSE_MALFORMED 17 | ||||
| #define KRB5_PROG_ETYPE_NOSUPP 4711 | ||||
|  | ||||
| typedef enum k{ | ||||
|   KRB_NT_UNKNOWNN	= 0, | ||||
|   KRB_NT_PRINCIPAL	= 1. | ||||
|   KRB_NT_SRV_INST	= 2, | ||||
|   KRB_NT_SRV_HST	= 3, | ||||
|   KRB_NT_SRV_XHST	= 4, | ||||
|   KRB_NT_UID		= 5 | ||||
| }; | ||||
|  | ||||
| typedef struct krb5_principal_data{ | ||||
|   int type; | ||||
|   krb5_data realm; | ||||
|   krb5_data *comp; | ||||
|   int ncomp; | ||||
| }krb5_principal_data; | ||||
|  | ||||
| typedef krb5_principal_data *krb5_principal; | ||||
| typedef const krb5_principal_data *krb5_const_principal; | ||||
|  | ||||
| typedef struct krb5_creds { | ||||
|   krb5_principal client; | ||||
|   krb5_principal server; | ||||
| @@ -153,13 +154,16 @@ typedef struct krb5_rcache{ | ||||
|   int dummy; | ||||
| }krb5_rcache; | ||||
|  | ||||
| typedef struct krb5_ccache{ | ||||
| typedef struct krb5_ccache_data{ | ||||
|   int type; | ||||
|   krb5_data data; | ||||
| }krb5_ccache; | ||||
| }krb5_ccache_data; | ||||
|  | ||||
| typedef struct krb5_ccache_data *krb5_ccache; | ||||
|  | ||||
| typedef struct krb5_fcache{ | ||||
|   char *filename; | ||||
| }; | ||||
| }krb5_fcache; | ||||
|  | ||||
| typedef struct krb5_cc_cursor{ | ||||
|   int dummy; | ||||
|   | ||||
| @@ -7,6 +7,10 @@ | ||||
| #include <stdio.h> | ||||
| #include <stdlib.h> | ||||
|  | ||||
| #include <fcntl.h> | ||||
|  | ||||
| #include <des.h> | ||||
|  | ||||
| #include "krb5.h" | ||||
|  | ||||
| void 		krb5_data_free(krb5_data *); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Unknown User d91-jda
					Unknown User d91-jda