summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2002-06-22 20:34:32 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2002-06-22 20:34:32 +0000
commit15f0c0da845d989a20efdffaf321f79d02b5285c (patch)
treeca67f5f6c2a6375c3f92162a51e0913a9613834f
parentc70b5b7c61b3b4bb78374b1110ee8b25656434ad (diff)
ansi
-rw-r--r--libexec/identd/identd.c45
-rw-r--r--libexec/identd/openbsd.c21
-rw-r--r--libexec/identd/parse.c33
3 files changed, 30 insertions, 69 deletions
diff --git a/libexec/identd/identd.c b/libexec/identd/identd.c
index 202f306d844..4003255991f 100644
--- a/libexec/identd/identd.c
+++ b/libexec/identd/identd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: identd.c,v 1.26 2002/03/12 19:45:09 millert Exp $ */
+/* $OpenBSD: identd.c,v 1.27 2002/06/22 20:34:31 deraadt Exp $ */
/*
* This program is in the public domain and may be used freely by anyone
@@ -60,7 +60,7 @@ char *indirect_password = NULL;
static pid_t child_pid;
void
-usage()
+usage(void)
{
syslog(LOG_ERR,
"%s [-i | -w | -b] [-t seconds] [-u uid] [-g gid] [-p port] "
@@ -71,9 +71,8 @@ usage()
/*
* Return the name of the connecting host, or the IP number as a string.
*/
-char *
-gethost4_addr(addr)
- struct in_addr *addr;
+char *
+gethost4_addr(struct in_addr *addr)
{
struct hostent *hp;
@@ -83,18 +82,16 @@ gethost4_addr(addr)
return inet_ntoa(*addr);
}
-char *
-gethost(ss)
- struct sockaddr_storage *ss;
+char *
+gethost(struct sockaddr_storage *ss)
{
if (ss->ss_family == AF_INET6)
return (gethost6((struct sockaddr_in6 *)ss));
return (gethost4((struct sockaddr_in *)ss));
}
-char *
-gethost4(sin)
- struct sockaddr_in *sin;
+char *
+gethost4(struct sockaddr_in *sin)
{
struct hostent *hp;
@@ -107,9 +104,8 @@ gethost4(sin)
/*
* Return the name of the connecting host, or the IP number as a string.
*/
-char *
-gethost6(addr)
- struct sockaddr_in6 *addr;
+char *
+gethost6(struct sockaddr_in6 *addr)
{
static char hbuf[2][NI_MAXHOST];
#ifdef NI_WITHSCOPEID
@@ -136,7 +132,7 @@ volatile sig_atomic_t alarm_fired;
* Exit cleanly after our time's up.
*/
static void
-alarm_handler()
+alarm_handler(int notused)
{
alarm_fired = 1;
}
@@ -145,28 +141,23 @@ alarm_handler()
* Main entry point into this daemon
*/
int
-main(argc, argv)
- int argc;
- char *argv[];
+main(int argc, char *argv[])
{
- int len;
struct sockaddr_storage sa, sa2;
/* struct sockaddr_in sin;*/
- struct sockaddr_in * sin;
- struct sockaddr_in6 * sin6;
+ struct sockaddr_in *sin;
+ struct sockaddr_in6 *sin6;
struct in_addr laddr, faddr;
struct in6_addr laddr6, faddr6;
struct passwd *pwd;
struct group *grp;
- int background_flag = 0;
- int timeout = 0;
+ int background_flag = 0, timeout = 0, len, ch;
char *portno = "auth";
char *bind_address = NULL;
uid_t set_uid = 0;
gid_t set_gid = 0;
extern char *optarg;
extern int optind;
- int ch;
openlog(__progname, LOG_PID, LOG_DAEMON);
/*
@@ -438,8 +429,7 @@ main(argc, argv)
if (sa.ss_family == AF_INET6) {
sin6 = (struct sockaddr_in6 *)&sa;
faddr6 = sin6->sin6_addr;
- }
- else {
+ } else {
sin = (struct sockaddr_in *)&sa;
faddr = sin->sin_addr;
}
@@ -471,8 +461,7 @@ main(argc, argv)
*/
parse6(STDIN_FILENO, (struct sockaddr_in6 *)&sa2,
(struct sockaddr_in6 *)&sa);
- }
- else {
+ } else {
sin = (struct sockaddr_in *)&sa2;
laddr = sin->sin_addr;
/*
diff --git a/libexec/identd/openbsd.c b/libexec/identd/openbsd.c
index 0334b93c008..15b18a10fdc 100644
--- a/libexec/identd/openbsd.c
+++ b/libexec/identd/openbsd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: openbsd.c,v 1.15 2001/01/28 19:34:29 niklas Exp $ */
+/* $OpenBSD: openbsd.c,v 1.16 2002/06/22 20:34:31 deraadt Exp $ */
/*
* This program is in the public domain and may be used freely by anyone
@@ -36,12 +36,8 @@
* Return the user number for the connection owner
*/
int
-k_getuid(faddr, fport, laddr, lport, uid)
- struct in_addr *faddr;
- int fport;
- struct in_addr *laddr;
- int lport;
- uid_t *uid;
+k_getuid(struct in_addr *faddr, int fport, struct in_addr *laddr,
+ int lport, uid_t *uid)
{
struct tcp_ident_mapping tir;
struct sockaddr_in *fin, *lin;
@@ -79,12 +75,8 @@ k_getuid(faddr, fport, laddr, lport, uid)
* New minty IPv6 version.
*/
int
-k_getuid6(faddr, fport, laddr, lport, uid)
- struct sockaddr_in6 *faddr;
- int fport;
- struct sockaddr_in6 *laddr;
- int lport;
- uid_t *uid;
+k_getuid6(struct sockaddr_in6 *faddr, int fport, struct sockaddr_in6 *laddr,
+ int lport, uid_t *uid)
{
struct tcp_ident_mapping tir;
struct sockaddr_in6 *fin, *lin;
@@ -115,6 +107,3 @@ k_getuid6(faddr, fport, laddr, lport, uid)
return (-1);
}
-
-
-
diff --git a/libexec/identd/parse.c b/libexec/identd/parse.c
index c43bb4f06fa..2a3eb3233dc 100644
--- a/libexec/identd/parse.c
+++ b/libexec/identd/parse.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.c,v 1.29 2002/02/16 21:27:30 millert Exp $ */
+/* $OpenBSD: parse.c,v 1.30 2002/06/22 20:34:31 deraadt Exp $ */
/*
* This program is in the public domain and may be used freely by anyone
@@ -40,8 +40,7 @@ void gentoken(char *, int);
* file in a users home directory.
*/
int
-check_noident(homedir)
- char *homedir;
+check_noident(char *homedir)
{
char path[MAXPATHLEN];
struct stat st;
@@ -60,9 +59,7 @@ check_noident(homedir)
* file in a users home directory, and return its contents.
*/
int
-getuserident(homedir, buf, len)
- char *homedir, *buf;
- int len;
+getuserident(char *homedir, char *buf, int len)
{
char path[MAXPATHLEN];
struct stat st;
@@ -100,9 +97,7 @@ static char token0cnv[] = "abcdefghijklmnopqrstuvwxyz";
static char tokencnv[] = "abcdefghijklmnopqrstuvwxyz0123456789";
void
-gentoken(buf, len)
- char *buf;
- int len;
+gentoken(char *buf, int len)
{
char *p;
@@ -121,11 +116,7 @@ gentoken(buf, len)
* Returns 0 on timeout, -1 on error, #bytes read on success.
*/
ssize_t
-timed_read(fd, buf, siz, timeout)
- int fd;
- void *buf;
- size_t siz;
- time_t timeout;
+timed_read(int fd, void *buf, size_t siz, time_t timeout)
{
int error, tot = 0, i, r;
char *p = buf;
@@ -167,11 +158,7 @@ timed_read(fd, buf, siz, timeout)
* Returns 0 on timeout, -1 on error, #bytes read on success.
*/
ssize_t
-timed_write(fd, buf, siz, timeout)
- int fd;
- const void *buf;
- size_t siz;
- time_t timeout;
+timed_write(int fd, const void *buf, size_t siz, time_t timeout)
{
int error;
struct pollfd wfd[2];
@@ -191,9 +178,7 @@ timed_write(fd, buf, siz, timeout)
}
int
-parse(fd, laddr, faddr)
- int fd;
- struct in_addr *laddr, *faddr;
+parse(int fd, struct in_addr *laddr, struct in_addr *faddr)
{
char token[21];
char buf[BUFSIZ], *p;
@@ -361,9 +346,7 @@ parse(fd, laddr, faddr)
/* Parse, a-la IPv6 */
int
-parse6(fd, laddr, faddr)
- int fd;
- struct sockaddr_in6 *laddr, *faddr;
+parse6(int fd, struct sockaddr_in6 *laddr, struct sockaddr_in6 *faddr)
{
char token[21];
char buf[BUFSIZ], *p;