From 8471f75d4c8e558e1ea2cace3e3fe9145c53b50a Mon Sep 17 00:00:00 2001 From: mikeh Date: Wed, 12 Dec 2001 21:48:34 +0000 Subject: Fix for seg. fault and remove multi-character constants. Bump port revision. Submitted by: Sergey Mukhin --- net-p2p/napshare/Makefile | 1 + net-p2p/napshare/files/patch-aa | 119 ++++++++++++++++++++++++++++++++++++++++ net-p2p/napshare/files/patch-ab | 31 +++++++++++ 3 files changed, 151 insertions(+) create mode 100644 net-p2p/napshare/files/patch-ab (limited to 'net-p2p/napshare') diff --git a/net-p2p/napshare/Makefile b/net-p2p/napshare/Makefile index 706c571..b69638c 100644 --- a/net-p2p/napshare/Makefile +++ b/net-p2p/napshare/Makefile @@ -7,6 +7,7 @@ PORTNAME= napshare PORTVERSION= 0.1 +PORTREVISION= 1 CATEGORIES= net MASTER_SITES= ${MASTER_SITE_SOURCEFORGE} MASTER_SITE_SUBDIR= napshare diff --git a/net-p2p/napshare/files/patch-aa b/net-p2p/napshare/files/patch-aa index c498607..9468ac4 100644 --- a/net-p2p/napshare/files/patch-aa +++ b/net-p2p/napshare/files/patch-aa @@ -8,3 +8,122 @@ #include "interface.h" #include "support.h" +--- src/search.c.orig Fri May 25 18:52:42 2001 ++++ src/search.c Wed Dec 12 16:33:52 2001 +@@ -14,17 +14,17 @@ + + // Known Vendor Codes for reference + +-#define BearShareType 'BEAR' +-#define GnotellaType 'GNOT' +-#define GnucleusType 'GNUC' +-#define LimeWireType 'LIME' +-#define MactellaType 'MACT' +-#define ToadNodeType 'TOAD' +-#define GnutType 'GNUT' +-#define GtkGnutellaType 'GTKG' +-#define NapShareType 'NAPS' ++#define BearShareType "BEAR" ++#define GnotellaType "GNOT" ++#define GnucleusType "GNUC" ++#define LimeWireType "LIME" ++#define MactellaType "MACT" ++#define ToadNodeType "TOAD" ++#define GnutType "GNUT" ++#define GtkGnutellaType "GTKG" ++#define NapShareType "NAPS" + // Open Cola Folders Client +-#define OCFoldersType 'OCFG' ++#define OCFoldersType "OCFG" + + // some temp strings + static gchar stmp_1[4096]; +@@ -907,15 +907,13 @@ + GSList *l, *next; + gchar *titles[5], info[400], vendor[100], temp[6]; + struct record *rc; +- guint32 row,i,t; ++ guint32 row,i; + + vendor[0] = 0; + rs->status = 0; +- if (rs->trailer) { // we have trailer information, decode the vendor specific info +- READ_GUINT32_BE((rs->trailer + 1), t); // put it into a int for easy compare +- switch (t) // remember to skip rs->trailer length byte at [0] +- { +- case GtkGnutellaType: // got Gtk-Gnutella trailer, handle it ++ if (rs->trailer) { ++ // we have trailer information, decode the vendor specific info ++ if ( !strncasecmp ( rs->trailer + 1, GtkGnutellaType, 4 )) { + strcat(vendor,"GtkGnut"); // format bit 3= has uploaded, 2= busy, 0= need push + rs->status = rs->status | 0x80; // bit 7, known vendor flag + if ((rs->trailer[5] == 1) && (rs->trailer[6] & 0x04)) +@@ -923,54 +921,48 @@ + if ((rs->trailer[5] > 0) && (rs->trailer[6] & 0x01)) + rs->status = rs->status | 0x01; // bit 0, firewall flag + // if (dbg > 4) printf("TRAILER=%.4X\n",rs->status); // use for testing +- break; + +- case NapShareType: // got NapShare trailer, handle it ++ } else if ( !strncasecmp ( rs->trailer + 1, NapShareType, 4 )) { + strcat(vendor,"NapShare"); // format bit 3= has uploaded, 2= busy, 0= need push + rs->status = rs->status | 0x80; // bit 7, known vendor flag + if ((rs->trailer[5] == 1) && (rs->trailer[6] & 0x04)) + rs->status = rs->status | 0x02; // bit 1, busy flag + if ((rs->trailer[5] > 0) && (rs->trailer[6] & 0x01)) + rs->status = rs->status | 0x01; // bit 0, firewall flag +- break; + +- case LimeWireType: // got LimeWire trailer, handle it ++ } else if ( !strncasecmp ( rs->trailer + 1, LimeWireType, 4 )) { + strcat(vendor,"Lime"); // Not sure, but should be like bearshare + rs->status = rs->status | 0x80; // bit 7, known vendor flag + if ((rs->trailer[5] == 2) && (rs->trailer[7] & 0x04)) + rs->status = rs->status | 0x02; // bit 1, busy flag + if ((rs->trailer[5] > 0) && (rs->trailer[6] & 0x01)) + rs->status = rs->status | 0x01; // bit 0, firewall flag +- break; + +- case BearShareType: // got Bearshare trailer, handle it ++ } else if ( !strncasecmp ( rs->trailer + 1, BearShareType, 4 )) { + strcat(vendor,"Bear"); // Protocol doc says how to decode the bytes, but I cheat + rs->status = rs->status | 0x80; // bit 7, known vendor flag + if ((rs->trailer[5] == 2) && (rs->trailer[7] & 0x04)) + rs->status = rs->status | 0x02; // bit 1, busy flag + if ((rs->trailer[5] > 0) && (rs->trailer[6] & 0x01)) + rs->status = rs->status | 0x01; // bit 0, firewall flag +- break; + +- case GnotellaType: // got Gnotella trailer, handle it ++ } else if ( !strncasecmp ( rs->trailer + 1, GnotellaType, 4 )) { + strcat(vendor,"Gnot"); // same as bearshare + rs->status = rs->status | 0x80; // bit 7, known vendor flag + if ((rs->trailer[5] == 2) && (rs->trailer[7] & 0x04)) + rs->status = rs->status | 0x02; // bit 1, busy flag + if ((rs->trailer[5] > 0) && (rs->trailer[6] & 0x01)) + rs->status = rs->status | 0x01; // bit 0, firewall flag +- break; + +- case GnucleusType: // got Gnucleus trailer, handle it ++ } else if ( !strncasecmp ( rs->trailer + 1, GnucleusType, 4 )) { + strcat(vendor,"Gnuc"); // same as bearshare + rs->status = rs->status | 0x80; // bit 7, known vendor flag + if ((rs->trailer[5] == 2) && (rs->trailer[7] & 0x04)) + rs->status = rs->status | 0x02; // bit 1, busy flag + if ((rs->trailer[5] > 0) && (rs->trailer[6] & 0x01)) + rs->status = rs->status | 0x01; // bit 0, firewall flag +- break; + +- default: ++ } else { + temp[0] = 0; + for (i=0;i<4;i++) { // unknown type, do we have all alpha ? + if (isalpha(rs->trailer[i+1])) temp[i] = rs->trailer[i+1]; +@@ -981,7 +973,6 @@ + } + temp[4] = 0; // terminate + strcat(vendor,temp); +- break; + } // close switch statement + } // if trailer + if (rs->status & 0x02) strcat(vendor,",Busy"); diff --git a/net-p2p/napshare/files/patch-ab b/net-p2p/napshare/files/patch-ab new file mode 100644 index 0000000..5cecf86 --- /dev/null +++ b/net-p2p/napshare/files/patch-ab @@ -0,0 +1,31 @@ +--- src/downloads.c.orig Sat May 26 23:20:32 2001 ++++ src/downloads.c Wed Dec 12 16:27:46 2001 +@@ -241,7 +241,8 @@ + + d->last_update = time((time_t *) NULL); + +- d->remove_msg = reason; ++ if (reason != NULL) ++ d->remove_msg = g_strdup(reason); + + if (IS_DOWNLOAD_VISIBLE(d)) gui_update_download(d, TRUE); + +@@ -521,6 +522,7 @@ + + g_free(d->path); + g_free(d->file_name); ++ g_free(d->remove_msg); + g_free(d); + } + +--- src/gnutella.h.orig Wed Dec 12 16:43:41 2001 ++++ src/gnutella.h Wed Dec 12 16:43:53 2001 +@@ -274,7 +274,7 @@ + guint32 timeout_delay; + guint restart_timer_id; + +- const gchar *remove_msg; ++ gchar *remove_msg; + + guint32 ip; + guint16 port; -- cgit v1.1