diff options
author | erdgeist <> | 2007-03-28 23:24:30 +0000 |
---|---|---|
committer | erdgeist <> | 2007-03-28 23:24:30 +0000 |
commit | 32ba028814d46796f8ffe011518697dfba0e0dad (patch) | |
tree | 02d15f73635b6ebd3329ef17b43c85979fd441ff | |
parent | 33774078ab5a3c37ded0c7cdf0324bafc690625f (diff) |
added the -A feature that blesses a certain IP address for administrative use (like sync)
-rw-r--r-- | opentracker.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/opentracker.c b/opentracker.c index 0ddce0c..d45fcf8 100644 --- a/opentracker.c +++ b/opentracker.c | |||
@@ -36,6 +36,7 @@ static unsigned int ot_overall_udp_successfulannounces = 0; | |||
36 | static time_t ot_start_time; | 36 | static time_t ot_start_time; |
37 | static const size_t SUCCESS_HTTP_HEADER_LENGTH = 80; | 37 | static const size_t SUCCESS_HTTP_HEADER_LENGTH = 80; |
38 | static const size_t SUCCESS_HTTP_SIZE_OFF = 17; | 38 | static const size_t SUCCESS_HTTP_SIZE_OFF = 17; |
39 | static char g_adminip[4] = {0,0,0,0}; | ||
39 | 40 | ||
40 | /* To always have space for error messages ;) */ | 41 | /* To always have space for error messages ;) */ |
41 | 42 | ||
@@ -561,6 +562,10 @@ static void handle_accept( const int64 serversocket ) { | |||
561 | 562 | ||
562 | byte_zero( h, sizeof( struct http_data ) ); | 563 | byte_zero( h, sizeof( struct http_data ) ); |
563 | memmove( h->ip, ip, sizeof( ip ) ); | 564 | memmove( h->ip, ip, sizeof( ip ) ); |
565 | |||
566 | if( ntohl(*(ot_dword*)&h->ip) == *(ot_dword*)g_adminip ) | ||
567 | h->blessed = 1; | ||
568 | |||
564 | io_setcookie( i, h ); | 569 | io_setcookie( i, h ); |
565 | 570 | ||
566 | ++ot_overall_tcp_connections; | 571 | ++ot_overall_tcp_connections; |
@@ -735,9 +740,10 @@ int main( int argc, char **argv ) { | |||
735 | int scanon = 1; | 740 | int scanon = 1; |
736 | 741 | ||
737 | while( scanon ) { | 742 | while( scanon ) { |
738 | switch( getopt( argc, argv, ":i:p:P:d:ocbBh" ) ) { | 743 | switch( getopt( argc, argv, ":i:p:A:P:d:ocbBh" ) ) { |
739 | case -1 : scanon = 0; break; | 744 | case -1 : scanon = 0; break; |
740 | case 'i': scan_ip4( optarg, serverip ); break; | 745 | case 'i': scan_ip4( optarg, serverip ); break; |
746 | case 'A': scan_ip4( optarg, g_adminip ); break; | ||
741 | case 'p': ot_try_bind( serverip, (uint16)atol( optarg ), 1 ); break; | 747 | case 'p': ot_try_bind( serverip, (uint16)atol( optarg ), 1 ); break; |
742 | case 'P': ot_try_bind( serverip, (uint16)atol( optarg ), 0 ); break; | 748 | case 'P': ot_try_bind( serverip, (uint16)atol( optarg ), 0 ); break; |
743 | case 'd': serverdir = optarg; break; | 749 | case 'd': serverdir = optarg; break; |