mirror of
https://git.savannah.gnu.org/git/inetutils.git
synced 2026-01-12 00:19:39 +08:00
Fix incomplete Kerberos code.
This commit is contained in:
20
ChangeLog
20
ChangeLog
@@ -1,3 +1,23 @@
|
||||
2012-02-01 Mats Erik Andersson <gnu@gisladisker.se>
|
||||
|
||||
* configure.ac: Check for typedefs `Schedule' and `Session_Key'
|
||||
in <arpa/telnet.h>.
|
||||
* libinetutils/des_rw.c [ENCRYPTION && KERBEROS && !MIN] (MIN):
|
||||
Define missing macro.
|
||||
[ENCRYPTION && KERBEROS && !roundup] (roundup): Likewise.
|
||||
* libinetutils/kcmd.c (kcmd) [HAVE_SIGACTION]: Use modern signal
|
||||
handling. New variables SIGS and OSIGS.
|
||||
* libtelnet/auth.c [AUTHENTICATION] (AUTHTYPE_NAMES): New macro,
|
||||
needed by OpenSolaris to fill in `authtype_names' by <arpa/telnet.h>.
|
||||
* libtelnet/encrypt.h [ENCRYPTION && !HAVE_ARPA_TELNET_H_SCHEDULE]:
|
||||
Typedef for `Schedule' is conditional.
|
||||
[ENCRYPTION && !HAVE_ARPA_TELNET_H_SESSION_KEY]: Typedef for
|
||||
`Session_Key' is conditional.
|
||||
* libtelnet/misc.c: Include <arpa/telnet.h>.
|
||||
* src/rlogind.c [KERBEROS && ENCRYPTION] (ENC_WRITE): Define macro
|
||||
using correct name.
|
||||
* src/rshd.c [!MAX] (MAX): Define missing macro.
|
||||
|
||||
2012-02-01 Mats Erik Andersson <gnu@gisladisker.se>
|
||||
|
||||
Detect and protect header files for Kerberos support.
|
||||
|
||||
10
configure.ac
10
configure.ac
@@ -693,6 +693,16 @@ AC_CHECK_DECLS(telopts, , ,
|
||||
[IU_FLUSHLEFT([#undef TELOPTS
|
||||
#include <arpa/telnet.h>])])
|
||||
|
||||
dnl OpenSolaris provides Schedule and Session_Key.
|
||||
AC_CHECK_TYPE(Schedule,
|
||||
AC_DEFINE([HAVE_ARPA_TELNET_H_SCHEDULE], 1,
|
||||
[Define to one if <arpa/telnet.h> defines a type Schedule.]), ,
|
||||
[#include <arpa/telnet.h>])
|
||||
AC_CHECK_TYPE(Session_Key,
|
||||
AC_DEFINE([HAVE_ARPA_TELNET_H_SESSION_KEY], 1,
|
||||
[Define to 1 if <arpa/telnet.h> defines a type Session_Key.]), ,
|
||||
[#include <arpa/telnet.h>])
|
||||
|
||||
## Checks for function declarations.
|
||||
|
||||
AC_DECL_SYS_SIGLIST
|
||||
|
||||
@@ -65,6 +65,13 @@
|
||||
# include <time.h>
|
||||
# include <unistd.h>
|
||||
|
||||
# ifndef MIN
|
||||
# define MIN(a,b) (((a)<(b))? (a):(b))
|
||||
# endif
|
||||
# ifndef roundup
|
||||
# define roundup(x, y) ((((x)+((y)-1))/(y))*(y))
|
||||
# endif
|
||||
|
||||
static unsigned char des_inbuf[10240], storage[10240], *store_ptr;
|
||||
static bit_64 *key;
|
||||
static unsigned char *key_schedule;
|
||||
|
||||
@@ -106,7 +106,11 @@ kcmd (Shishi ** h, int *sock, char **ahost, unsigned short rport, char *locuser,
|
||||
# endif
|
||||
{
|
||||
int s, timo = 1, pid;
|
||||
# ifdef HAVE_SIGACTION
|
||||
sigset_t sigs, osigs;
|
||||
# else
|
||||
long oldmask;
|
||||
# endif /* !HAVE_SIGACTION */
|
||||
struct sockaddr_in sin, from;
|
||||
char c;
|
||||
|
||||
@@ -142,7 +146,13 @@ kcmd (Shishi ** h, int *sock, char **ahost, unsigned short rport, char *locuser,
|
||||
realm = krb_realmofhost (host_save);
|
||||
# endif /* KERBEROS */
|
||||
|
||||
# ifdef HAVE_SIGACTION
|
||||
sigemptyset (&sigs);
|
||||
sigaddset (&sigs, SIGURG);
|
||||
sigprocmask (SIG_BLOCK, &sigs, &osigs);
|
||||
# else
|
||||
oldmask = sigblock (sigmask (SIGURG));
|
||||
# endif /* !HAVE_SIGACTION */
|
||||
for (;;)
|
||||
{
|
||||
s = getport (&lport);
|
||||
@@ -152,7 +162,11 @@ kcmd (Shishi ** h, int *sock, char **ahost, unsigned short rport, char *locuser,
|
||||
fprintf (stderr, "kcmd(socket): All ports in use\n");
|
||||
else
|
||||
perror ("kcmd: socket");
|
||||
# if HAVE_SIGACTION
|
||||
sigprocmask (SIG_SETMASK, &osigs, NULL);
|
||||
# else
|
||||
sigsetmask (oldmask);
|
||||
# endif /* !HAVE_SIGACTION */
|
||||
return (-1);
|
||||
}
|
||||
fcntl (s, F_SETOWN, pid);
|
||||
@@ -195,7 +209,12 @@ kcmd (Shishi ** h, int *sock, char **ahost, unsigned short rport, char *locuser,
|
||||
# endif /* !(defined(ultrix) || defined(sun)) */
|
||||
if (errno != ECONNREFUSED)
|
||||
perror (hp->h_name);
|
||||
|
||||
# if HAVE_SIGACTION
|
||||
sigprocmask (SIG_SETMASK, &osigs, NULL);
|
||||
# else
|
||||
sigsetmask (oldmask);
|
||||
# endif /* !HAVE_SIGACTION */
|
||||
|
||||
return (-1);
|
||||
}
|
||||
@@ -326,7 +345,11 @@ kcmd (Shishi ** h, int *sock, char **ahost, unsigned short rport, char *locuser,
|
||||
status = -1;
|
||||
goto bad2;
|
||||
}
|
||||
# if HAVE_SIGACTION
|
||||
sigprocmask (SIG_SETMASK, &osigs, NULL);
|
||||
# else
|
||||
sigsetmask (oldmask);
|
||||
# endif /* !HAVE_SIGACTION */
|
||||
*sock = s;
|
||||
# if defined KERBEROS
|
||||
return (KSUCCESS);
|
||||
@@ -338,7 +361,11 @@ bad2:
|
||||
close (*fd2p);
|
||||
bad:
|
||||
close (s);
|
||||
# if HAVE_SIGACTION
|
||||
sigprocmask (SIG_SETMASK, &osigs, NULL);
|
||||
# else
|
||||
sigsetmask (oldmask);
|
||||
# endif /* !HAVE_SIGACTION */
|
||||
return (status);
|
||||
}
|
||||
|
||||
|
||||
@@ -76,6 +76,7 @@
|
||||
# include <sys/types.h>
|
||||
# include <signal.h>
|
||||
# define AUTH_NAMES
|
||||
# define AUTHTYPE_NAMES /* Needed by Solaris. */
|
||||
# include <arpa/telnet.h>
|
||||
# include <stdlib.h>
|
||||
# ifdef NO_STRING_H
|
||||
|
||||
@@ -90,10 +90,13 @@
|
||||
|
||||
typedef unsigned char Block[8];
|
||||
typedef unsigned char *BlockT;
|
||||
|
||||
# ifndef HAVE_ARPA_TELNET_H_SCHEDULE
|
||||
typedef struct
|
||||
{
|
||||
Block _;
|
||||
} Schedule[16];
|
||||
# endif /* HAVE_ARPA_TELNET_H_SCHEDULE */
|
||||
|
||||
# ifndef VALIDKEY
|
||||
# define VALIDKEY(key) ( key[0] | key[1] | key[2] | key[3] | \
|
||||
@@ -102,12 +105,14 @@ typedef struct
|
||||
|
||||
# define SAMEKEY(k1, k2) (!memcmp ((void *) k1, (void *) k2, sizeof (Block)))
|
||||
|
||||
# ifndef HAVE_ARPA_TELNET_H_SESSION_KEY
|
||||
typedef struct
|
||||
{
|
||||
short type;
|
||||
int length;
|
||||
unsigned char *data;
|
||||
} Session_Key;
|
||||
# endif /* HAVE_ARPA_TELNET_H_SESSION_KEY */
|
||||
|
||||
typedef struct
|
||||
{
|
||||
|
||||
@@ -50,6 +50,7 @@
|
||||
#include <config.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <arpa/telnet.h>
|
||||
|
||||
#include "auth.h"
|
||||
#include "encrypt.h"
|
||||
|
||||
@@ -231,7 +231,7 @@ rlogind_sigchld (int sig)
|
||||
c = des_read(fd, buf, size); \
|
||||
else \
|
||||
c = read(fd, buf, size);
|
||||
# define EN_WRITE(c, fd, buf, size, ap) \
|
||||
# define ENC_WRITE(c, fd, buf, size, ap) \
|
||||
if (encrypt_io) \
|
||||
c = des_write(fd, buf, size); \
|
||||
else \
|
||||
|
||||
@@ -111,6 +111,10 @@
|
||||
# include <shishi_def.h>
|
||||
#endif
|
||||
|
||||
#ifndef MAX
|
||||
# define MAX(a,b) (((a) > (b)) ? (a) : (b))
|
||||
#endif
|
||||
|
||||
int keepalive = 1; /* flag for SO_KEEPALIVE scoket option */
|
||||
int check_all;
|
||||
int log_success; /* If TRUE, log all successful accesses */
|
||||
|
||||
Reference in New Issue
Block a user