if stdin is not a socket create and listen to sockets
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@8643 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1997, 1998, 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.
|
||||||
*
|
*
|
||||||
@@ -41,7 +41,7 @@ static char *keytab_str = "HDB:";
|
|||||||
static int help_flag;
|
static int help_flag;
|
||||||
static int version_flag;
|
static int version_flag;
|
||||||
static int debug_flag;
|
static int debug_flag;
|
||||||
static int debug_port;
|
static char *port_str;
|
||||||
char *realm;
|
char *realm;
|
||||||
|
|
||||||
static struct getargs args[] = {
|
static struct getargs args[] = {
|
||||||
@@ -63,8 +63,8 @@ static struct getargs args[] = {
|
|||||||
{ "debug", 'd', arg_flag, &debug_flag,
|
{ "debug", 'd', arg_flag, &debug_flag,
|
||||||
"enable debugging"
|
"enable debugging"
|
||||||
},
|
},
|
||||||
{ "debug-port", 'p', arg_integer,&debug_port,
|
{ "ports", 'p', arg_integer,&port_str,
|
||||||
"port to use with debug", "port" },
|
"ports to listen to", "port" },
|
||||||
{ "help", 'h', arg_flag, &help_flag },
|
{ "help", 'h', arg_flag, &help_flag },
|
||||||
{ "version", 'v', arg_flag, &version_flag }
|
{ "version", 'v', arg_flag, &version_flag }
|
||||||
};
|
};
|
||||||
@@ -134,14 +134,22 @@ main(int argc, char **argv)
|
|||||||
|
|
||||||
{
|
{
|
||||||
int fd = 0;
|
int fd = 0;
|
||||||
|
struct sockaddr sa;
|
||||||
|
size_t sa_len;
|
||||||
krb5_auth_context ac = NULL;
|
krb5_auth_context ac = NULL;
|
||||||
if(debug_flag){
|
int debug_port;
|
||||||
if(debug_port == 0)
|
sa_len = sizeof(sa);
|
||||||
|
if(debug_flag) {
|
||||||
|
if(port_str == NULL)
|
||||||
debug_port = krb5_getportbyname (context, "kerberos-adm",
|
debug_port = krb5_getportbyname (context, "kerberos-adm",
|
||||||
"tcp", 749);
|
"tcp", 749);
|
||||||
else
|
else
|
||||||
debug_port = htons(debug_port);
|
debug_port = htons(atoi(port_str));
|
||||||
mini_inetd(debug_port);
|
mini_inetd(debug_port);
|
||||||
|
} else if(getsockname(STDIN_FILENO, &sa, &sa_len) < 0 &&
|
||||||
|
errno == ENOTSOCK) {
|
||||||
|
parse_ports(context, port_str ? port_str : "+");
|
||||||
|
start_server(context);
|
||||||
}
|
}
|
||||||
if(realm)
|
if(realm)
|
||||||
krb5_set_default_realm(context, realm); /* XXX */
|
krb5_set_default_realm(context, realm); /* XXX */
|
||||||
|
Reference in New Issue
Block a user