rpms/suck/devel suck-4.3.2-ipv6.patch, NONE, 1.1 README.Fedora, 1.1, 1.2 suck.spec, 1.11, 1.12
Jochen Schmitt (s4504kr)
fedora-extras-commits at redhat.com
Wed Aug 15 15:53:54 UTC 2007
Author: s4504kr
Update of /cvs/extras/rpms/suck/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv3891
Modified Files:
README.Fedora suck.spec
Added Files:
suck-4.3.2-ipv6.patch
Log Message:
Adding IPv6 support
suck-4.3.2-ipv6.patch:
--- NEW FILE suck-4.3.2-ipv6.patch ---
diff -urN suck-4.3.2.orig/active.c suck-4.3.2/active.c
--- suck-4.3.2.orig/active.c 2001-09-15 00:06:40.000000000 +0200
+++ suck-4.3.2/active.c 2007-08-15 13:33:49.000000000 +0200
@@ -181,7 +181,6 @@
/* connect to localhost NNTP server */
int fd;
- struct hostent *hi;
char *inbuf;
unsigned int port;
@@ -190,7 +189,7 @@
do_debug("Connecting to %s on port %d\n", master->localhost, port);
}
- if((fd = connect_to_nntphost(master->localhost, &hi, NULL, port, master->local_ssl, &master->local_ssl_struct)) >= 0) {
+ if((fd = connect_to_nntphost(master->localhost, NULL, 0, NULL, port, master->local_ssl, &master->local_ssl_struct)) >= 0) {
/* get the announcement line */
if(sgetline(fd, &inbuf, master->local_ssl, master->local_ssl_struct) < 0) {
close(fd);
diff -urN suck-4.3.2.orig/both.c suck-4.3.2/both.c
--- suck-4.3.2.orig/both.c 2003-03-25 23:38:45.000000000 +0100
+++ suck-4.3.2/both.c 2007-08-15 13:33:49.000000000 +0200
@@ -138,35 +138,13 @@
return retval;
}
-/*---------------------------------------------*/
-struct hostent *get_hostent(const char *host) {
- struct in_addr saddr;
- int c;
- struct hostent *hi = NULL;
-
- if(host==NULL) {
- error_log(ERRLOG_REPORT,both_phrases[0], NULL);
- }
- else {
- c=*host;
- if(isdigit(c)) {
- saddr.s_addr = inet_addr(host);
- hi = gethostbyaddr((char *)&saddr,sizeof(struct in_addr),AF_INET);
- }
- else {
- hi = gethostbyname(host);
- }
- }
- return hi;
-}
/*--------------------------------------------*/
-int connect_to_nntphost(const char *host, struct hostent **hi, FILE *msgs, unsigned short int portnr, int do_ssl, void **ssl) {
- char *ptr, *realhost;
- struct in_addr *aptr;
- struct in_addr saddr;
- struct sockaddr_in address;
+int connect_to_nntphost(const char *host, char *hname, size_t hnlength, FILE *msgs, unsigned short int portnr, int do_ssl, void **ssl)
+{
+ char *realhost, *pport;
char sport[10];
- int sockfd = -1;
+ struct addrinfo *l, hint = { 0 };
+ int r, sockfd = -1;
#ifdef HAVE_LIBSSL
SSL *ssl_struct = NULL;
@@ -184,65 +162,60 @@
}
#endif
/* handle host:port type syntax */
- realhost = strdup(host);
- if(realhost == NULL) {
- MyPerror("out of memory copying host name");
- return sockfd;
- }
- ptr = strchr(realhost, ':');
- if(ptr != NULL) {
- *ptr = '\0'; /* null terminate host name */
- portnr = atoi(++ptr); /* get port number */
- }
-
-
-
- sprintf(sport, "%hu", portnr); /* cause print_phrases wants all strings */
- print_phrases(msgs, both_phrases[1], sport, NULL);
-
- /* Find the internet address of the NNTP server */
- *hi = get_hostent(realhost);
- if(*hi == NULL) {
+ realhost = alloca(strlen(host) + 1);
+ strcpy(realhost, host);
+ pport = strchr(realhost, ':');
+ if(pport != NULL) {
+ *pport = '\0'; /* null terminate host name */
+ ++pport; /* get port number */
+ }
+ else
+ {
+ snprintf(sport, sizeof(sport), "%hu", portnr); /* cause print_phrases wants all strings */
+ pport = sport;
+ }
+ print_phrases(msgs, both_phrases[1], pport, NULL);
+ hint.ai_socktype = SOCK_STREAM;
+ hint.ai_flags = AI_ADDRCONFIG | AI_CANONNAME;
+ r = getaddrinfo(realhost, pport, &hint, &l);
+ if(r != 0 || l == NULL)
+ {
error_log(ERRLOG_REPORT,"%v1%: ",realhost, NULL);
MyPerror(both_phrases[2]);
- free(realhost);
}
- else {
- free(realhost);
- print_phrases(msgs, both_phrases[3], (*hi)->h_name, NULL);
- while((ptr = *((*hi)->h_aliases)) != NULL) {
- print_phrases(msgs, both_phrases[4], ptr, NULL );
- (*hi)->h_aliases++;
- }
- if((*hi)->h_addrtype != AF_INET) {
- error_log(ERRLOG_REPORT, both_phrases[5], NULL);
- }
- else {
- while((aptr = (struct in_addr *)*((*hi)->h_addr_list)++) != NULL) {
- saddr = *aptr;
- print_phrases(msgs, both_phrases[17], inet_ntoa(*aptr), NULL);
- }
-
- /* Create a socket */
- if((sockfd = socket( AF_INET, SOCK_STREAM, SOCKET_PROTOCOL)) == -1) {
- MyPerror(both_phrases[6]);
- }
- else {
- address.sin_family = AF_INET;
- address.sin_port = htons(portnr); /* NNTP port */
- address.sin_addr= saddr;
-
- /* Establish a connection */
- if(connect(sockfd, (struct sockaddr *)&address, sizeof address ) == -1) {
- MyPerror(both_phrases[7]);
- close(sockfd);
- sockfd = -1;
- }
- else {
- print_phrases(msgs,both_phrases[8], (*hi)->h_name, NULL);
+ else
+ {
+ struct addrinfo *p = l;
+ print_phrases(msgs, both_phrases[3], p->ai_canonname, NULL);
+ if((sockfd = socket(p->ai_family, p->ai_socktype, p->ai_protocol)) == -1)
+ {
+ MyPerror(both_phrases[6]);
+ }
+ else
+ {
+ if(connect(sockfd, p->ai_addr, p->ai_addrlen) == -1)
+ {
+ MyPerror(both_phrases[7]);
+ close(sockfd);
+ sockfd = -1;
+ }
+ else
+ {
+ char lhost[256], lport[64];
+ r = getnameinfo(p->ai_addr, p->ai_addrlen, lhost, sizeof(lhost),
+ lport, sizeof(lport), 0);
+ if(r == 0)
+ {
+ print_phrases(msgs,both_phrases[8], lhost, NULL);
+ if(hname && hnlength)
+ {
+ strncpy(hname, lhost, hnlength);
+ hname[hnlength] = '\0';
+ }
}
- }
+ }
}
+ freeaddrinfo(l);
#ifdef HAVE_LIBSSL
if(sockfd > -1 && do_ssl == TRUE) {
if((ssl_struct = SSL_new(test1)) == NULL) {
diff -urN suck-4.3.2.orig/both.h suck-4.3.2/both.h
--- suck-4.3.2.orig/both.h 2002-08-28 00:54:34.000000000 +0200
+++ suck-4.3.2/both.h 2007-08-15 13:33:49.000000000 +0200
@@ -9,7 +9,7 @@
/* declarations */
int sgetline(int fd, char **sbuf, int, void *);
int sputline(int fd, const char *outbuf, int, void *);
-int connect_to_nntphost(const char *host, struct hostent **, FILE *, unsigned short int, int, void **);
+int connect_to_nntphost(const char *host, char *hname, size_t hnlength, FILE *msgs, unsigned short int portnr, int do_ssl, void **ssl);
void disconnect_from_nntphost(int, int, void **);
char *number(char *sp, int *intPtr);
char *get_long(char *, long *);
diff -urN suck-4.3.2.orig/rpost.c suck-4.3.2/rpost.c
--- suck-4.3.2.orig/rpost.c 2007-08-15 13:33:17.000000000 +0200
+++ suck-4.3.2/rpost.c 2007-08-15 13:33:49.000000000 +0200
@@ -28,7 +28,7 @@
#ifndef PL_na
# define PL_na (na)
#endif
-#endif /* OLD_PERL */u
+#endif /* OLD_PERL */
#endif
#ifdef HAVE_DIRENT_H
@@ -117,7 +117,7 @@
int main(int argc, char *argv[], char *env[]) {
char *inbuf;
int response, retval, loop, fargc, i;
- struct hostent *hi;
+ char hname[256];
struct stat sbuf;
char **args, **fargs;
Args myargs;
@@ -244,7 +244,7 @@
retval = RETVAL_ERROR;
}
else {
- myargs.sockfd = connect_to_nntphost( myargs.host, &hi, myargs.status_fptr, myargs.portnr, myargs.do_ssl, &myargs.ssl_struct);
+ myargs.sockfd = connect_to_nntphost(myargs.host, hname, sizeof(hname), myargs.status_fptr, myargs.portnr, myargs.do_ssl, &myargs.ssl_struct);
if(myargs.sockfd < 0) {
retval = RETVAL_ERROR;
}
@@ -299,7 +299,7 @@
retval = do_article(&myargs, stdin);
}
- print_phrases(myargs.status_fptr, rpost_phrases[4], hi->h_name, NULL);
+ print_phrases(myargs.status_fptr, rpost_phrases[4], hname, NULL);
if(myargs.debug == TRUE) {
do_debug("Sending quit");
}
diff -urN suck-4.3.2.orig/suck.c suck-4.3.2/suck.c
--- suck-4.3.2.orig/suck.c 2003-03-28 20:24:54.000000000 +0100
+++ suck-4.3.2/suck.c 2007-08-15 13:33:49.000000000 +0200
@@ -665,7 +665,6 @@
char *inbuf;
int nr, resp, retval = RETVAL_OK;
- struct hostent *hi;
FILE *fp;
@@ -696,7 +695,7 @@
}
fp = (which_time == CONNECT_FIRST) ? master->msgs : NULL;
- master->sockfd = connect_to_nntphost( master->host, &hi, fp, master->portnr, master->do_ssl, &master->ssl_struct);
+ master->sockfd = connect_to_nntphost( master->host, NULL, 0, fp, master->portnr, master->do_ssl, &master->ssl_struct);
if(master->sockfd < 0 ) {
retval = RETVAL_ERROR;
diff -urN suck-4.3.2.orig/testhost.c suck-4.3.2/testhost.c
--- suck-4.3.2.orig/testhost.c 2003-03-23 16:34:46.000000000 +0100
+++ suck-4.3.2/testhost.c 2007-08-15 13:33:49.000000000 +0200
@@ -59,7 +59,6 @@
int main(int argc, char *argv[]) {
int sockfd, response, loop, cmd, quiet, mode_reader, do_ssl, retval = RETVAL_OK;
- struct hostent *hi;
struct stat sbuf;
unsigned short int portnr;
FILE *fptr = stdout; /* used to print output to */
@@ -229,7 +228,7 @@
if(retval == RETVAL_OK) {
load_phrases(phrases); /* this is here so everything displays okay */
- sockfd = connect_to_nntphost( host, &hi, (quiet == FALSE)? fptr : NULL, portnr, do_ssl, &ssl_struct);
+ sockfd = connect_to_nntphost(host, NULL, 0, (quiet == FALSE)? fptr : NULL, portnr, do_ssl, &ssl_struct);
if(sockfd < 0 ) {
retval = RETVAL_ERROR;
}
Index: README.Fedora
===================================================================
RCS file: /cvs/extras/rpms/suck/devel/README.Fedora,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- README.Fedora 8 Nov 2004 05:23:08 -0000 1.1
+++ README.Fedora 15 Aug 2007 15:53:21 -0000 1.2
@@ -75,7 +75,7 @@
Then you can create a newsgroup with the following command:
-$ ctlinnd newgroups de.test
+$ ctlinnd newgroup de.test
In this example a group for posting test articles was created on the local
newsserver.
Index: suck.spec
===================================================================
RCS file: /cvs/extras/rpms/suck/devel/suck.spec,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- suck.spec 12 Aug 2007 19:10:34 -0000 1.11
+++ suck.spec 15 Aug 2007 15:53:21 -0000 1.12
@@ -1,7 +1,7 @@
Name: suck
Summary: Download news from remote NNTP server
Version: 4.3.2
-Release: 15%{?dist}
+Release: 16%{?dist}
Source: http://www.sucknews.org/%{name}-%{version}.tar.gz
Source1: active-ignore
Source2: suck-4.3.2.site
@@ -11,10 +11,13 @@
Patch1: suck-4.3.2-perl.patch
Patch2: suck-4.3.2-samples.patch
Patch3: suck-4.3.2-parallel-build.patch
-BuildRoot: %{_tmppath}/%{name}-%{version}-buildroot
+Patch4: suck-4.3.2-ipv6.patch
+BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{_id_u} -n)
+
+
License: Public Domain
Group: System Environment/Daemons
-BuildRequires: inn-devel >= 2.3, perl >= 3:5.8
+BuildRequires: inn-devel >= 2.3, perl-devel >= 3:5.8
BuildRequires: openssl-devel, autoconf
Requires: inn >= 2.3
Conflicts: leafnode
@@ -30,6 +33,7 @@
%patch1 -p1
%patch2 -p1
%patch3 -p1
+%patch4 -p1
cp %{SOURCE3} .
@@ -67,7 +71,7 @@
%{_bindir}/testhost
%{_bindir}/lmove
%{_libdir}/news/bin/getnews
-%dir /var/lib/news/suck/
+%attr(-,news,news) %dir /var/lib/news/suck/
/var/lib/news/suck/put.news.sm
/var/lib/news/suck/put.news.sm.pl
/var/lib/news/suck/active-ignore
@@ -80,6 +84,10 @@
%config(noreplace) /etc/sysconfig/suck/site
%changelog
+* Wed Aug 15 2007 Jochen Schmitt <Jochen herr-schmitt de> 4.3.2-16
+- Adding IPv6 support
+- Fix typo in README.Fedora
+
* Sun Aug 12 2007 Jochen Schmitt <Jochen herr-schmitt de> 4.3.2-15
- Rebuild for build id feature
More information about the fedora-extras-commits
mailing list