(configure): add `--help'. check the number of arguments. handle the
case of there being to speicification of port numbers git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@3416 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
32
kdc/config.c
32
kdc/config.c
@@ -56,7 +56,8 @@ int enable_http = -1;
|
|||||||
char *v4_realm;
|
char *v4_realm;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static int help;
|
static int help_flag;
|
||||||
|
static int version_flag;
|
||||||
|
|
||||||
static struct getargs args[] = {
|
static struct getargs args[] = {
|
||||||
{
|
{
|
||||||
@@ -89,7 +90,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"
|
||||||
},
|
},
|
||||||
{ "help", 'h', arg_flag, &help },
|
{ "help", 'h', arg_flag, &help_flag },
|
||||||
|
{ "version", 'v', arg_flag, &version_flag }
|
||||||
};
|
};
|
||||||
|
|
||||||
static int num_args = sizeof(args) / sizeof(args[0]);
|
static int num_args = sizeof(args) / sizeof(args[0]);
|
||||||
@@ -103,6 +105,13 @@ struct units byte_units[] = {
|
|||||||
{ NULL, 0 }
|
{ NULL, 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static void
|
||||||
|
usage(int ret)
|
||||||
|
{
|
||||||
|
arg_printusage (args, num_args, "");
|
||||||
|
exit (ret);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
configure(int argc, char **argv)
|
configure(int argc, char **argv)
|
||||||
{
|
{
|
||||||
@@ -114,10 +123,17 @@ configure(int argc, char **argv)
|
|||||||
while((e = getarg(args, num_args, argc, argv, &optind)))
|
while((e = getarg(args, num_args, argc, argv, &optind)))
|
||||||
warnx("error at argument `%s'", argv[optind]);
|
warnx("error at argument `%s'", argv[optind]);
|
||||||
|
|
||||||
if(help){
|
if(help_flag)
|
||||||
arg_printusage (args, num_args, "");
|
usage (0);
|
||||||
exit(0);
|
|
||||||
}
|
if (version_flag)
|
||||||
|
krb5_errx(context, 0, "%s", heimdal_version);
|
||||||
|
|
||||||
|
argc -= optind;
|
||||||
|
argv += optind;
|
||||||
|
|
||||||
|
if (argc != 0)
|
||||||
|
usage(1);
|
||||||
|
|
||||||
if(config_file == NULL)
|
if(config_file == NULL)
|
||||||
config_file = HDB_DB_DIR "/kdc.conf";
|
config_file = HDB_DB_DIR "/kdc.conf";
|
||||||
@@ -158,8 +174,6 @@ configure(int argc, char **argv)
|
|||||||
|
|
||||||
if(port_str == NULL){
|
if(port_str == NULL){
|
||||||
p = krb5_config_get_string(cf, "kdc", "ports", NULL);
|
p = krb5_config_get_string(cf, "kdc", "ports", NULL);
|
||||||
if(p == NULL)
|
|
||||||
p = "+";
|
|
||||||
port_str = (char*)p;
|
port_str = (char*)p;
|
||||||
}
|
}
|
||||||
if(enable_http == -1)
|
if(enable_http == -1)
|
||||||
@@ -187,6 +201,8 @@ end:
|
|||||||
max_request = 64 * 1024;
|
max_request = 64 * 1024;
|
||||||
if(require_preauth == -1)
|
if(require_preauth == -1)
|
||||||
require_preauth = 1;
|
require_preauth = 1;
|
||||||
|
if (port_str == NULL)
|
||||||
|
port_str = "+";
|
||||||
#ifdef KRB4
|
#ifdef KRB4
|
||||||
if(v4_realm == NULL){
|
if(v4_realm == NULL){
|
||||||
v4_realm = malloc(40); /* REALM_SZ */
|
v4_realm = malloc(40); /* REALM_SZ */
|
||||||
|
Reference in New Issue
Block a user