1 |
matsuu 10/05/28 15:58:43 |
2 |
|
3 |
Added: ruby-tcpwrap-0.6-ruby19.patch |
4 |
Log: |
5 |
Convert to ruby-ng. |
6 |
(Portage version: 2.1.8.3/cvs/Linux x86_64) |
7 |
|
8 |
Revision Changes Path |
9 |
1.1 dev-ruby/ruby-tcpwrap/files/ruby-tcpwrap-0.6-ruby19.patch |
10 |
|
11 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-ruby/ruby-tcpwrap/files/ruby-tcpwrap-0.6-ruby19.patch?rev=1.1&view=markup |
12 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-ruby/ruby-tcpwrap/files/ruby-tcpwrap-0.6-ruby19.patch?rev=1.1&content-type=text/plain |
13 |
|
14 |
Index: ruby-tcpwrap-0.6-ruby19.patch |
15 |
=================================================================== |
16 |
diff -Naur ruby-tcpwrap.orig//tcpwrap.c ruby-tcpwrap//tcpwrap.c |
17 |
--- ruby-tcpwrap.orig//tcpwrap.c 2003-08-20 12:30:10.000000000 +0900 |
18 |
+++ ruby-tcpwrap//tcpwrap.c 2010-05-28 08:08:49.000000000 +0900 |
19 |
@@ -25,7 +25,11 @@ |
20 |
*/ |
21 |
|
22 |
#include "ruby.h" |
23 |
+#ifdef HAVE_RUBY_IO_H |
24 |
+#include "ruby/io.h" |
25 |
+#else |
26 |
#include "rubyio.h" |
27 |
+#endif |
28 |
#include <sys/types.h> |
29 |
#include <sys/socket.h> |
30 |
#include <netinet/in.h> |
31 |
@@ -46,6 +50,10 @@ |
32 |
|
33 |
#define DEFAULT_RFC1413_QUERY_TIMEOUT 30 |
34 |
|
35 |
+#ifndef RSTRING_PTR |
36 |
+#define RSTRING_PTR(str) RSTRING(str)->ptr |
37 |
+#endif |
38 |
+ |
39 |
int allow_severity = 0; |
40 |
int deny_severity = 0; |
41 |
|
42 |
@@ -101,7 +109,7 @@ |
43 |
tcp_wrapper_t *tcpd; |
44 |
VALUE sock; |
45 |
int sockfd; |
46 |
- OpenFile *fptr; |
47 |
+ rb_io_t *fptr; |
48 |
struct sockaddr_storage addr; |
49 |
char client_name[NI_MAXHOST] = STRING_UNKNOWN; |
50 |
char client_addr[NI_MAXHOST] = STRING_UNKNOWN; |
51 |
@@ -113,7 +121,11 @@ |
52 |
again: |
53 |
sock = rb_funcall(tcpd->server, rb_intern("accept"), 0); |
54 |
GetOpenFile(sock, fptr); |
55 |
+#ifdef HAVE_RUBY_IO_H |
56 |
+ sockfd = fileno(fptr->fd); |
57 |
+#else |
58 |
sockfd = fileno(fptr->f); |
59 |
+#endif |
60 |
if (getpeername(sockfd, (struct sockaddr*) &addr, &len) < 0) |
61 |
rb_sys_fail("getpeername(2)"); |
62 |
error = getnameinfo((struct sockaddr*) &addr, len, |
63 |
@@ -132,7 +144,7 @@ |
64 |
if (tcpd->ident_lookup) |
65 |
client_user = ident_id(sockfd, tcpd->ident_timeout); |
66 |
#endif |
67 |
- if (!hosts_ctl(RSTRING(tcpd->daemon)->ptr, |
68 |
+ if (!hosts_ctl(RSTRING_PTR(tcpd->daemon), |
69 |
client_name, |
70 |
client_addr, |
71 |
(client_user == NULL) ? STRING_UNKNOWN : client_user)) { |
72 |
@@ -157,7 +169,7 @@ |
73 |
static char hosts_allow[MAXPATHLEN]; |
74 |
|
75 |
Check_SafeStr(s); |
76 |
- snprintf(hosts_allow, sizeof(hosts_allow), "%s", RSTRING(s)->ptr); |
77 |
+ snprintf(hosts_allow, sizeof(hosts_allow), "%s", RSTRING_PTR(s)); |
78 |
if(access(hosts_allow, R_OK) < 0) |
79 |
rb_warning("cannot read %s", hosts_allow); |
80 |
hosts_allow_table = hosts_allow; |
81 |
@@ -177,7 +189,7 @@ |
82 |
static char hosts_deny[MAXPATHLEN]; |
83 |
|
84 |
Check_SafeStr(s); |
85 |
- snprintf(hosts_deny, sizeof(hosts_deny), "%s", RSTRING(s)->ptr); |
86 |
+ snprintf(hosts_deny, sizeof(hosts_deny), "%s", RSTRING_PTR(s)); |
87 |
if(access(hosts_deny, R_OK) < 0) |
88 |
rb_warning("cannot read %s", hosts_deny); |
89 |
hosts_deny_table = hosts_deny; |
90 |
@@ -196,7 +208,7 @@ |
91 |
{ |
92 |
if(NIL_P(s)) return STRING_UNKNOWN; |
93 |
Check_Type(s, T_STRING); |
94 |
- return RSTRING(s)->ptr; |
95 |
+ return RSTRING_PTR(s); |
96 |
} |
97 |
|
98 |
static VALUE |