add some comments
remove --key-file add --addresses git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@7905 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
74
kdc/config.c
74
kdc/config.c
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1997-1999 Kungliga Tekniska H<>gskolan
|
* Copyright (c) 1997-2000 Kungliga Tekniska H<>gskolan
|
||||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
@@ -37,22 +37,31 @@
|
|||||||
|
|
||||||
RCSID("$Id$");
|
RCSID("$Id$");
|
||||||
|
|
||||||
static char *config_file;
|
static char *config_file; /* location of kdc config file */
|
||||||
int require_preauth = -1;
|
|
||||||
char *keyfile;
|
int require_preauth = -1; /* 1 == require preauth for all principals */
|
||||||
static char *max_request_str;
|
|
||||||
size_t max_request;
|
size_t max_request; /* maximal size of a request */
|
||||||
time_t kdc_warn_pwexpire;
|
|
||||||
|
static char *max_request_str; /* `max_request' as a string */
|
||||||
|
|
||||||
|
time_t kdc_warn_pwexpire; /* time before expiration to print a warning */
|
||||||
|
|
||||||
struct dbinfo *databases;
|
struct dbinfo *databases;
|
||||||
HDB **db;
|
HDB **db;
|
||||||
int num_db;
|
int num_db;
|
||||||
|
|
||||||
char *port_str;
|
char *port_str;
|
||||||
|
|
||||||
int enable_http = -1;
|
int enable_http = -1;
|
||||||
krb5_boolean encode_as_rep_as_tgs_rep; /* bug compatibility */
|
krb5_boolean encode_as_rep_as_tgs_rep; /* bug compatibility */
|
||||||
|
|
||||||
krb5_boolean check_ticket_addresses;
|
krb5_boolean check_ticket_addresses;
|
||||||
krb5_boolean allow_null_ticket_addresses;
|
krb5_boolean allow_null_ticket_addresses;
|
||||||
|
|
||||||
|
struct getarg_strings addresses_str; /* addresses to listen on */
|
||||||
|
krb5_addresses explicit_addresses;
|
||||||
|
|
||||||
#ifdef KRB4
|
#ifdef KRB4
|
||||||
char *v4_realm;
|
char *v4_realm;
|
||||||
#endif
|
#endif
|
||||||
@@ -72,10 +81,6 @@ static struct getargs args[] = {
|
|||||||
"require-preauth", 'p', arg_negative_flag, &require_preauth,
|
"require-preauth", 'p', arg_negative_flag, &require_preauth,
|
||||||
"don't require pa-data in as-reqs"
|
"don't require pa-data in as-reqs"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"key-file", 'k', arg_string, &keyfile,
|
|
||||||
"location of master key file", "file"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"max-request", 0, arg_string, &max_request,
|
"max-request", 0, arg_string, &max_request,
|
||||||
"max size for a kdc-request", "size"
|
"max size for a kdc-request", "size"
|
||||||
@@ -102,6 +107,8 @@ static struct getargs args[] = {
|
|||||||
{ "ports", 'P', arg_string, &port_str,
|
{ "ports", 'P', arg_string, &port_str,
|
||||||
"ports to listen to"
|
"ports to listen to"
|
||||||
},
|
},
|
||||||
|
{ "addresses", 0, arg_strings, &addresses_str,
|
||||||
|
"addresses to listen on", "list of addresses" },
|
||||||
{ "help", 'h', arg_flag, &help_flag },
|
{ "help", 'h', arg_flag, &help_flag },
|
||||||
{ "version", 'v', arg_flag, &version_flag }
|
{ "version", 'v', arg_flag, &version_flag }
|
||||||
};
|
};
|
||||||
@@ -190,6 +197,22 @@ get_dbinfo(krb5_config_section *cf)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
add_one_address (const char *str, int first)
|
||||||
|
{
|
||||||
|
krb5_error_code ret;
|
||||||
|
krb5_addresses tmp;
|
||||||
|
|
||||||
|
ret = krb5_parse_address (context, str, &tmp);
|
||||||
|
if (ret)
|
||||||
|
krb5_err (context, 1, ret, "parse_address `%s'", str);
|
||||||
|
if (first)
|
||||||
|
krb5_copy_addresses(context, &tmp, &explicit_addresses);
|
||||||
|
else
|
||||||
|
krb5_append_addresses(context, &explicit_addresses, &tmp);
|
||||||
|
krb5_free_addresses (context, &tmp);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
configure(int argc, char **argv)
|
configure(int argc, char **argv)
|
||||||
{
|
{
|
||||||
@@ -221,16 +244,6 @@ configure(int argc, char **argv)
|
|||||||
if(krb5_config_parse_file(config_file, &cf))
|
if(krb5_config_parse_file(config_file, &cf))
|
||||||
cf = NULL;
|
cf = NULL;
|
||||||
|
|
||||||
if(keyfile == NULL){
|
|
||||||
p = krb5_config_get_string (context, cf,
|
|
||||||
"kdc",
|
|
||||||
"key-file",
|
|
||||||
NULL);
|
|
||||||
if(p)
|
|
||||||
keyfile = strdup(p);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
get_dbinfo(cf);
|
get_dbinfo(cf);
|
||||||
|
|
||||||
if(max_request_str){
|
if(max_request_str){
|
||||||
@@ -256,6 +269,25 @@ configure(int argc, char **argv)
|
|||||||
if (p != NULL)
|
if (p != NULL)
|
||||||
port_str = strdup(p);
|
port_str = strdup(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
explicit_addresses.len = 0;
|
||||||
|
|
||||||
|
if (addresses_str.num_strings) {
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; i < addresses_str.num_strings; ++i)
|
||||||
|
add_one_address (addresses_str.strings[i], i == 0);
|
||||||
|
} else {
|
||||||
|
char **foo = krb5_config_get_strings (context, cf,
|
||||||
|
"kdc", "addresses", NULL);
|
||||||
|
|
||||||
|
if (foo != NULL) {
|
||||||
|
add_one_address (*foo++, TRUE);
|
||||||
|
while (*foo)
|
||||||
|
add_one_address (*foo++, FALSE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(enable_http == -1)
|
if(enable_http == -1)
|
||||||
enable_http = krb5_config_get_bool(context, cf, "kdc",
|
enable_http = krb5_config_get_bool(context, cf, "kdc",
|
||||||
"enable-http", NULL);
|
"enable-http", NULL);
|
||||||
|
Reference in New Issue
Block a user