Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 293992 Details for
Bug 198467
Package timidity++ lacks IPv6 support
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
TiMidity++ IPv6 Patch (ver. 2.13.2)
TiMidity++-2.13.2-ipv6.patch (text/plain), 11.64 KB, created by
Milan Zázrivec
on 2008-02-05 12:08:40 UTC
(
hide
)
Description:
TiMidity++ IPv6 Patch (ver. 2.13.2)
Filename:
MIME Type:
Creator:
Milan Zázrivec
Created:
2008-02-05 12:08:40 UTC
Size:
11.64 KB
patch
obsolete
>diff -up TiMidity++-2.13.2/utils/net.c.ipv6 TiMidity++-2.13.2/utils/net.c >--- TiMidity++-2.13.2/utils/net.c.ipv6 2002-07-19 02:46:14.000000000 +0200 >+++ TiMidity++-2.13.2/utils/net.c 2008-02-01 14:44:46.000000000 +0100 >@@ -58,7 +58,9 @@ > SOCKET open_socket(char *host, unsigned short port) > { > SOCKET fd; >- struct sockaddr_in in; >+ struct addrinfo hints, *result, *rp; >+ char service[NI_MAXSERV]; >+ int s; > > #if defined(WINSOCK) > static int first = 1; >@@ -69,27 +71,33 @@ SOCKET open_socket(char *host, unsigned > } > #endif > >- memset(&in, 0, sizeof(in)); >- if((in.sin_addr.s_addr = inet_addr(host)) == INADDR_NONE) >- { >- struct hostent *hp; >- if((hp = gethostbyname(host)) == NULL) >- return (SOCKET)-1; >- memcpy(&in.sin_addr, hp->h_addr, hp->h_length); >- } >- in.sin_port = htons(port); >- in.sin_family = AF_INET; >+ memset(&hints, 0, sizeof(struct addrinfo)); >+ hints.ai_family = AF_UNSPEC; >+ hints.ai_socktype = SOCK_STREAM; >+ hints.ai_flags = AI_ADDRCONFIG; >+ >+ snprintf(service, sizeof(service), "%d", port); > >- if((fd = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) == INVALID_SOCKET) >- return (SOCKET)-1; >+ s = getaddrinfo(host, service, &hints, &result); > >- if(connect(fd, (struct sockaddr *)&in, sizeof(in)) == SOCKET_ERROR) >+ if (s) >+ return (SOCKET)-1; >+ >+ for (rp = result; rp != NULL; rp = rp->ai_next) > { >- closesocket(fd); >- return (SOCKET)-1; >+ fd = socket(rp->ai_family, rp->ai_socktype, rp->ai_protocol); >+ >+ if (fd != -1 && connect(fd, rp->ai_addr, rp->ai_addrlen) != -1) >+ break; >+ >+ if (fd != -1) { >+ close(fd); >+ fd = -1; >+ } > } > >- return fd; >+ freeaddrinfo(result); >+ return (SOCKET) fd; > } > > #if !defined(__W32__) || defined(__CYGWIN32__) >diff -up TiMidity++-2.13.2/libarc/url_news.c.ipv6 TiMidity++-2.13.2/libarc/url_news.c >--- TiMidity++-2.13.2/libarc/url_news.c.ipv6 2002-07-19 02:09:22.000000000 +0200 >+++ TiMidity++-2.13.2/libarc/url_news.c 2008-02-01 14:44:46.000000000 +0100 >@@ -288,8 +288,17 @@ URL url_news_open(char *name) > buff[sizeof(buff) - 1] = '\0'; > > host = buff; >- for(p = host; *p && *p != ':' && *p != '/'; p++) >- ; >+ if (host[0] == '[') >+ { >+ if (!(p = strchr(host, ']'))) >+ return NULL; >+ *p = '\0'; >+ ++host; >+ ++p; >+ } else >+ for(p = host; *p && *p != ':' && *p != '/'; p++) >+ ; >+ > if(*p == ':') > { > *p++ = '\0'; /* terminate `host' string */ >diff -up TiMidity++-2.13.2/libarc/url_ftp.c.ipv6 TiMidity++-2.13.2/libarc/url_ftp.c >--- TiMidity++-2.13.2/libarc/url_ftp.c.ipv6 2002-01-15 11:53:19.000000000 +0100 >+++ TiMidity++-2.13.2/libarc/url_ftp.c 2008-02-01 14:44:46.000000000 +0100 >@@ -234,6 +234,14 @@ URL url_ftp_open(char *name) > *passwd++ = '\0'; > } > >+ if (host[0] == '[') >+ { >+ if (!(p = strchr(host, ']'))) >+ return NULL; >+ *p = '\0'; >+ ++host; >+ } >+ > #ifdef DEBUG > printf("open(host=`%s', port=`%d')\n", host, port); > #endif /* DEBUG */ >diff -up TiMidity++-2.13.2/libarc/url_http.c.ipv6 TiMidity++-2.13.2/libarc/url_http.c >--- TiMidity++-2.13.2/libarc/url_http.c.ipv6 2002-01-15 11:53:19.000000000 +0100 >+++ TiMidity++-2.13.2/libarc/url_http.c 2008-02-01 14:44:46.000000000 +0100 >@@ -133,8 +133,15 @@ URL url_http_open(char *name) > p = name; > if(strncmp(p, "http://", 7) == 0) > p += 7; >- for(q = p; *q && *q != ':' && *q != '/'; q++) >- ; >+ if (p[0] == '[') >+ { >+ if (!(q = strchr(p, ']'))) >+ return NULL; >+ *q = '\0'; >+ ++p; >+ } else >+ for(q = p; *q && *q != ':' && *q != '/'; q++) >+ ; > len = q - p; > if(len >= sizeof(wwwserver) - 1) { /* What?? */ > strcpy(wwwserver, "localhost"); >@@ -158,8 +165,18 @@ URL url_http_open(char *name) > memcpy(buff, name, n + 1); > > host = buff; >- for(p = host; *p && *p != ':' && *p != '/'; p++) >- ; >+ >+ if (host[0] == '[') >+ { >+ if (!(p = strchr(host, ']'))) >+ return NULL; >+ *p = '\0'; >+ ++host; >+ ++p; >+ } else >+ for(p = host; *p && *p != ':' && *p != '/'; p++) >+ ; >+ > if(*p == ':') > { > char *pp; >diff -up TiMidity++-2.13.2/interface/server_c.c.ipv6 TiMidity++-2.13.2/interface/server_c.c >--- TiMidity++-2.13.2/interface/server_c.c.ipv6 2004-09-27 01:40:13.000000000 +0200 >+++ TiMidity++-2.13.2/interface/server_c.c 2008-02-01 14:44:46.000000000 +0100 >@@ -50,6 +50,7 @@ > #include <sys/socket.h> > #include <sys/time.h> > #include <netinet/in.h> >+#include <netdb.h> > #ifndef NO_STRING_H > #include <string.h> > #else >@@ -227,7 +228,7 @@ static double start_time; > static int tmr_running; > > static int is_system_prefix = 0; >-static struct sockaddr_in control_client; >+static struct sockaddr_storage control_client; > static double low_time_at = 0.3; > static double high_time_at = 0.5; > static FILE *outfp; >@@ -294,34 +295,58 @@ static void ctl_event(CtlEvent *e) > > static int pasv_open(int *port) > { >- int sfd; >- struct sockaddr_in server; >+ int sfd, s; >+ struct sockaddr_storage server; >+ struct addrinfo hints, *result, *rp; >+ char service[NI_MAXSERV]; > >- if((sfd = socket(AF_INET, SOCK_STREAM, 0)) < 0) >+ memset(&hints, 0, sizeof(struct addrinfo)); >+ hints.ai_family = AF_UNSPEC; >+ hints.ai_socktype = SOCK_STREAM; >+ hints.ai_flags = AI_PASSIVE; >+ >+ sprintf(service, "%d", *port); >+ >+ s = getaddrinfo(NULL, service, &hints, &result); >+ if (s) > { >- perror("socket"); >- return -1; >+ fprintf(stderr, "getaddrinfo ", gai_strerror(s)); >+ return -1; > } > >- memset(&server, 0, sizeof(server)); >- server.sin_port = htons(*port); >- server.sin_family = AF_INET; >- server.sin_addr.s_addr = htonl(INADDR_ANY); >+ for (rp = result; rp != NULL; rp = rp->ai_next) >+ { >+ sfd = socket(rp->ai_family, rp->ai_socktype, rp->ai_protocol); >+ >+ if (sfd == -1) >+ continue; > > #ifdef SO_REUSEADDR >- { >- int on = 1; >- setsockopt(sfd, SOL_SOCKET, SO_REUSEADDR, (caddr_t)&on, sizeof(on)); >- } >+ { >+ int on = 1; >+ setsockopt(sfd, SOL_SOCKET, SO_REUSEADDR, (caddr_t)&on, sizeof(on)); >+ } > #endif /* SO_REUSEADDR */ > >- ctl.cmsg(CMSG_INFO, VERB_DEBUG, "Bind TCP/IP port=%d", *port); >- if(bind(sfd, (struct sockaddr *)&server, sizeof(server)) < 0) >+ ctl.cmsg(CMSG_INFO, VERB_DEBUG, "Bind TCP/IP port=%d", *port); >+ if (bind(sfd, rp->ai_addr, rp->ai_addrlen) != 0) { >+ perror("bind"); >+ close(sfd); >+ } else >+ break; >+ >+ close(sfd); >+ } >+ >+ if (rp == NULL) > { >- perror("bind"); >- close(sfd); >- return -1; >+ fprintf(stderr, "Could not bind\n"); >+ freeaddrinfo(result); >+ return -1; > } >+ >+ freeaddrinfo(result); >+ > if(*port == 0) > { > int len = sizeof(server); >@@ -331,7 +356,17 @@ static int pasv_open(int *port) > close(sfd); > return -1; > } >- *port = ntohs(server.sin_port); >+ >+ /* Not quite protocol independent */ >+ switch (((struct sockaddr *) &server)->sa_family) >+ { >+ case AF_INET: >+ *port = ntohs(((struct sockaddr_in *) &server)->sin_port); >+ break; >+ case AF_INET6: >+ *port = ntohs(((struct sockaddr_in6 *) &server)->sin6_port); >+ break; >+ } > } > > /* Set it up to wait for connections. */ >@@ -847,7 +882,7 @@ static int cmd_help(int argc, char **arg > static int cmd_open(int argc, char **argv) > { > int sock; >- struct sockaddr_in in; >+ struct sockaddr_storage in; > int addrlen; > int port; > >@@ -881,8 +916,20 @@ static int cmd_open(int argc, char **arg > } > close(sock); > >- if(control_client.sin_addr.s_addr != in.sin_addr.s_addr) >- return send_status(513, "Security violation: Address mismatch"); >+ /* Not quite protocol independent */ >+ switch (((struct sockaddr *) &control_client)->sa_family) >+ { >+ case AF_INET: >+ if (((struct sockaddr_in *) &control_client)->sin_addr.s_addr != >+ ((struct sockaddr_in *) &in)->sin_addr.s_addr) >+ return send_status(513, "Security violation: Address mismatch"); >+ break; >+ case AF_INET6: >+ if (((struct sockaddr_in6 *) &control_client)->sin6_addr.s6_addr != >+ ((struct sockaddr_in6 *) &in)->sin6_addr.s6_addr) >+ return send_status(513, "Security violation: Address mismatch"); >+ break; >+ } > > send_status(200, "Ready data connection"); > data_buffer_len = 0; >diff -up TiMidity++-2.13.2/timidity/timidity.c.ipv6 TiMidity++-2.13.2/timidity/timidity.c >--- TiMidity++-2.13.2/timidity/timidity.c.ipv6 2008-02-01 15:07:26.000000000 +0100 >+++ TiMidity++-2.13.2/timidity/timidity.c 2008-02-01 15:03:32.000000000 +0100 >@@ -1489,6 +1489,8 @@ MAIN_INTERFACE int read_config_file(char > /* #extension HTTPproxy hostname:port */ > else if(strcmp(w[0], "HTTPproxy") == 0) > { >+ char r_bracket, l_bracket; >+ > if(words < 2) > { > ctl->cmsg(CMSG_ERROR, VERB_NORMAL, >@@ -1500,7 +1502,7 @@ MAIN_INTERFACE int read_config_file(char > /* If network is not supported, this extension is ignored. */ > #ifdef SUPPORT_SOCKET > url_http_proxy_host = safe_strdup(w[1]); >- if((cp = strchr(url_http_proxy_host, ':')) == NULL) >+ if((cp = strrchr(url_http_proxy_host, ':')) == NULL) > { > ctl->cmsg(CMSG_ERROR, VERB_NORMAL, > "%s: line %d: Syntax error", name, line); >@@ -1516,11 +1518,30 @@ MAIN_INTERFACE int read_config_file(char > CHECKERRLIMIT; > continue; > } >+ >+ l_bracket = url_http_proxy_host[0]; >+ r_bracket = url_http_proxy_host[strlen(url_http_proxy_host) - 1]; >+ >+ if (l_bracket == '[' || r_bracket == ']') >+ { >+ if (l_bracket != '[' || r_bracket != ']') >+ { >+ ctl->cmsg(CMSG_ERROR, VERB_NORMAL, >+ "%s: line %d: Malformed IPv6 address", >+ name, line); >+ CHECKERRLIMIT; >+ continue; >+ } >+ url_http_proxy_host++; >+ url_http_proxy_host[strlen(url_http_proxy_host) - 1] = '\0'; >+ } > #endif > } > /* #extension FTPproxy hostname:port */ > else if(strcmp(w[0], "FTPproxy") == 0) > { >+ char l_bracket, r_bracket; >+ > if(words < 2) > { > ctl->cmsg(CMSG_ERROR, VERB_NORMAL, >@@ -1532,7 +1553,7 @@ MAIN_INTERFACE int read_config_file(char > /* If network is not supported, this extension is ignored. */ > #ifdef SUPPORT_SOCKET > url_ftp_proxy_host = safe_strdup(w[1]); >- if((cp = strchr(url_ftp_proxy_host, ':')) == NULL) >+ if((cp = strrchr(url_ftp_proxy_host, ':')) == NULL) > { > ctl->cmsg(CMSG_ERROR, VERB_NORMAL, > "%s: line %d: Syntax error", name, line); >@@ -1548,6 +1569,23 @@ MAIN_INTERFACE int read_config_file(char > CHECKERRLIMIT; > continue; > } >+ >+ l_bracket = url_ftp_proxy_host[0]; >+ r_bracket = url_ftp_proxy_host[strlen(url_ftp_proxy_host) - 1]; >+ >+ if (l_bracket == '[' || r_bracket == ']') >+ { >+ if (l_bracket != '[' || r_bracket != ']') >+ { >+ ctl->cmsg(CMSG_ERROR, VERB_NORMAL, >+ "%s: line %d: Malformed IPv6 address", >+ name, line); >+ CHECKERRLIMIT; >+ continue; >+ } >+ url_ftp_proxy_host++; >+ url_ftp_proxy_host[strlen(url_ftp_proxy_host) - 1] = '\0'; >+ } > #endif > } > /* #extension mailaddr somebody@someware.domain.com */
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 198467
: 293992