Consistency checks.

This commit is contained in:
Mats Erik Andersson
2012-09-19 12:14:55 +02:00
parent 92cabdc297
commit fc8280bc58
12 changed files with 58 additions and 27 deletions

View File

@@ -1,3 +1,25 @@
2012-09-19 Mats Erik Andersson <gnu@gisladisker.se>
* configure.ac <libwrap check>: Call AC_CHECK_DECLS
with hosts_ctl.
* ftpd/server_mode.c (hosts_ctl)
[WITH_WRAP && !HAVE_DECL_HOSTS_CTL]: Add external
prototype whenever undeclared.
* ftpd/ftpd.c (complete_login): Cast pid_t as int
in formatted print.
* src/inetd.c (run_service, readchild, print_service)
(main): Likewise.
* src/syslogd.c (main): Likewise.
* src/uucpd.c (dologout, dologin): Likewise.
(dologout) [PATH_LASTLOG && HAVE_STRUCT_LASTLOG]:
Declare F conditionally.
* ifconfig/changeif.c: Access `HAVE_DECL_*' using `#if',
not using `#ifdef' constructs.
* libinetutils/kcmd.c, libinetutils/localhost.c: Likewise.
* src/rlogind.c, src/rshd.c: Likewise.
2012-09-17 Mats Erik Andersson <gnu@gisladisker.se>
talk: Delay start of curses interface until

View File

@@ -550,6 +550,7 @@ if test "$with_wrap" = yes; then
# for the wrap lib you have to define some global variables.
#AC_CHECK_LIB(wrap, hosts_ctl, LIBWRAP=-lwrap)
AC_CHECK_HEADERS([tcpd.h])
AC_CHECK_DECLS([hosts_ctl], , , [#include <tcpd.h>])
AC_MSG_CHECKING(hosts_ctl in -lwrap);
save_LIBS=$LIBS
LIBS="$save_LIBS -lwrap"

View File

@@ -656,7 +656,7 @@ complete_login (struct credentials *pcred)
#endif
/* open wtmp before chroot */
snprintf (ttyline, sizeof (ttyline), "ftp%d", getpid ());
snprintf (ttyline, sizeof (ttyline), "ftp%d", (int) getpid ());
logwtmp_keep_open (ttyline, pcred->name, pcred->remotehost);
if (pcred->guest)

View File

@@ -54,6 +54,10 @@ static void reapchild (int);
#ifdef WITH_WRAP
# if !HAVE_DECL_HOSTS_CTL
extern int hosts_ctl (char *, char *, char *, char *);
# endif
int allow_severity = LOG_INFO;
int deny_severity = LOG_NOTICE;
@@ -204,7 +208,7 @@ server_mode (const char *pidfile, struct sockaddr *phis_addr,
syslog (LOG_ERR, "can't open %s: %m", PATH_FTPDPID);
else
{
fprintf (pid_fp, "%d\n", getpid ());
fprintf (pid_fp, "%d\n", (int) getpid ());
fchmod (fileno (pid_fp), S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
fclose (pid_fp);
}

View File

@@ -52,7 +52,7 @@
return -1; \
}
#ifndef HAVE_DECL_GETADDRINFO
#if !HAVE_DECL_GETADDRINFO
extern void herror (const char *pfx);
#endif
@@ -67,7 +67,7 @@ set_address (int sfd, struct ifreq *ifr, char *address)
"don't know how to set an interface address on this system");
return -1;
#else
# ifdef HAVE_DECL_GETADDRINFO
# if HAVE_DECL_GETADDRINFO
int rc;
char addr[INET_ADDRSTRLEN];
struct addrinfo hints, *ai, *res;

View File

@@ -120,7 +120,7 @@ kcmd (Shishi ** h, int *sock, char **ahost, unsigned short rport, char *locuser,
# else
int lport = START_PORT;
# endif
# ifdef HAVE_DECL_GETADDRINFO
# if HAVE_DECL_GETADDRINFO
struct addrinfo hints, *ai, *res;
char portstr[8], fqdn[NI_MAXHOST];
# else /* !HAVE_DECL_GETADDRINFO */
@@ -143,7 +143,7 @@ kcmd (Shishi ** h, int *sock, char **ahost, unsigned short rport, char *locuser,
else
host = *ahost;
# ifdef HAVE_DECL_GETADDRINFO
# if HAVE_DECL_GETADDRINFO
memset (&hints, 0, sizeof (hints));
hints.ai_family = af;
hints.ai_socktype = SOCK_STREAM;
@@ -227,7 +227,7 @@ kcmd (Shishi ** h, int *sock, char **ahost, unsigned short rport, char *locuser,
# endif /* !HAVE_SIGACTION */
for (;;)
{
# ifdef HAVE_DECL_GETADDRINFO
# if HAVE_DECL_GETADDRINFO
s = getport (&lport, ai->ai_family);
# else /* !HAVE_DECL_GETADDRINFO */
s = getport (&lport, hp->h_addrtype);
@@ -247,7 +247,7 @@ kcmd (Shishi ** h, int *sock, char **ahost, unsigned short rport, char *locuser,
}
fcntl (s, F_SETOWN, pid);
# ifdef HAVE_DECL_GETADDRINFO
# if HAVE_DECL_GETADDRINFO
len = ai->ai_addrlen;
memcpy (&sin, ai->ai_addr, ai->ai_addrlen);
# else /* !HAVE_DECL_GETADDRINFO */
@@ -293,7 +293,7 @@ kcmd (Shishi ** h, int *sock, char **ahost, unsigned short rport, char *locuser,
continue;
}
# if ! defined ultrix || defined sun
# ifdef HAVE_DECL_GETADDRINFO
# if HAVE_DECL_GETADDRINFO
if (ai->ai_next)
# else /* !HAVE_DECL_GETADDRINFO */
if (hp->h_addr_list[1] != NULL)
@@ -302,7 +302,7 @@ kcmd (Shishi ** h, int *sock, char **ahost, unsigned short rport, char *locuser,
int oerrno = errno;
char addrstr[INET6_ADDRSTRLEN];
# ifdef HAVE_DECL_GETADDRINFO
# if HAVE_DECL_GETADDRINFO
getnameinfo (ai->ai_addr, ai->ai_addrlen,
addrstr, sizeof (addrstr), NULL, 0,
NI_NUMERICHOST);
@@ -328,7 +328,7 @@ kcmd (Shishi ** h, int *sock, char **ahost, unsigned short rport, char *locuser,
continue;
}
# endif /* !(defined(ultrix) || defined(sun)) */
# ifdef HAVE_DECL_GETADDRINFO
# if HAVE_DECL_GETADDRINFO
if (errno != ECONNREFUSED)
perror (res->ai_canonname);
@@ -347,7 +347,7 @@ kcmd (Shishi ** h, int *sock, char **ahost, unsigned short rport, char *locuser,
return (-1);
}
# ifdef HAVE_DECL_GETADDRINFO
# if HAVE_DECL_GETADDRINFO
if (res)
freeaddrinfo (res);
#endif

View File

@@ -78,7 +78,7 @@ localhost (void)
else
/* Determine FQDN. */
{
#ifdef HAVE_DECL_GETADDRINFO
#if HAVE_DECL_GETADDRINFO
int rc;
struct addrinfo hints, *res;
char fqdn[NI_MAXHOST];

View File

@@ -426,7 +426,7 @@ run_service (int ctrl, struct servtab *sep)
else
{
if (debug)
fprintf (stderr, "%d execl %s\n", getpid (), sep->se_server);
fprintf (stderr, "%d execl %s\n", (int) getpid (), sep->se_server);
dup2 (ctrl, 0);
close (ctrl);
dup2 (0, 1);
@@ -505,7 +505,7 @@ reapchild (int signo _GL_UNUSED_PARAMETER)
if (pid <= 0)
break;
if (debug)
fprintf (stderr, "%d reaped, status %#x\n", pid, status);
fprintf (stderr, "%d reaped, status %#x\n", (int) pid, status);
for (sep = servtab; sep; sep = sep->se_next)
if (sep->se_wait == pid)
{
@@ -564,13 +564,15 @@ void
print_service (const char *action, struct servtab *sep)
{
fprintf (stderr,
"%s:%d: %s: %s:%s proto=%s, wait=%d, max=%u, user=%s group=%s builtin=%s server=%s\n",
"%s:%d: %s: %s:%s proto=%s, wait=%d, max=%u, "
"user=%s group=%s builtin=%s server=%s\n",
sep->se_file, sep->se_line,
action,
ISMUX (sep) ? (ISMUXPLUS (sep) ? "tcpmuxplus" : "tcpmux")
: (sep->se_node ? sep->se_node : "*"),
sep->se_service, sep->se_proto,
sep->se_wait, sep->se_max, sep->se_user, sep->se_group,
(int) sep->se_wait, sep->se_max,
sep->se_user, sep->se_group,
sep->se_bi ? sep->se_bi->bi_service : "no",
sep->se_server);
}
@@ -1947,7 +1949,7 @@ main (int argc, char *argv[], char *envp[])
{
if (debug)
fprintf(stderr, "Using pid-file at \"%s\".\n", pid_file);
fprintf (fp, "%d\n", getpid ());
fprintf (fp, "%d\n", (int) getpid ());
fclose (fp);
}
else

View File

@@ -554,7 +554,7 @@ rlogin_daemon (int maxchildren, int port)
int
rlogind_auth (int fd, struct auth_data *ap)
{
#if defined HAVE_DECL_GETNAMEINFO && defined HAVE_DECL_GETADDRINFO
#if HAVE_DECL_GETNAMEINFO && HAVE_DECL_GETADDRINFO
int rc;
char hoststr[NI_MAXHOST];
#else
@@ -584,7 +584,7 @@ rlogind_auth (int fd, struct auth_data *ap)
confirmed = 0;
/* Check the remote host name */
#ifdef HAVE_DECL_GETNAMEINFO
#if HAVE_DECL_GETNAMEINFO
rc = getnameinfo ((struct sockaddr *) &ap->from, ap->fromlen,
hoststr, sizeof (hoststr), NULL, 0, NI_NAMEREQD);
if (!rc)
@@ -617,7 +617,7 @@ rlogind_auth (int fd, struct auth_data *ap)
if (verify_hostname || in_local_domain (ap->hostname))
{
int match = 0;
#if defined HAVE_DECL_GETADDRINFO && defined HAVE_DECL_GETNAMEINFO
#if HAVE_DECL_GETADDRINFO && HAVE_DECL_GETNAMEINFO
struct addrinfo hints, *ai, *res;
char astr[INET6_ADDRSTRLEN];

View File

@@ -408,7 +408,7 @@ doit (int sockfd, struct sockaddr *fromp, socklen_t fromlen)
int cc, nfd, pv[2], pid, s = sockfd;
int rc, one = 1;
char portstr[8], addrstr[INET6_ADDRSTRLEN];
#ifdef HAVE_DECL_GETNAMEINFO
#if HAVE_DECL_GETNAMEINFO
char addrname[NI_MAXHOST];
#else /* !HAVE_DECL_GETNAMEINFO */
struct hostent *hp;
@@ -462,7 +462,7 @@ doit (int sockfd, struct sockaddr *fromp, socklen_t fromlen)
}
#endif
#ifdef HAVE_DECL_GETNAMEINFO
#if HAVE_DECL_GETNAMEINFO
rc = getnameinfo (fromp, fromlen,
addrstr, sizeof (addrstr),
portstr, sizeof (portstr),
@@ -661,7 +661,7 @@ doit (int sockfd, struct sockaddr *fromp, socklen_t fromlen)
* used for the authentication below.
*/
errorstr = NULL;
#ifdef HAVE_DECL_GETNAMEINFO
#if HAVE_DECL_GETNAMEINFO
rc = getnameinfo (fromp, fromlen, addrname, sizeof (addrname),
NULL, 0, NI_NAMEREQD);
if (rc == 0)

View File

@@ -632,7 +632,7 @@ main (int argc, char *argv[])
fp = fopen (PidFile, "w");
if (fp != NULL)
{
fprintf (fp, "%d\n", getpid ());
fprintf (fp, "%d\n", (int) getpid ());
fclose (fp);
}

View File

@@ -229,7 +229,7 @@ dologout (void)
#endif /* HAVE_WAITPID */
{
char line[100];
sprintf (line, "uucp%.4d", pid);
sprintf (line, "uucp%.4d", (int) pid);
#ifdef HAVE_LOGWTMPX
logwtmpx (line, "", "", 0, DEAD_PROCESS);
#elif defined HAVE_LOGWTMP
@@ -265,7 +265,9 @@ dologin (struct passwd *pw, struct sockaddr_in *sin)
{
char line[32];
char remotehost[32];
#if defined PATH_LASTLOG && defined HAVE_STRUCT_LASTLOG
int f;
#endif
struct hostent *hp = gethostbyaddr ((char *) &sin->sin_addr,
sizeof (struct in_addr), AF_INET);
@@ -277,7 +279,7 @@ dologin (struct passwd *pw, struct sockaddr_in *sin)
else
strncpy (remotehost, inet_ntoa (sin->sin_addr), sizeof (remotehost));
sprintf (line, "uucp%.4d", getpid ());
sprintf (line, "uucp%.4d", (int) getpid ());
#ifdef HAVE_LOGWTMPX
logwtmpx (line, pw->pw_name, remotehost, 0, USER_PROCESS);