/*
* COPYRIGHT (C) 2006,2007
* THE REGENTS OF THE UNIVERSITY OF MICHIGAN
* ALL RIGHTS RESERVED
*
* Permission is granted to use, copy, create derivative works
* and redistribute this software and such derivative works
* for any purpose, so long as the name of The University of
* Michigan is not used in any advertising or publicity
* pertaining to the use of distribution of this software
* without specific, written prior authorization. If the
* above copyright notice or any other identification of the
* University of Michigan is included in any copy of any
* portion of this software, then the disclaimer below must
* also be included.
*
* THIS SOFTWARE IS PROVIDED AS IS, WITHOUT REPRESENTATION
* FROM THE UNIVERSITY OF MICHIGAN AS TO ITS FITNESS FOR ANY
* PURPOSE, AND WITHOUT WARRANTY BY THE UNIVERSITY OF
* MICHIGAN OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING
* WITHOUT LIMITATION THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE
* REGENTS OF THE UNIVERSITY OF MICHIGAN SHALL NOT BE LIABLE
* FOR ANY DAMAGES, INCLUDING SPECIAL, INDIRECT, INCIDENTAL, OR
* CONSEQUENTIAL DAMAGES, WITH RESPECT TO ANY CLAIM ARISING
* OUT OF OR IN CONNECTION WITH THE USE OF THE SOFTWARE, EVEN
* IF IT HAS BEEN OR IS HEREAFTER ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGES.
*/
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <string.h>
#include "k5-int.h"
#include "pkinit.h"
/*
* Routines for handling profile [config file] options
*/
/* Forward prototypes */
static int _krb5_conf_boolean(const char *s);
/*
* XXX
* The following is duplicated verbatim from src/lib/krb5/krb/get_in_tkt.c,
* which is duplicated from somewhere else. :-/
* XXX
*/
static const char *const conf_yes[] = {
"y", "yes", "true", "t", "1", "on",
0,
};
static const char *const conf_no[] = {
"n", "no", "false", "nil", "0", "off",
0,
};
static int
_krb5_conf_boolean(const char *s)
{
const char *const *p;
for(p=conf_yes; *p; p++) {
if (strcasecmp(*p,s) == 0)
return 1;
}
for(p=conf_no; *p; p++) {
if (strcasecmp(*p,s) == 0)
return 0;
}
/* Default to "no" */
return 0;
}
/*
* XXX
* End duplicated code from src/lib/krb5/krb/get_in_tkt.c
* XXX
*/
/*
* The following are based on krb5_libdefault_* functions in
* N.B. This assumes that context->default_realm has
* already been established.
*/
{
return KV5M_CONTEXT;
/*
* Try number one:
*
* [realms]
* REALM = {
* option = <value>
* }
*/
names[0] = "realms";
names[3] = 0;
goto goodbye;
}
/*
* Try number two:
*
* [kdcdefaults]
* option = <value>
*/
names[0] = "kdcdefaults";
names[2] = 0;
goto goodbye;
return retval;
}
{
if (retval)
return retval;
} else {
/* Solaris Kerberos */
}
else /* Solaris Kerberos */
}
return retval;
}
{
if (retval == 0) {
} else
return 0;
}
{
if (retval == 0) {
char *endptr;
long l;
else
*ret_value = l;
} else
return 0;
}
/*
* krb5_libdefault_string() is defined as static in
* src/lib/krb5/krb/get_in_tkt.c. Create local versions of
* krb5_libdefault_* functions here. We need a libdefaults_strings()
* function which is not currently supported there anyway. Also,
* add the ability to supply a default value for the boolean and
* integer functions.
*/
{
return EINVAL;
/* Solaris Kerberos */
}
return KV5M_CONTEXT;
/*
* Try number one:
*
* [libdefaults]
* REALM = {
* option = <value>
* }
*/
names[0] = "libdefaults";
names[3] = 0;
goto goodbye;
/*
* Try number two:
*
* [realms]
* REALM = {
* option = <value>
* }
*/
names[0] = "realms";
names[3] = 0;
goto goodbye;
}
/*
* Try number three:
*
* [libdefaults]
* option = <value>
*/
names[0] = "libdefaults";
names[2] = 0;
goto goodbye;
return ENOENT;
return retval;
}
{
if (retval)
return retval;
} else {
else /* Solaris Kerberos */
}
return retval;
}
const char *option, int default_value,
int *ret_value)
{
if (retval == 0) {
} else
return 0;
}
const char *option, int default_value,
int *ret_value)
{
if (retval == 0) {
char *endptr;
long l;
else
*ret_value = l;
}
return retval;
}