- use ${OSVERSION} instead of ${USE_INET6}
- fix memoly leak when using getaddrinfo() - support draft-ietf-drums-msg-fmt-07 Partly submitted by: Hideaki YOSHIFUJI <yoshfuji@ecei.tohoku.ac.jp> Approved by: maintainer
This commit is contained in:
parent
492e070206
commit
e563579165
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=25074
3 changed files with 106 additions and 4 deletions
|
@ -14,9 +14,6 @@ MASTER_SITES= ftp://ftp.leo.chubu.ac.jp/pub/network/mnews/
|
|||
MAINTAINER= seiken@ARGV.AC
|
||||
|
||||
WRKSRC= ${WRKDIR}/mnews-1.22/build
|
||||
.ifdef (USE_INET6)
|
||||
MAKE_ENV = USE_INET6=1
|
||||
.endif
|
||||
MAN1= mnews.1
|
||||
MANLANG= ja
|
||||
|
||||
|
@ -28,6 +25,12 @@ SAMPLES= _mnews.smp jnames.fj jnames.jp jnames.smp jnames.tnn
|
|||
GNSPOOL?= 0
|
||||
IMPUT?= 0
|
||||
|
||||
.include <bsd.port.pre.mk>
|
||||
|
||||
.if ${OSVERSION} >= 400014
|
||||
MAKE_ENV+= USE_INET6=yes
|
||||
.endif
|
||||
|
||||
do-configure:
|
||||
.for f in Makefile site_dep.h
|
||||
${SED} -e s+@PREFIX@+${PREFIX}+ \
|
||||
|
@ -72,4 +75,4 @@ post-install:
|
|||
@${ECHO} "Please refer to the files in:"
|
||||
@${ECHO} "${PREFIX}/share/doc/mnews & ${PREFIX}/share/examples/mnews."
|
||||
|
||||
.include <bsd.port.mk>
|
||||
.include <bsd.port.post.mk>
|
||||
|
|
57
japanese/mnews/files/patch-aa
Normal file
57
japanese/mnews/files/patch-aa
Normal file
|
@ -0,0 +1,57 @@
|
|||
--- ../tcplib/tcplib.c.orig Fri Dec 17 02:27:36 1999
|
||||
+++ ../tcplib/tcplib.c Sun Jan 16 07:37:37 2000
|
||||
@@ -12,7 +12,7 @@
|
||||
* Last Edit : 1999-12/17
|
||||
* Author : MSRS3 Âð´Ö ðý
|
||||
*
|
||||
- * IPv6 support: 1999-11/19,22,30 by H.YOSHIFUJI
|
||||
+ * IPv6 support: 1999-11/19,22,30, 12/04,16,24 by H.YOSHIFUJI
|
||||
*/
|
||||
|
||||
#include "compat.h"
|
||||
@@ -229,6 +229,7 @@
|
||||
memset(&hints, 0, sizeof(hints));
|
||||
hints.ai_family = PF_UNSPEC;
|
||||
hints.ai_socktype = SOCK_STREAM;
|
||||
+ res = res0 = NULL;
|
||||
gaierr = getaddrinfo(server_name, serv_buff, &hints, &res0);
|
||||
if (gaierr) {
|
||||
if ((gaierr == EAI_SERVICE) &&
|
||||
@@ -829,8 +830,7 @@
|
||||
*port++ = '\0';
|
||||
}
|
||||
#ifdef INET6
|
||||
- strncpy(hostport, host, sizeof(hostport));
|
||||
- hostport[sizeof(hostport) - 1] = '\0';
|
||||
+ strcpy(hostport, host); /* ok: strlen(hostport)+1 >= strlen(host)+1 */
|
||||
#endif /* INET6 */
|
||||
return(port);
|
||||
}
|
||||
@@ -862,7 +862,7 @@
|
||||
hints.ai_family = PF_UNSPEC;
|
||||
hints.ai_socktype = SOCK_STREAM;
|
||||
hints.ai_flags = AI_CANONNAME;
|
||||
-
|
||||
+ res0 = NULL;
|
||||
if (getaddrinfo(host, NULL, &hints, &res0) == 0) {
|
||||
s = res0->ai_canonname;
|
||||
}
|
||||
@@ -876,12 +876,16 @@
|
||||
if (canonname != (char*)NULL) {
|
||||
t = strncpy(canonname, s, length);
|
||||
} else {
|
||||
+#ifdef DONT_HAVE_STRDUP
|
||||
+ if (t = (s != (char *)NULL) ? ((char *)malloc(strlen(s)+1)) : (char *)NULL) strcpy(t,s);
|
||||
+#else
|
||||
t = strdup(s);
|
||||
+#endif
|
||||
}
|
||||
+ }
|
||||
#ifdef INET6
|
||||
- freeaddrinfo(res0);
|
||||
+ if(res0) freeaddrinfo(res0);
|
||||
#endif /* INET6 */
|
||||
- }
|
||||
return(t);
|
||||
}
|
||||
|
42
japanese/mnews/files/patch-ab
Normal file
42
japanese/mnews/files/patch-ab
Normal file
|
@ -0,0 +1,42 @@
|
|||
--- ../src/mnews.c.orig Wed Dec 15 00:29:56 1999
|
||||
+++ ../src/mnews.c Sun Jan 16 07:37:37 2000
|
||||
@@ -2870,8 +2870,17 @@
|
||||
}
|
||||
dates = next_param(dates);
|
||||
*year = atoi(dates); /* 年 */
|
||||
- if ((*year > 0) && (*year < 1000)) {
|
||||
- *year += 1900;
|
||||
+ if ((*year >= 0) && (*year < 1000)){
|
||||
+#ifdef Y2K_DONT_CONVERT_YEAR_00XX
|
||||
+ for (i = 0; i < 5; i++)
|
||||
+ if (dates[i] == '\0' || !isdigit(dates[i])) break;
|
||||
+ if (i < 4){
|
||||
+#endif
|
||||
+ /* [Y2K] 1~3桁年表示日付変換 */
|
||||
+ *year += (*year < 50) ? 2000 : 1900; /* draft-ietf-drums-msg-fmt-07 */
|
||||
+#ifdef Y2K_DONT_CONVERT_YEAR_00XX
|
||||
+ }
|
||||
+#endif
|
||||
}
|
||||
dates = next_param(dates);
|
||||
} else { /* Date, Day Month Year Time Zone */
|
||||
@@ -2885,8 +2894,17 @@
|
||||
}
|
||||
dates = next_param(dates);
|
||||
*year = atoi(dates); /* 年 */
|
||||
- if ((*year > 0) && (*year < 1000)) {
|
||||
- *year += 1900;
|
||||
+ if ((*year >= 0) && (*year < 1000)){
|
||||
+#ifdef Y2K_DONT_CONVERT_YEAR_00XX
|
||||
+ for (i = 0; i < 5; i++)
|
||||
+ if (dates[i] == '\0' || !isdigit(dates[i])) break;
|
||||
+ if (i < 4){
|
||||
+#endif
|
||||
+ /* [Y2K] 1~3桁年表示日付変換 */
|
||||
+ *year += (*year < 50) ? 2000 : 1900; /* draft-ietf-drums-msg-fmt-07 */
|
||||
+#ifdef Y2K_DONT_CONVERT_YEAR_00XX
|
||||
+ }
|
||||
+#endif
|
||||
}
|
||||
dates = next_param(dates);
|
||||
*hour = atoi(dates); /* 時 */
|
Loading…
Reference in a new issue