Merge branch 'from-hg'
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
# Makefile for mbnntpd
|
||||
# $Id$
|
||||
# $Id: Makefile,v 1.11 2007/05/27 12:50:47 mbse Exp $
|
||||
|
||||
include ../Makefile.global
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*****************************************************************************
|
||||
*
|
||||
* $Id$
|
||||
* $Id: atoul.c,v 1.3 2005/10/11 20:49:47 mbse Exp $
|
||||
* Purpose ...............: MBSE BBS Mail Gate
|
||||
*
|
||||
*****************************************************************************
|
||||
|
@@ -1,7 +1,7 @@
|
||||
#ifndef _ATOUL_H
|
||||
#define _ATOUL_H
|
||||
|
||||
/* $Id$ */
|
||||
/* $Id: atoul.h,v 1.3 2005/10/11 20:49:47 mbse Exp $ */
|
||||
|
||||
#ifndef USE_NEWSGATE
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*****************************************************************************
|
||||
*
|
||||
* $Id$
|
||||
* $Id: auth.c,v 1.5 2005/09/07 20:44:37 mbse Exp $
|
||||
*
|
||||
*****************************************************************************
|
||||
* Copyright (C) 1997-2005
|
||||
|
@@ -1,7 +1,7 @@
|
||||
#ifndef _MBAUTH_H
|
||||
#define _MBAUTH_H
|
||||
|
||||
/* $Id$ */
|
||||
/* $Id: auth.h,v 1.2 2004/06/20 14:38:11 mbse Exp $ */
|
||||
|
||||
#ifndef USE_NEWSGATE
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*****************************************************************************
|
||||
*
|
||||
* $Id$
|
||||
* $Id: commands.c,v 1.36 2007/10/14 15:29:58 mbse Exp $
|
||||
*
|
||||
*****************************************************************************
|
||||
* Copyright (C) 1997-2007
|
||||
|
@@ -1,7 +1,7 @@
|
||||
#ifndef _COMMANDS_H
|
||||
#define _COMMANDS_H
|
||||
|
||||
/* $Id$ */
|
||||
/* $Id: commands.h,v 1.5 2005/02/14 19:57:19 mbse Exp $ */
|
||||
|
||||
#ifndef USE_NEWSGATE
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*****************************************************************************
|
||||
*
|
||||
* $Id$
|
||||
* $Id: hash.c,v 1.4 2005/10/11 20:49:48 mbse Exp $
|
||||
* Purpose ...............: MBSE BBS Mail Gate
|
||||
*
|
||||
*****************************************************************************
|
||||
|
@@ -1,7 +1,7 @@
|
||||
#ifndef HASH_H
|
||||
#define HASH_H
|
||||
|
||||
/* $Id$ */
|
||||
/* $Id: hash.h,v 1.3 2005/10/11 20:49:48 mbse Exp $ */
|
||||
|
||||
#ifndef USE_NEWSGATE
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*****************************************************************************
|
||||
*
|
||||
* $Id$
|
||||
* $Id: lhash.c,v 1.4 2005/10/11 20:49:48 mbse Exp $
|
||||
* Purpose ...............: MBSE BBS Mail Gate
|
||||
*
|
||||
*****************************************************************************
|
||||
|
@@ -1,10 +1,9 @@
|
||||
/*****************************************************************************
|
||||
*
|
||||
* $Id$
|
||||
* Purpose ...............: MBSE NNTP Server
|
||||
*
|
||||
*****************************************************************************
|
||||
* Copyright (C) 1997-2007
|
||||
* Copyright (C) 1997-2011
|
||||
*
|
||||
* Michiel Broek FIDO: 2:280/2802
|
||||
* Beekmansbos 10
|
||||
@@ -42,7 +41,8 @@
|
||||
time_t t_start;
|
||||
time_t t_end;
|
||||
char *envptr = NULL;
|
||||
struct sockaddr_in peeraddr;
|
||||
struct sockaddr_in peeraddr4;
|
||||
struct sockaddr_in6 peeraddr6;
|
||||
pid_t mypid;
|
||||
unsigned int rcvdbytes = 0L;
|
||||
unsigned int sentbytes = 0L;
|
||||
@@ -124,6 +124,17 @@ void geoiplookup(GeoIP* gi, char *hostname, int i)
|
||||
Syslog('+', "GeoIP location: %s, %s %s\n", country_name, country_code, country_continent);
|
||||
}
|
||||
}
|
||||
if (GEOIP_COUNTRY_EDITION_V6 == i) {
|
||||
country_id = GeoIP_id_by_name_v6(gi, hostname);
|
||||
country_code = GeoIP_country_code[country_id];
|
||||
country_name = GeoIP_country_name[country_id];
|
||||
country_continent = GeoIP_country_continent[country_id];
|
||||
if (country_code == NULL) {
|
||||
Syslog('+', "%s: IP Address not found\n", GeoIPDBDescription[i]);
|
||||
} else {
|
||||
Syslog('+', "GeoIP location: %s, %s %s\n", country_name, country_code, country_continent);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -133,9 +144,9 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
struct passwd *pw;
|
||||
int i, rc;
|
||||
socklen_t addrlen = sizeof(struct sockaddr_in);
|
||||
socklen_t addrlen = sizeof(struct sockaddr_in6);
|
||||
char str[INET6_ADDRSTRLEN];
|
||||
#ifdef HAVE_GEOIP_H
|
||||
char *hostname;
|
||||
GeoIP *gi;
|
||||
#endif
|
||||
|
||||
@@ -190,18 +201,34 @@ int main(int argc, char *argv[])
|
||||
if ((rc = rawport()) != 0)
|
||||
WriteError("Unable to set raw mode");
|
||||
else {
|
||||
if (getpeername(0,(struct sockaddr*)&peeraddr,&addrlen) == 0) {
|
||||
Syslog('s', "TCP connection: len=%d, family=%hd, port=%hu, addr=%s",
|
||||
addrlen,peeraddr.sin_family, peeraddr.sin_port, inet_ntoa(peeraddr.sin_addr));
|
||||
Syslog('+', "Incoming connection from %s", inet_ntoa(peeraddr.sin_addr));
|
||||
if (getpeername(0,(struct sockaddr*)&peeraddr6,&addrlen) == 0) {
|
||||
/*
|
||||
* Copy IPv4 part into the IPv6 structure. There has to be a better way
|
||||
* to deal with mixed incoming sockets ???
|
||||
*/
|
||||
memcpy(&peeraddr4, &peeraddr6, sizeof(struct sockaddr_in));
|
||||
if ((peeraddr6.sin6_family == AF_INET6) && (inet_ntop(AF_INET6, &peeraddr6.sin6_addr, str, sizeof(str)))) {
|
||||
Syslog('+', "Incoming IPv6 connection from %s", str);
|
||||
} else if ((peeraddr4.sin_family == AF_INET) && (inet_ntop(AF_INET, &peeraddr4.sin_addr, str, sizeof(str)))) {
|
||||
Syslog('+', "Incoming IPv4 connection from %s", str);
|
||||
}
|
||||
|
||||
#ifdef HAVE_GEOIP_H
|
||||
hostname = inet_ntoa(peeraddr.sin_addr);
|
||||
_GeoIP_setup_dbfilename();
|
||||
if (GeoIP_db_avail(GEOIP_COUNTRY_EDITION)) {
|
||||
if ((gi = GeoIP_open_type(GEOIP_COUNTRY_EDITION, GEOIP_STANDARD)) != NULL) {
|
||||
geoiplookup(gi, hostname, GEOIP_COUNTRY_EDITION);
|
||||
if (peeraddr6.sin6_family == AF_INET6) {
|
||||
if (GeoIP_db_avail(GEOIP_COUNTRY_EDITION_V6)) {
|
||||
if ((gi = GeoIP_open_type(GEOIP_COUNTRY_EDITION_V6, GEOIP_STANDARD)) != NULL) {
|
||||
geoiplookup(gi, str, GEOIP_COUNTRY_EDITION_V6);
|
||||
}
|
||||
GeoIP_delete(gi);
|
||||
}
|
||||
} else if (peeraddr6.sin6_family == AF_INET) {
|
||||
if (GeoIP_db_avail(GEOIP_COUNTRY_EDITION)) {
|
||||
if ((gi = GeoIP_open_type(GEOIP_COUNTRY_EDITION, GEOIP_STANDARD)) != NULL) {
|
||||
geoiplookup(gi, str, GEOIP_COUNTRY_EDITION);
|
||||
}
|
||||
GeoIP_delete(gi);
|
||||
}
|
||||
GeoIP_delete(gi);
|
||||
}
|
||||
#endif
|
||||
#ifdef USE_NEWSGATE
|
||||
|
@@ -1,7 +1,7 @@
|
||||
#ifndef _MBNNTP_H
|
||||
#define _MBNNTP_H
|
||||
|
||||
/* $Id$ */
|
||||
/* $Id: mbnntp.h,v 1.5 2005/01/14 19:52:13 mbse Exp $ */
|
||||
|
||||
int usercharset;
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*****************************************************************************
|
||||
*
|
||||
* $Id$
|
||||
* $Id: mkftnhdr.c,v 1.6 2008/11/26 22:31:23 mbse Exp $
|
||||
* Purpose ...............: MBSE BBS Mail Gate
|
||||
*
|
||||
*****************************************************************************
|
||||
|
@@ -1,7 +1,7 @@
|
||||
#ifndef _MKFTNHDR_H
|
||||
#define _MKFTNHDR_H
|
||||
|
||||
/* $Id$ */
|
||||
/* $Id: mkftnhdr.h,v 1.3 2005/10/11 20:49:48 mbse Exp $ */
|
||||
|
||||
#ifndef USE_NEWSGATE
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*****************************************************************************
|
||||
*
|
||||
* $Id$
|
||||
* $Id: msgflags.c,v 1.2 2004/06/20 14:38:11 mbse Exp $
|
||||
* Purpose ...............: MBSE BBS Mail Gate
|
||||
*
|
||||
*****************************************************************************
|
||||
|
@@ -1,7 +1,7 @@
|
||||
#ifndef _MSGFLAGS_H
|
||||
#define _MSGFLAGS_H
|
||||
|
||||
/* $Id$ */
|
||||
/* $Id: msgflags.h,v 1.2 2004/06/20 14:38:11 mbse Exp $ */
|
||||
|
||||
#ifndef USE_NEWSGATE
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*****************************************************************************
|
||||
*
|
||||
* $Id$
|
||||
* $Id: openport.c,v 1.4 2005/09/12 18:00:26 mbse Exp $
|
||||
* File ..................: mbnntp/openport.c
|
||||
*
|
||||
*****************************************************************************
|
||||
|
@@ -1,7 +1,7 @@
|
||||
#ifndef _OPENPORT_H
|
||||
#define _OPENPORT_H
|
||||
|
||||
/* $Id$ */
|
||||
/* $Id: openport.h,v 1.3 2004/06/20 14:38:11 mbse Exp $ */
|
||||
|
||||
int rawport(void);
|
||||
int cookedport(void);
|
||||
|
@@ -1,10 +1,9 @@
|
||||
/*****************************************************************************
|
||||
*
|
||||
* $Id$
|
||||
* Purpose ...............: Convert RFC to FTN
|
||||
*
|
||||
*****************************************************************************
|
||||
* Copyright (C) 1997-2007
|
||||
* Copyright (C) 1997-2011
|
||||
*
|
||||
* Michiel Broek FIDO: 2:280/2802
|
||||
* Beekmansbos 10
|
||||
@@ -168,7 +167,6 @@ int rfc2ftn(FILE *fp)
|
||||
FILE *ofp, *qfp;
|
||||
fa_list *sbl = NULL, *ptl = NULL, *tmpl;
|
||||
faddr *ta, *fta;
|
||||
unsigned int svmsgid, svreply;
|
||||
int sot_kludge = FALSE, eot_kludge = FALSE, tinyorigin = FALSE;
|
||||
int needsplit, hdrsize, datasize, splitpart, forbidsplit, rfcheaders;
|
||||
time_t Now;
|
||||
@@ -193,8 +191,6 @@ int rfc2ftn(FILE *fp)
|
||||
}
|
||||
|
||||
fmsg->area = xstrcpy(msgs.Tag);
|
||||
svmsgid = fmsg->msgid_n;
|
||||
svreply = fmsg->reply_n;
|
||||
if ((p = hdr((char *)"Message-ID",msg))) {
|
||||
ftnmsgid(p, &fmsg->msgid_a, &fmsg->msgid_n, fmsg->area);
|
||||
hash_update_s(&fmsg->msgid_n, fmsg->area);
|
||||
|
@@ -1,7 +1,7 @@
|
||||
#ifndef _RFC2FTN_H
|
||||
#define _RFC2FTN_H
|
||||
|
||||
/* $Id$ */
|
||||
/* $Id: rfc2ftn.h,v 1.2 2004/06/20 14:38:12 mbse Exp $ */
|
||||
|
||||
#ifndef USE_NEWSGATE
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*****************************************************************************
|
||||
*
|
||||
* $Id$
|
||||
* $Id: ttyio.c,v 1.4 2005/09/07 20:44:37 mbse Exp $
|
||||
*
|
||||
*****************************************************************************
|
||||
* Copyright (C) 1997-2005
|
||||
|
@@ -1,7 +1,7 @@
|
||||
#ifndef TTYIO_H
|
||||
#define TTYIO_H
|
||||
|
||||
/* $Id$ */
|
||||
/* $Id: ttyio.h,v 1.2 2004/04/12 11:50:34 mbroek Exp $ */
|
||||
|
||||
#define FLUSHOUT() tty_flushout()
|
||||
#define FLUSHIN() tty_flushin()
|
||||
|
Reference in New Issue
Block a user