/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */
/*
*/
/*
*
* Copyright 1995 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.
*
*/
/*
* str_conv.c - Convert between strings and Kerberos internal data.
*/
/*
* Table of contents:
*
* String decoding:
* ----------------
* krb5_string_to_flags() - Convert string to krb5_flags.
*
* String encoding:
* ----------------
* krb5_flags_to_string() - Convert krb5_flags to string.
*/
/*
* WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
*
* Openvision retains the copyright to derivative works of
* this source code. Do *NOT* create a derivative of this
* source code before consulting with your legal department.
* Do *NOT* integrate *ANY* of this source code into another
* product before consulting with your legal department.
*
* For further information, read the top-level Openvision
* copyright which is contained in the top-level MIT Kerberos
* copyright.
*
* WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
*
*/
#include "k5-int.h"
#include "admin_internal.h"
#include "adm_proto.h"
/*
* Local data structures.
*/
struct flags_lookup_entry {
};
/*
* Local strings
*/
/* Keytype strings */
/* Flags strings */
static const char flags_ok_to_auth_as_delegate_out[] = "Protocol transition with delegation allowed";
/*
* Lookup tables.
*/
/* flag sense input specifier output string */
/*----------------------------- ------- ------------------ ------------------*/
{ KRB5_KDB_OK_TO_AUTH_AS_DELEGATE, 1, flags_ok_to_auth_as_delegate_in, flags_ok_to_auth_as_delegate_out },
{ KRB5_KDB_NO_AUTH_DATA_REQUIRED, 1, flags_no_auth_data_required_in, flags_no_auth_data_required_out }
};
sizeof(flags_table[0]);
char * string;
const char * positive;
const char * negative;
krb5_flags * flagsp;
{
int i;
int found;
const char *neg;
int cpos;
int sense;
found = 0;
/* We need to have a way to negate it. */
cpos = 0;
sense = 1;
/* First check for positive or negative sense */
sense = 0;
}
}
for (i=0; i<flags_table_nents; i++) {
found = 1;
else
break;
}
}
}
const char * sep;
char * buffer;
{
int i;
const char *sepstring;
pflags = 0;
/* Blast through the table matching all we can */
for (i=0; i<flags_table_nents; i++) {
if (krb5int_buf_len(&buf) > 0)
/* Keep track of what we matched */
}
}
return(ENOMEM);
/* See if there's any leftovers */
return(EINVAL);
return(0);
}
int flag;
char * buffer;
{
return ENOMEM;
return 0;
}
/*
*
* Salttype may be negative to indicate a search for only a enctype.
*/
{
int i;
foundit = 0;
if (ksaltlist) {
for (i=0; i<nksalts; i++) {
(salttype < 0))) {
foundit = 1;
break;
}
}
}
return(foundit);
}
/*
* krb5_string_to_keysalts() - Convert a string representation to a list
*/
char *string;
const char *tupleseps;
const char *ksaltseps;
{
const char *tseplist;
const char *ksseplist;
const char *septmp;
kret = 0;
while (kp) {
/* Attempt to find a separator */
if (*tseplist) {
}
if (ep) {
*ep = '\0';
ep++;
}
/*
* kp points to something (hopefully) of the form:
* <enctype><ksseplist><salttype>
* or
* <enctype>
*/
/* Attempt to find a separator */
if (sp) {
/* Separate enctype from salttype */
*sp = '\0';
sp++;
}
else /* Solaris Kerberos - default to "normal" salttype */
stype = -1;
/*
* Attempt to parse enctype and salttype. If we parse well
*/
(dups ||
/* Squirrel away old keysalt array */
/* Get new keysalt array */
*ksaltp = (krb5_key_salt_tuple *)
if (*ksaltp) {
/* Copy old keysalt if appropriate */
if (savep) {
len * sizeof(krb5_key_salt_tuple));
}
/* Save our values */
(*nksaltp)++;
}
else {
break;
}
}
/*
* Solaris Kerberos
* just ignore it and continue on. MIT kerberos stops
* searching when if finds an unknown string.
*/
if (sp)
if (ep)
/* Skip over extra separators - like spaces */
/* Increment string - reset separator list */
kp++;
} else {
septmp++;
}
}
}
} /* while kp */
return(kret);
}
/*
* combination.
*
* If ignoresalt set, then salttype is ignored.
*/
{
int i;
kret = 0;
for (i=0; i<nksalt; i++) {
i,
scratch.ks_salttype)) {
if (kret)
break;
}
}
return(kret);
}