1
0
mirror of https://git.FreeBSD.org/ports.git synced 2025-01-08 06:48:28 +00:00

devel/jech-dht: Update to 0.25

PR:		233729
Submitted by:	mi@ALDAN.algebra.com (maintianer)
Reported by:	Dominik Lisiak <dominik.lisiak@bemsoft.pl>
This commit is contained in:
Steve Wills 2018-12-27 00:07:25 +00:00
parent 0a802cedc7
commit 7bd3cd7962
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=488494
4 changed files with 49 additions and 47 deletions

View File

@ -2,7 +2,7 @@
# $FreeBSD$
PORTNAME= dht
PORTVERSION= 0.22
PORTVERSION= 0.25
CATEGORIES= devel
MASTER_SITES= http://www.pps.univ-paris-diderot.fr/~jch/software/files/

View File

@ -1,2 +1,3 @@
SHA256 (dht-0.22.tar.gz) = a3452322648660da43cabd34cff8505d8f655e988f31c467535ad1992c29ac3d
SIZE (dht-0.22.tar.gz) = 27380
TIMESTAMP = 1543790466
SHA256 (dht-0.25.tar.gz) = 1e0fd849a780699212f13052a4c9812d0af6f524c9cbf70a65e92eb3580372f6
SIZE (dht-0.25.tar.gz) = 29198

View File

@ -3,24 +3,24 @@ one and MD5) at run-time, rather than at compile-time.
-mi
--- dht-example.c 2014-05-03 14:37:50.000000000 -0400
+++ dht-example.c 2014-05-04 21:34:58.000000000 -0400
--- dht-example.c 2018-02-09 16:44:37.000000000 -0500
+++ dht-example.c 2018-12-02 17:47:54.158580000 -0500
@@ -12,4 +12,5 @@
#include <fcntl.h>
#include <sys/time.h>
+#include <netinet/in.h>
#include <arpa/inet.h>
#include <sys/types.h>
@@ -17,4 +18,7 @@
#include <netdb.h>
@@ -18,4 +19,7 @@
#include <signal.h>
#include <sys/signal.h>
+#include <signal.h>
+#include <unistd.h>
+#include <md5.h>
#include "dht.h"
@@ -91,4 +95,11 @@
static unsigned char buf[4096];
@@ -115,4 +119,11 @@
+typedef void (hashing_method)(void *, int,
+ const void *, int,
@ -31,27 +31,25 @@ one and MD5) at run-time, rather than at compile-time.
+
int
main(int argc, char **argv)
@@ -112,9 +123,8 @@
memset(&sin6, 0, sizeof(sin6));
@@ -137,6 +148,8 @@
sin6.sin6_family = AF_INET6;
-
-
+ hasher = crypt_hash;
+ hasher = crypt_hash;
+
while(1) {
- opt = getopt(argc, argv, "q46b:i:");
+ opt = getopt(argc, argv, "q46b:i:m");
if(opt < 0)
break;
@@ -143,4 +153,6 @@
@@ -165,4 +178,6 @@
id_file = optarg;
break;
+ case 'm':
+ hasher = md5_hash;
default:
goto usage;
@@ -405,6 +417,7 @@
@@ -443,6 +458,7 @@
usage:
- printf("Usage: dht-example [-q] [-4] [-6] [-i filename] [-b address]...\n"
- " port [address port]...\n");
@ -60,13 +58,13 @@ one and MD5) at run-time, rather than at compile-time.
+ "(Use -m to use MD5 digest instead of crypt()-based one)\n");
exit(1);
}
@@ -420,25 +433,28 @@
@@ -465,25 +481,30 @@
/* We need to provide a reasonably strong cryptographic hashing function.
Here's how we'd do it if we had RSA's MD5 code. */
-#if 0
-void
+
void
-dht_hash(void *hash_return, int hash_size,
+static void
+md5_hash(void *hash_return, int hash_size,
const void *v1, int len1,
const void *v2, int len2,
@ -89,18 +87,18 @@ one and MD5) at run-time, rather than at compile-time.
+ } else {
+ unsigned char digest[16];
+ MD5Final(digest, &ctx);
+ memcpy(hash_return, digest, hash_size);
+ memcpy(hash_return, digest, hash_size);
+ }
}
-#else
/* But for this example, we might as well use something weaker. */
-void
+
/* But for this toy example, we might as well use something weaker. */
void
-dht_hash(void *hash_return, int hash_size,
+static void
+crypt_hash(void *hash_return, int hash_size,
const void *v1, int len1,
const void *v2, int len2,
@@ -460,5 +476,14 @@
@@ -505,5 +526,14 @@
strncpy(hash_return, crypt(key, "jc"), hash_size);
}
-#endif

View File

@ -1,20 +1,20 @@
--- dht.c 2011-07-25 17:59:36.000000000 -0400
+++ dht.c 2012-07-28 16:21:07.000000000 -0400
@@ -356,5 +356,5 @@
--- dht.c 2018-02-09 16:44:37.000000000 -0500
+++ dht.c 2018-12-02 18:00:11.873381000 -0500
@@ -365,5 +365,5 @@
switch(sa->sa_family) {
case AF_INET: {
- struct sockaddr_in *sin = (struct sockaddr_in*)sa;
+ const struct sockaddr_in *sin = (const struct sockaddr_in*)sa;
const unsigned char *address = (const unsigned char*)&sin->sin_addr;
return sin->sin_port == 0 ||
@@ -364,5 +364,5 @@
@@ -373,5 +373,5 @@
}
case AF_INET6: {
- struct sockaddr_in6 *sin6 = (struct sockaddr_in6*)sa;
+ const struct sockaddr_in6 *sin6 = (const struct sockaddr_in6*)sa;
const unsigned char *address = (const unsigned char*)&sin6->sin6_addr;
return sin6->sin6_port == 0 ||
@@ -1281,13 +1281,13 @@
@@ -1427,13 +1427,13 @@
int i, len;
struct storage *st;
- unsigned char *ip;
@ -33,7 +33,7 @@
+ ip = (const unsigned char*)&sin6->sin6_addr;
len = 16;
} else {
@@ -1406,15 +1406,15 @@
@@ -1552,15 +1552,15 @@
make_token(const struct sockaddr *sa, int old, unsigned char *token_return)
{
- void *ip;
@ -52,63 +52,66 @@
+ const struct sockaddr_in6 *sin6 = (const struct sockaddr_in6*)sa;
ip = &sin6->sin6_addr;
iplen = 16;
@@ -1892,5 +1892,5 @@
@@ -2038,5 +2038,5 @@
}
- if(((char*)buf)[buflen] != '\0') {
+ if(((const char*)buf)[buflen] != '\0') {
debugf("Unterminated message.\n");
errno = EINVAL;
@@ -2743,5 +2743,5 @@
@@ -2905,5 +2905,5 @@
#define CHECK(ptr, len) \
- if(((unsigned char*)ptr) + (len) > (buf) + (buflen)) goto overflow;
+ if(((const unsigned char*)ptr) + (len) > (buf) + (buflen)) goto overflow;
if(tid_return) {
@@ -2750,5 +2750,5 @@
@@ -2912,5 +2912,5 @@
long l;
char *q;
- l = strtol((char*)p + 3, &q, 10);
+ l = strtol((const char*)p + 3, &q, 10);
if(q && *q == ':' && l > 0 && l < *tid_len) {
CHECK(q + 1, l);
@@ -2782,5 +2782,5 @@
@@ -2944,5 +2944,5 @@
long l;
char *q;
- l = strtol((char*)p + 5, &q, 10);
+ l = strtol((const char*)p + 5, &q, 10);
- l = strtol((char*)p + 7, &q, 10);
+ l = strtol((const char*)p + 7, &q, 10);
if(q && *q == 'e' && l > 0 && l < 0x10000)
*port_return = l;
@@ -2804,5 +2804,5 @@
@@ -2957,5 +2957,5 @@
long l;
char *q;
- l = strtol((char*)p + 16, &q, 10);
+ l = strtol((const char*)p + 16, &q, 10);
if(q && *q == 'e' && l > 0 && l < 0x10000)
*implied_port_return = l;
@@ -2979,5 +2979,5 @@
long l;
char *q;
- l = strtol((char*)p + 7, &q, 10);
+ l = strtol((const char*)p + 7, &q, 10);
if(q && *q == ':' && l > 0 && l < *token_len) {
CHECK(q + 1, l);
@@ -2820,5 +2820,5 @@
@@ -2995,5 +2995,5 @@
long l;
char *q;
- l = strtol((char*)p + 7, &q, 10);
+ l = strtol((const char*)p + 7, &q, 10);
if(q && *q == ':' && l > 0 && l < *nodes_len) {
if(q && *q == ':' && l > 0 && l <= *nodes_len) {
CHECK(q + 1, l);
@@ -2836,5 +2836,5 @@
@@ -3011,5 +3011,5 @@
long l;
char *q;
- l = strtol((char*)p + 8, &q, 10);
+ l = strtol((const char*)p + 8, &q, 10);
if(q && *q == ':' && l > 0 && l < *nodes6_len) {
if(q && *q == ':' && l > 0 && l <= *nodes6_len) {
CHECK(q + 1, l);
@@ -2855,8 +2855,8 @@
@@ -3030,5 +3030,5 @@
long l;
char *q;
- l = strtol((char*)buf + i, &q, 10);
+ l = strtol((const char*)buf + i, &q, 10);
if(q && *q == ':' && l > 0) {
CHECK(q + 1, l);
- i = q + 1 + l - (char*)buf;
+ i = q + 1 + l - (const char*)buf;
if(l == 6) {
if(j + l > *values_len)