/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */
/*
*
* Copyright 1990,1991,2002,2007,2008 by the Massachusetts Institute of Technology.
* All Rights Reserved.
*
* Export of this software from the United States of America may
* require a specific license from the United States Government.
* It is the responsibility of any person or organization contemplating
* export to obtain such a license before exporting.
*
* WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
* distribute this software and its documentation for any purpose and
* without fee is hereby granted, provided that the above copyright
* notice appear in all copies and that both that copyright notice and
* this permission notice appear in supporting documentation, and that
* the name of M.I.T. not be used in advertising or publicity pertaining
* to distribution of the software without specific, written prior
* permission. Furthermore if you modify this software you must label
* your software as modified software and not distribute it in such a
* fashion that it might be confused with the original M.I.T. software.
* M.I.T. makes no representations about the suitability of
* this software for any purpose. It is provided "as is" without express
* or implied warranty.
*/
/*
*/
#include "k5-int.h"
#include <stdio.h>
#ifndef LEAN_CLIENT
/*
* Constants
*/
/*
* Types
*/
typedef struct _krb5_ktsrvtab_data {
/*
* Macros
*/
extern const struct _krb5_kt_ops krb5_kts_ops;
static krb5_error_code KRB5_CALLCONV
static krb5_error_code KRB5_CALLCONV
static krb5_error_code KRB5_CALLCONV
static krb5_error_code KRB5_CALLCONV
static krb5_error_code KRB5_CALLCONV
static krb5_error_code KRB5_CALLCONV
krb5_kt_cursor *);
static krb5_error_code KRB5_CALLCONV
static krb5_error_code
static krb5_error_code
static krb5_error_code
/*
* This is an implementation specific resolver. It returns a keytab id
* initialized with srvtab keytab routines.
*/
static krb5_error_code KRB5_CALLCONV
{
/* Make sure we can open the srvtab file for reading. */
/* Solaris Kerberos */
if (!fp)
return(errno);
return(ENOMEM);
return(ENOMEM);
}
return(ENOMEM);
}
return(0);
}
/*
* "Close" a file-based keytab and invalidate the id. This means
* free memory hidden in the structures.
*/
/*
* This routine is responsible for freeing all memory allocated
* for this keytab. There are no system resources that need
* to be freed nor are there any open files.
*
* This routine should undo anything done by krb5_ktsrvtab_resolve().
*/
{
return (0);
}
/*
* This is the get_entry routine for the file based keytab implementation.
* It opens the keytab file, and either retrieves the entry or returns
* an error.
*/
krb5_ktsrvtab_get_entry(krb5_context context, krb5_keytab id, krb5_const_principal principal, krb5_kvno kvno, krb5_enctype enctype, krb5_keytab_entry *entry)
{
int found_wrong_kvno = 0;
/* Open the srvtab. */
return(kerror);
/* srvtab files only have DES_CBC_CRC keys. */
switch (enctype) {
case ENCTYPE_DES_CBC_CRC:
case ENCTYPE_DES_CBC_MD5:
case ENCTYPE_DES_CBC_MD4:
case ENCTYPE_DES_CBC_RAW:
case IGNORE_ENCTYPE:
break;
default:
return KRB5_KT_NOTFOUND;
}
best_entry.principal = 0;
best_entry.vno = 0;
if (kvno == IGNORE_VNO) {
best_entry = ent;
}
} else {
best_entry = ent;
break;
} else {
found_wrong_kvno = 1;
}
}
} else {
}
}
if (kerror == KRB5_KT_END) {
if (best_entry.principal)
kerror = 0;
else if (found_wrong_kvno)
else
}
if (kerror) {
return kerror;
}
return kerror;
}
*entry = best_entry;
return 0;
}
/*
* Get the name of the file containing a srvtab-based keytab.
*/
/*
* This routine returns the name of the name of the file associated with
* this srvtab-based keytab. The name is prefixed with PREFIX:, so that
* trt will happen if the name is passed back to resolve.
*/
{
int result;
return(KRB5_KT_NAME_TOOLONG);
return(0);
}
/*
* krb5_ktsrvtab_start_seq_get()
*/
{
long *fileoff;
return retval;
return ENOMEM;
}
return 0;
}
/*
* krb5_ktsrvtab_get_next()
*/
krb5_ktsrvtab_get_next(krb5_context context, krb5_keytab id, krb5_keytab_entry *entry, krb5_kt_cursor *cursor)
{
return KRB5_KT_END;
return kerror;
return 0;
}
/*
* krb5_ktsrvtab_end_get()
*/
{
}
/*
* krb5_kts_ops
*/
0,
"SRVTAB", /* Prefix -- this string should not appear anywhere else! */
0,
0,
0
};
/*
* formerly: lib/krb5/keytab/srvtab/kts_util.c
*
* Copyright (c) Hewlett-Packard Company 1991
* Released to the Massachusetts Institute of Technology for inclusion
* in the Kerberos source code distribution.
*
* Copyright 1990,1991 by the Massachusetts Institute of Technology.
* All Rights Reserved.
*
* Export of this software from the United States of America may
* require a specific license from the United States Government.
* It is the responsibility of any person or organization contemplating
* export to obtain such a license before exporting.
*
* WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
* distribute this software and its documentation for any purpose and
* without fee is hereby granted, provided that the above copyright
* notice appear in all copies and that both that copyright notice and
* this permission notice appear in supporting documentation, and that
* the name of M.I.T. not be used in advertising or publicity pertaining
* to distribution of the software without specific, written prior
* permission. Furthermore if you modify this software you must label
* your software as modified software and not distribute it in such a
* fashion that it might be confused with the original M.I.T. software.
* M.I.T. makes no representations about the suitability of
* this software for any purpose. It is provided "as is" without express
* or implied warranty.
*
*
* This function contains utilities for the srvtab based implementation
* of the keytab. There are no public functions in this file.
*/
#include <stdio.h>
#ifdef ANSI_STDIO
/* Solaris Kerberos */
#else
/* Solaris Kerberos */
#endif
/* The maximum sizes for V4 aname, realm, sname, and instance +1 */
/* Taken from krb.h */
static krb5_error_code
{
int c;
return KRB5_KT_END;
*s = c;
s++;
len--;
}
*s = 0;
return 0;
}
{
return errno;
return 0;
}
{
return 0;
return 0;
}
{
int vno;
/* Read in an entry from the srvtab file. */
if (kerror != 0)
return kerror;
if (kerror != 0)
return kerror;
if (kerror != 0)
return kerror;
return KRB5_KT_END;
return KRB5_KT_END;
/* Fill in ret_entry with the data we read. Everything maps well
* except for the timestamp, which we don't have a value for. For
* now we just set it to 0. */
if (kerror != 0)
return kerror;
return ENOMEM;
}
return 0;
}
#endif /* LEAN_CLIENT */