head	1.2;
access;
symbols
	RELEASE_8_3_0:1.2
	RELEASE_9_0_0:1.2
	RELEASE_7_4_0:1.2
	RELEASE_8_2_0:1.2
	RELEASE_6_EOL:1.2
	RELEASE_8_1_0:1.2
	RELEASE_7_3_0:1.2
	RELEASE_8_0_0:1.2
	RELEASE_7_2_0:1.2
	RELEASE_7_1_0:1.2
	RELEASE_6_4_0:1.2
	RELEASE_5_EOL:1.2
	RELEASE_7_0_0:1.2
	RELEASE_6_3_0:1.2
	PRE_XORG_7:1.2
	RELEASE_4_EOL:1.2
	RELEASE_6_2_0:1.2
	RELEASE_6_1_0:1.2
	RELEASE_5_5_0:1.2
	RELEASE_6_0_0:1.2
	RELEASE_5_4_0:1.2
	RELEASE_4_11_0:1.2
	RELEASE_5_3_0:1.2
	RELEASE_4_10_0:1.2
	RELEASE_5_2_1:1.2
	RELEASE_5_2_0:1.2
	RELEASE_4_9_0:1.2
	RELEASE_5_1_0:1.2
	RELEASE_4_8_0:1.2
	RELEASE_5_0_0:1.2
	RELEASE_4_7_0:1.1.1.1
	RELEASE_4_6_2:1.1.1.1
	RELEASE_4_6_1:1.1.1.1
	RELEASE_4_6_0:1.1.1.1
	RELEASE_5_0_DP1:1.1.1.1
	RELEASE_4_5_0:1.1.1.1
	RELEASE_4_4_0:1.1.1.1
	RELEASE_4_3_0:1.1.1.1
	RELEASE_4_2_0:1.1.1.1
	RELEASE_4_1_1:1.1.1.1
	RELEASE_4_1_0:1.1.1.1
	RELEASE_3_5_0:1.1.1.1
	RELEASE_4_0_0:1.1.1.1
	RELEASE_3_4_0:1.1.1.1
	RELEASE_3_3_0:1.1.1.1
	RELEASE_3_2_0:1.1.1.1
	nsayer:1.1.1.1
	NSAYER:1.1.1;
locks; strict;
comment	@# @;


1.2
date	2002.10.21.00.52.28;	author kris;	state Exp;
branches;
next	1.1;

1.1
date	99.04.02.19.07.30;	author nsayer;	state Exp;
branches
	1.1.1.1;
next	;

1.1.1.1
date	99.04.02.19.07.30;	author nsayer;	state Exp;
branches;
next	;


desc
@@


1.2
log
@Fix build on -current (_exit() -> _exit(0))
@
text
@--- identify.c.orig	Tue Feb  2 01:51:57 1993
+++ identify.c	Sun Oct 20 17:53:44 2002
@@@@ -11,7 +11,7 @@@@
 #include <stdio.h>
 #include <signal.h>
 #include <syslog.h>
-#include <authuser.h>
+#include <ident.h>
 #include <netdb.h>
 #include <sys/types.h>
 #include <netinet/in.h>
@@@@ -33,57 +33,43 @@@@
 int noidentify = 0;
 int bits = 0;
 int reject_flag = 0;
-unsigned long inlocal;
-unsigned long inremote;
+struct in_addr inlocal;
+struct in_addr inremote;
 int timeout = 120;
-int rtimeout = 30;
-
-static char *host_address(ad)
-  unsigned long ad;
-{
-  int a, b, c, d;
-  static char addr[20];
-  
-  d = ad % 256;
-  ad /= 256;
-  c = ad % 256;
-  ad /= 256;
-  b = ad % 256;
-  a = ad / 256;
-  sprintf(addr, "%d.%d.%d.%d", a, b, c, d);
-  
-  return addr;
-}
-
 
 char *ident_get_identifier(fd, host, len)
   int fd;
   char *host;
   int len;
 {
-  unsigned short local;
-  unsigned short remote;
-
+  struct sockaddr_in sa;
+  int l;
 
-  if (auth_fd2(fd, &inlocal, &inremote,
-	       &local, &remote) == -1)
+  l=sizeof(sa);
+  if (getsockname(fd,(struct sockaddr *)&sa,&l)<0)
   {
     if (debug)
-      perror("auth_fd2");
-    
+      perror("getsockname()");
     return NULL;
   }
+  inlocal=sa.sin_addr;
+  if (getpeername(fd,(struct sockaddr *)&sa,&l)<0)
+  {
+    if (debug)
+      perror("getpeername()");
+    return NULL;
+  }
+  inremote=sa.sin_addr;
 
   if (host)
   {
     struct hostent *hp;
 
-  
-    hp = gethostbyaddr(&inremote,sizeof(struct in_addr),AF_INET);
+    hp = gethostbyaddr((const char *)&inremote,sizeof(struct in_addr),AF_INET);
     if (hp)
       strncpy(host, hp->h_name, len);
     else
-      strncpy(host, host_address(inremote), len);
+      strncpy(host, inet_ntoa(inremote), len);
     
     host[len] = '\0';
   }
@@@@ -91,16 +77,7 @@@@
   if (noidentify)
     return NULL;
   else
-    if (timeout)
-    {
-	if (rtimeout)
-	    return auth_tcpuser4(inlocal, inremote, local, remote, timeout,
-				 rtimeout);
-	else
-	    return auth_tcpuser3(inlocal, inremote, local, remote, timeout);
-    }
-    else
-      return auth_tcpuser2(inlocal, inremote, local, remote);
+    return ident_id(fd,timeout);
 }
 
 
@@@@ -128,10 +105,6 @@@@
 	timeout = atoi(argv[i]+2);
 	break;
 	
-      case 'T':
-	rtimeout = atoi(argv[i]+2);
-	break;
-	
       case 'R':
 	if (!argv[i][2])
 	  reject_flag = 1;
@@@@ -200,7 +173,7 @@@@
     {
       /* In child, let's fork again so we can forget about this child */
       if (fork())
-	_exit();
+	_exit(0);
     }
     else
     {
@@@@ -241,13 +214,13 @@@@
     }
   }
 
-  if ((bits && (inremote >> bits != inlocal >> bits)) ||
+  if ((bits && (htonl(inremote.s_addr) >> bits != htonl(inlocal.s_addr) >> bits)) ||
       (reject_flag && !id))
   {
     if (id)
-      syslog(priority, "Rejecting from %s@@%s", id, host_address(inremote));
+      syslog(priority, "Rejecting from %s@@%s", id, inet_ntoa(inremote));
     else
-      syslog(priority, "Rejecting from %s", host_address(inremote));
+      syslog(priority, "Rejecting from %s", inet_ntoa(inremote));
     exit(1);
   }
   
@


1.1
log
@Initial revision
@
text
@d2 1
a2 1
+++ identify.c	Fri Apr  2 10:57:28 1999
d116 9
@


1.1.1.1
log
@Add "identify" daemon wrapper. Allows one to add ident lookup and logging
to arbitrary daemons (like telnetd or fingerd).
@
text
@@
