summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile2
-rw-r--r--opentracker.c7
-rw-r--r--ot_accesslist.c2
-rw-r--r--ot_accesslist.h4
-rw-r--r--ot_clean.c2
-rw-r--r--ot_clean.h4
-rw-r--r--ot_fullscrape.c6
-rw-r--r--ot_fullscrape.h4
-rw-r--r--ot_http.c6
-rw-r--r--ot_http.h4
-rw-r--r--ot_iovec.c2
-rw-r--r--ot_iovec.h4
-rw-r--r--ot_livesync.c2
-rw-r--r--ot_livesync.h4
-rw-r--r--ot_mutex.c2
-rw-r--r--ot_mutex.h9
-rw-r--r--ot_rijndael.c2
-rw-r--r--ot_rijndael.h6
-rw-r--r--ot_stats.c2
-rw-r--r--ot_stats.h7
-rw-r--r--ot_sync.c2
-rw-r--r--ot_sync.h4
-rw-r--r--ot_udp.c2
-rw-r--r--ot_udp.h4
-rw-r--r--ot_vector.c2
-rw-r--r--ot_vector.h4
-rw-r--r--proxy.c5
-rw-r--r--scan_urlencoded_query.c2
-rw-r--r--scan_urlencoded_query.h4
-rw-r--r--trackerlogic.c2
-rw-r--r--trackerlogic.h4
31 files changed, 64 insertions, 52 deletions
diff --git a/Makefile b/Makefile
index ed280be..d46dcf3 100644
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,4 @@
-# $Id: Makefile,v 1.73 2012/06/08 19:21:46 erdgeist Exp $
+# $Id: Makefile,v 1.74 2018/01/29 17:45:20 erdgeist Exp $
CC?=gcc
diff --git a/opentracker.c b/opentracker.c
index 4fc6678..405fdcc 100644
--- a/opentracker.c
+++ b/opentracker.c
@@ -2,7 +2,7 @@
It is considered beerware. Prost. Skol. Cheers or whatever.
Some of the stuff below is stolen from Fefes example libowfat httpd.
- $Id: opentracker.c,v 1.239 2014/10/06 22:32:28 git Exp $ */
+ $Id: opentracker.c,v 1.240 2018/01/29 17:43:33 erdgeist Exp $ */
/* System */
#include <stdlib.h>
@@ -48,6 +48,7 @@ static char * g_serverdir;
static char * g_serveruser;
static unsigned int g_udp_workers;
+static void panic( const char *routing ) __attribute__ ((noreturn));
static void panic( const char *routine ) {
fprintf( stderr, "%s: %s\n", routine, strerror(errno) );
exit( 111 );
@@ -639,6 +640,8 @@ int main( int argc, char **argv ) {
panic( "selfpipe failed: " );
if( !io_fd( g_self_pipe[0] ) )
panic( "selfpipe io_fd failed: " );
+ if( !io_fd( g_self_pipe[1] ) )
+ panic( "selfpipe io_fd failed: " );
io_setcookie( g_self_pipe[0], (void*)FLAG_SELFPIPE );
io_wantread( g_self_pipe[0] );
@@ -662,4 +665,4 @@ int main( int argc, char **argv ) {
return 0;
}
-const char *g_version_opentracker_c = "$Source: /home/cvsroot/opentracker/opentracker.c,v $: $Revision: 1.239 $\n";
+const char *g_version_opentracker_c = "$Source: /home/cvsroot/opentracker/opentracker.c,v $: $Revision: 1.240 $\n";
diff --git a/ot_accesslist.c b/ot_accesslist.c
index 9757c73..75c094d 100644
--- a/ot_accesslist.c
+++ b/ot_accesslist.c
@@ -310,4 +310,4 @@ int accesslist_isblessed( ot_ip6 ip, ot_permissions permissions ) {
return 0;
}
-const char *g_version_accesslist_c = "$Source: /home/cvsroot/opentracker/ot_accesslist.c,v $: $Revision: 1.31 $\n";
+const char *g_version_accesslist_c = "$Source: /home/cvsroot/opentracker/ot_accesslist.c,v $: $Revision: 1.32 $\n";
diff --git a/ot_accesslist.h b/ot_accesslist.h
index a1e4ad2..b38b91a 100644
--- a/ot_accesslist.h
+++ b/ot_accesslist.h
@@ -3,8 +3,8 @@
$id$ */
-#ifndef __OT_ACCESSLIST_H__
-#define __OT_ACCESSLIST_H__
+#ifndef OT_ACCESSLIST_H__
+#define OT_ACCESSLIST_H__
#if defined ( WANT_ACCESSLIST_BLACK ) && defined (WANT_ACCESSLIST_WHITE )
# error WANT_ACCESSLIST_BLACK and WANT_ACCESSLIST_WHITE are exclusive.
diff --git a/ot_clean.c b/ot_clean.c
index f9ca740..4f44f28 100644
--- a/ot_clean.c
+++ b/ot_clean.c
@@ -136,4 +136,4 @@ void clean_deinit( void ) {
pthread_cancel( thread_id );
}
-const char *g_version_clean_c = "$Source: /home/cvsroot/opentracker/ot_clean.c,v $: $Revision: 1.21 $\n";
+const char *g_version_clean_c = "$Source: /home/cvsroot/opentracker/ot_clean.c,v $: $Revision: 1.22 $\n";
diff --git a/ot_clean.h b/ot_clean.h
index cb450c4..956770a 100644
--- a/ot_clean.h
+++ b/ot_clean.h
@@ -3,8 +3,8 @@
$id$ */
-#ifndef __OT_CLEAN_H__
-#define __OT_CLEAN_H__
+#ifndef OT_CLEAN_H__
+#define OT_CLEAN_H__
/* The amount of time a clean cycle should take */
#define OT_CLEAN_INTERVAL_MINUTES 2
diff --git a/ot_fullscrape.c b/ot_fullscrape.c
index 39fc270..8635ca5 100644
--- a/ot_fullscrape.c
+++ b/ot_fullscrape.c
@@ -175,6 +175,10 @@ static void fullscrape_make( int *iovec_entries, struct iovec **iovector, ot_tas
to_hex( r, *hash ); r+= 2 * sizeof(ot_hash);
r += sprintf( r, ":%zd:%zd\n", peer_list->seed_count, peer_list->peer_count-peer_list->seed_count );
break;
+ case TASK_FULLSCRAPE_TPB_ASCII_PLUS:
+ to_hex( r, *hash ); r+= 2 * sizeof(ot_hash);
+ r += sprintf( r, ":%zd:%zd:%zd\n", peer_list->seed_count, peer_list->peer_count-peer_list->seed_count, peer_list->down_count );
+ break;
case TASK_FULLSCRAPE_TPB_BINARY:
memcpy( r, *hash, sizeof(ot_hash) ); r += sizeof(ot_hash);
*(uint32_t*)(r+0) = htonl( (uint32_t) peer_list->seed_count );
@@ -242,4 +246,4 @@ static void fullscrape_make( int *iovec_entries, struct iovec **iovector, ot_tas
}
#endif
-const char *g_version_fullscrape_c = "$Source: /home/cvsroot/opentracker/ot_fullscrape.c,v $: $Revision: 1.36 $\n";
+const char *g_version_fullscrape_c = "$Source: /home/cvsroot/opentracker/ot_fullscrape.c,v $: $Revision: 1.37 $\n";
diff --git a/ot_fullscrape.h b/ot_fullscrape.h
index b86f8ea..0f920ec 100644
--- a/ot_fullscrape.h
+++ b/ot_fullscrape.h
@@ -3,8 +3,8 @@
$id$ */
-#ifndef __OT_FULLSCRAPE_H__
-#define __OT_FULLSCRAPE_H__
+#ifndef OT_FULLSCRAPE_H__
+#define OT_FULLSCRAPE_H__
#ifdef WANT_FULLSCRAPE
diff --git a/ot_http.c b/ot_http.c
index 46352be..9dd8c4d 100644
--- a/ot_http.c
+++ b/ot_http.c
@@ -184,7 +184,7 @@ static const ot_keywords keywords_mode[] =
{ NULL, -3 } };
static const ot_keywords keywords_format[] =
{ { "bin", TASK_FULLSCRAPE_TPB_BINARY }, { "ben", TASK_FULLSCRAPE }, { "url", TASK_FULLSCRAPE_TPB_URLENCODED },
- { "txt", TASK_FULLSCRAPE_TPB_ASCII }, { NULL, -3 } };
+ { "txt", TASK_FULLSCRAPE_TPB_ASCII }, { "txtp", TASK_FULLSCRAPE_TPB_ASCII_PLUS }, { NULL, -3 } };
int mode = TASK_STATS_PEERS, scanon = 1, format = 0;
@@ -497,8 +497,8 @@ static ssize_t http_handle_announce( const int64 sock, struct ot_workstruct *ws,
return ws->reply_size = sprintf( ws->reply, "Successfully added.\n" );
//}
}
-#endif
break;
+#endif
case 9: /* matched "peer_id" */
/* ignore this, when we have less than 20 bytes */
if( scan_urlencoded_query( &read_ptr, write_ptr = read_ptr, SCAN_SEARCHPATH_VALUE ) != 20 ) HTTPERROR_400_PARAM;
@@ -632,4 +632,4 @@ ssize_t http_handle_request( const int64 sock, struct ot_workstruct *ws ) {
return ws->reply_size;
}
-const char *g_version_http_c = "$Source: /home/cvsroot/opentracker/ot_http.c,v $: $Revision: 1.55 $\n";
+const char *g_version_http_c = "$Source: /home/cvsroot/opentracker/ot_http.c,v $: $Revision: 1.56 $\n";
diff --git a/ot_http.h b/ot_http.h
index 7e367ed..b1a60e7 100644
--- a/ot_http.h
+++ b/ot_http.h
@@ -3,8 +3,8 @@
$id$ */
-#ifndef __OT_HTTP_H__
-#define __OT_HTTP_H__
+#ifndef OT_HTTP_H__
+#define OT_HTTP_H__
typedef enum {
STRUCT_HTTP_FLAG_WAITINGFORTASK = 1,
diff --git a/ot_iovec.c b/ot_iovec.c
index e5b8a8c..a0c1f2f 100644
--- a/ot_iovec.c
+++ b/ot_iovec.c
@@ -73,4 +73,4 @@ size_t iovec_length( int *iovec_entries, struct iovec **iovector ) {
return length;
}
-const char *g_version_iovec_c = "$Source: /home/cvsroot/opentracker/ot_iovec.c,v $: $Revision: 1.6 $\n";
+const char *g_version_iovec_c = "$Source: /home/cvsroot/opentracker/ot_iovec.c,v $: $Revision: 1.7 $\n";
diff --git a/ot_iovec.h b/ot_iovec.h
index 83a1a36..5dbe706 100644
--- a/ot_iovec.h
+++ b/ot_iovec.h
@@ -3,8 +3,8 @@
$id$ */
-#ifndef __OT_IOVEC_H__
-#define __OT_IOVEC_H__
+#ifndef OT_IOVEC_H__
+#define OT_IOVEC_H__
#include <sys/uio.h>
diff --git a/ot_livesync.c b/ot_livesync.c
index 8a910a7..a47655b 100644
--- a/ot_livesync.c
+++ b/ot_livesync.c
@@ -213,4 +213,4 @@ static void * livesync_worker( void * args ) {
}
#endif
-const char *g_version_livesync_c = "$Source: /home/cvsroot/opentracker/ot_livesync.c,v $: $Revision: 1.19 $\n";
+const char *g_version_livesync_c = "$Source: /home/cvsroot/opentracker/ot_livesync.c,v $: $Revision: 1.20 $\n";
diff --git a/ot_livesync.h b/ot_livesync.h
index 1a3ed45..d7490e5 100644
--- a/ot_livesync.h
+++ b/ot_livesync.h
@@ -3,8 +3,8 @@
$id$ */
-#ifndef __OT_LIVESYNC_H__
-#define __OT_LIVESYNC_H__
+#ifndef OT_LIVESYNC_H__
+#define OT_LIVESYNC_H__
#include "io.h"
#include "trackerlogic.h"
diff --git a/ot_mutex.c b/ot_mutex.c
index 9581141..e16db4f 100644
--- a/ot_mutex.c
+++ b/ot_mutex.c
@@ -333,4 +333,4 @@ void mutex_deinit( ) {
byte_zero( all_torrents, sizeof( all_torrents ) );
}
-const char *g_version_mutex_c = "$Source: /home/cvsroot/opentracker/ot_mutex.c,v $: $Revision: 1.23 $\n";
+const char *g_version_mutex_c = "$Source: /home/cvsroot/opentracker/ot_mutex.c,v $: $Revision: 1.24 $\n";
diff --git a/ot_mutex.h b/ot_mutex.h
index b0f0f0b..bd07009 100644
--- a/ot_mutex.h
+++ b/ot_mutex.h
@@ -3,8 +3,8 @@
$id$ */
-#ifndef __OT_MUTEX_H__
-#define __OT_MUTEX_H__
+#ifndef OT_MUTEX_H__
+#define OT_MUTEX_H__
#include <sys/uio.h>
@@ -47,8 +47,9 @@ typedef enum {
TASK_FULLSCRAPE = 0x0200, /* Default mode */
TASK_FULLSCRAPE_TPB_BINARY = 0x0201,
TASK_FULLSCRAPE_TPB_ASCII = 0x0202,
- TASK_FULLSCRAPE_TPB_URLENCODED = 0x0203,
- TASK_FULLSCRAPE_TRACKERSTATE = 0x0204,
+ TASK_FULLSCRAPE_TPB_ASCII_PLUS = 0x0203,
+ TASK_FULLSCRAPE_TPB_URLENCODED = 0x0204,
+ TASK_FULLSCRAPE_TRACKERSTATE = 0x0205,
TASK_DMEM = 0x0300,
diff --git a/ot_rijndael.c b/ot_rijndael.c
index 77a6546..2202be8 100644
--- a/ot_rijndael.c
+++ b/ot_rijndael.c
@@ -487,4 +487,4 @@ void rijndaelEncrypt128(const uint32_t rk[44], const uint8_t pt[16], uint8_t ct[
PUTU32(ct + 12, s3);
}
-const char *g_version_rijndael_c = "$Source: /home/cvsroot/opentracker/ot_rijndael.c,v $: $Revision: 1.2 $\n";
+const char *g_version_rijndael_c = "$Source: /home/cvsroot/opentracker/ot_rijndael.c,v $: $Revision: 1.3 $\n";
diff --git a/ot_rijndael.h b/ot_rijndael.h
index 7f57b3f..54725dc 100644
--- a/ot_rijndael.h
+++ b/ot_rijndael.h
@@ -9,12 +9,14 @@
$id$ */
-#ifndef __OT_RIJNDAEL_H__
-#define __OT_RIJNDAEL_H__
+#ifndef OT_RIJNDAEL_H__
+#define OT_RIJNDAEL_H__
#include <stdint.h>
int rijndaelKeySetupEnc128(uint32_t rk[44], const uint8_t cipherKey[] );
void rijndaelEncrypt128(const uint32_t rk[44], const uint8_t pt[16], uint8_t ct[16]);
+extern const char *g_version_rijndael_c;
+
#endif
diff --git a/ot_stats.c b/ot_stats.c
index 9cdcec1..d71a997 100644
--- a/ot_stats.c
+++ b/ot_stats.c
@@ -770,4 +770,4 @@ void stats_deinit( ) {
pthread_cancel( thread_id );
}
-const char *g_version_stats_c = "$Source: /home/cvsroot/opentracker/ot_stats.c,v $: $Revision: 1.75 $\n";
+const char *g_version_stats_c = "$Source: /home/cvsroot/opentracker/ot_stats.c,v $: $Revision: 1.76 $\n";
diff --git a/ot_stats.h b/ot_stats.h
index c73ebec..6a2515b 100644
--- a/ot_stats.h
+++ b/ot_stats.h
@@ -3,8 +3,8 @@
$id$ */
-#ifndef __OT_STATS_H__
-#define __OT_STATS_H__
+#ifndef OT_STATS_H__
+#define OT_STATS_H__
typedef enum {
EVENT_ACCEPT,
@@ -46,4 +46,7 @@ size_t stats_return_tracker_version( char *reply );
void stats_init( );
void stats_deinit( );
+extern const char *g_version_rijndael_c;
+extern const char *g_version_livesync_c;
+
#endif
diff --git a/ot_sync.c b/ot_sync.c
index 287cca9..33f9276 100644
--- a/ot_sync.c
+++ b/ot_sync.c
@@ -163,4 +163,4 @@ void sync_deliver( int64 socket ) {
#endif
-const char *g_version_sync_c = "$Source: /home/cvsroot/opentracker/ot_sync.c,v $: $Revision: 1.9 $\n";
+const char *g_version_sync_c = "$Source: /home/cvsroot/opentracker/ot_sync.c,v $: $Revision: 1.10 $\n";
diff --git a/ot_sync.h b/ot_sync.h
index 81d4d22..441010d 100644
--- a/ot_sync.h
+++ b/ot_sync.h
@@ -3,8 +3,8 @@
$id$ */
-#ifndef __OT_SYNC_H__
-#define __OT_SYNC_H__
+#ifndef OT_SYNC_H__
+#define OT_SYNC_H__
#ifdef WANT_SYNC_BATCH
enum { SYNC_IN, SYNC_OUT };
diff --git a/ot_udp.c b/ot_udp.c
index d543317..d090a3d 100644
--- a/ot_udp.c
+++ b/ot_udp.c
@@ -212,4 +212,4 @@ void udp_init( int64 sock, unsigned int worker_count ) {
pthread_create( &thread_id, NULL, udp_worker, (void *)sock );
}
-const char *g_version_udp_c = "$Source: /home/cvsroot/opentracker/ot_udp.c,v $: $Revision: 1.32 $\n";
+const char *g_version_udp_c = "$Source: /home/cvsroot/opentracker/ot_udp.c,v $: $Revision: 1.33 $\n";
diff --git a/ot_udp.h b/ot_udp.h
index a4f6ce0..974c727 100644
--- a/ot_udp.h
+++ b/ot_udp.h
@@ -3,8 +3,8 @@
$id$ */
-#ifndef __OT_UDP_H__
-#define __OT_UDP_H__
+#ifndef OT_UDP_H__
+#define OT_UDP_H__
void udp_init( int64 sock, unsigned int worker_count );
int handle_udp6( int64 serversocket, struct ot_workstruct *ws );
diff --git a/ot_vector.c b/ot_vector.c
index 0bd4621..6c7c9b0 100644
--- a/ot_vector.c
+++ b/ot_vector.c
@@ -263,4 +263,4 @@ void vector_fixup_peers( ot_vector * vector ) {
vector->data = realloc( vector->data, vector->space * sizeof( ot_peer ) );
}
-const char *g_version_vector_c = "$Source: /home/cvsroot/opentracker/ot_vector.c,v $: $Revision: 1.19 $\n";
+const char *g_version_vector_c = "$Source: /home/cvsroot/opentracker/ot_vector.c,v $: $Revision: 1.20 $\n";
diff --git a/ot_vector.h b/ot_vector.h
index 37135e7..f7f87aa 100644
--- a/ot_vector.h
+++ b/ot_vector.h
@@ -3,8 +3,8 @@
$id$ */
-#ifndef __OT_VECTOR_H__
-#define __OT_VECTOR_H__
+#ifndef OT_VECTOR_H__
+#define OT_VECTOR_H__
/* These defines control vectors behaviour */
#define OT_VECTOR_MIN_MEMBERS 2
diff --git a/proxy.c b/proxy.c
index a5a4a8c..6617af1 100644
--- a/proxy.c
+++ b/proxy.c
@@ -1,7 +1,7 @@
/* This software was written by Dirk Engling <erdgeist@erdgeist.org>
It is considered beerware. Prost. Skol. Cheers or whatever.
- $Id: proxy.c,v 1.16 2010/08/15 16:38:43 erdgeist Exp $ */
+ $Id: proxy.c,v 1.17 2018/01/29 17:46:15 erdgeist Exp $ */
/* System */
#include <stdint.h>
@@ -715,8 +715,7 @@ unlock_continue:
void *tmp = malloc( mem );
if( tmp ) {
memcpy( tmp, ptr, mem );
- if( !iob_addbuf_free( &g_connections[i].outdata, tmp, mem ) )
- free( tmp );
+ iob_addbuf_free( &g_connections[i].outdata, tmp, mem );
io_wantwrite( g_connections[i].fd );
}
}
diff --git a/scan_urlencoded_query.c b/scan_urlencoded_query.c
index ff50fd7..50f7e67 100644
--- a/scan_urlencoded_query.c
+++ b/scan_urlencoded_query.c
@@ -140,4 +140,4 @@ ssize_t scan_fixed_int( char *data, size_t len, int *tmp ) {
return len;
}
-const char *g_version_scan_urlencoded_query_c = "$Source: /home/cvsroot/opentracker/scan_urlencoded_query.c,v $: $Revision: 1.34 $\n";
+const char *g_version_scan_urlencoded_query_c = "$Source: /home/cvsroot/opentracker/scan_urlencoded_query.c,v $: $Revision: 1.35 $\n";
diff --git a/scan_urlencoded_query.h b/scan_urlencoded_query.h
index 92e3f34..06b91f5 100644
--- a/scan_urlencoded_query.h
+++ b/scan_urlencoded_query.h
@@ -3,8 +3,8 @@
$id$ */
-#ifndef __SCAN_URLENCODED_QUERY_H__
-#define __SCAN_URLENCODED_QUERY_H__
+#ifndef SCAN_URLENCODED_QUERY_H__
+#define SCAN_URLENCODED_QUERY_H__
#include <sys/types.h>
diff --git a/trackerlogic.c b/trackerlogic.c
index 524246a..e95b9e1 100644
--- a/trackerlogic.c
+++ b/trackerlogic.c
@@ -454,4 +454,4 @@ void trackerlogic_deinit( void ) {
mutex_deinit( );
}
-const char *g_version_trackerlogic_c = "$Source: /home/cvsroot/opentracker/trackerlogic.c,v $: $Revision: 1.138 $\n";
+const char *g_version_trackerlogic_c = "$Source: /home/cvsroot/opentracker/trackerlogic.c,v $: $Revision: 1.139 $\n";
diff --git a/trackerlogic.h b/trackerlogic.h
index 370782a..721ba6e 100644
--- a/trackerlogic.h
+++ b/trackerlogic.h
@@ -3,8 +3,8 @@
$id$ */
-#ifndef __OT_TRACKERLOGIC_H__
-#define __OT_TRACKERLOGIC_H__
+#ifndef OT_TRACKERLOGIC_H__
+#define OT_TRACKERLOGIC_H__
#include <sys/types.h>
#include <sys/time.h>