SHA256
1
0
forked from pool/screen

Accepting request 18959 from Base:System

Copy from Base:System/screen based on submit request 18959 from user mlschroe

OBS-URL: https://build.opensuse.org/request/show/18959
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/screen?expand=0&rev=6
This commit is contained in:
OBS User autobuild 2009-08-27 22:44:55 +00:00 committed by Git OBS Bridge
parent a4b8943476
commit af2a08d7d8
3 changed files with 332 additions and 115 deletions

323
screen-4.0.3-ipv6.patch Normal file
View File

@ -0,0 +1,323 @@
--- screen-4.0.3/window.h.ipv6 2003-08-21 16:57:30.000000000 +0200
+++ screen-4.0.3/window.h 2006-11-15 13:36:57.000000000 +0100
@@ -254,7 +254,7 @@
struct display *w_zdisplay;
#endif
#ifdef BUILTIN_TELNET
- struct sockaddr_in w_telsa;
+ struct sockaddr_storage w_telsa;
char w_telbuf[IOSIZE];
int w_telbufl;
char w_telmopts[256];
--- screen-4.0.3/window.c.ipv6 2003-12-05 14:45:41.000000000 +0100
+++ screen-4.0.3/window.c 2006-11-15 13:39:27.000000000 +0100
@@ -582,6 +582,13 @@
n = pp - wtab;
debug1("Makewin creating %d\n", n);
+#ifdef BUILTIN_TELNET
+ if(!strcmp(nwin.args[0], "//telnet")) {
+ type = W_TYPE_TELNET;
+ TtyName = "telnet";
+ }
+ else
+#endif
if ((f = OpenDevice(nwin.args, nwin.lflag, &type, &TtyName)) < 0)
return -1;
@@ -736,7 +743,7 @@
#ifdef BUILTIN_TELNET
if (type == W_TYPE_TELNET)
{
- if (TelConnect(p))
+ if (TelOpenAndConnect(p))
{
FreeWindow(p);
return -1;
@@ -834,6 +841,13 @@
int lflag, f;
lflag = nwin_default.lflag;
+#ifdef BUILTIN_TELNET
+ if(!strcmp(p->w_cmdargs[0], "//telnet")) {
+ p->w_type = W_TYPE_TELNET;
+ TtyName = "telnet";
+ }
+ else
+#endif
if ((f = OpenDevice(p->w_cmdargs, lflag, &p->w_type, &TtyName)) < 0)
return -1;
@@ -864,7 +878,7 @@
#ifdef BUILTIN_TELNET
if (p->w_type == W_TYPE_TELNET)
{
- if (TelConnect(p))
+ if (TelOpenAndConnect(p))
return -1;
}
else
@@ -1007,16 +1021,6 @@
if (!arg)
return -1;
-#ifdef BUILTIN_TELNET
- if (strcmp(arg, "//telnet") == 0)
- {
- f = TelOpen(args + 1);
- lflag = 0;
- *typep = W_TYPE_TELNET;
- *namep = "telnet";
- }
- else
-#endif
if ((stat(arg, &st)) == 0 && S_ISCHR(st.st_mode))
{
if (access(arg, R_OK | W_OK) == -1)
--- screen-4.0.3/teln.c.ipv6 2003-09-08 16:26:56.000000000 +0200
+++ screen-4.0.3/teln.c 2006-11-15 13:36:57.000000000 +0100
@@ -25,6 +25,7 @@
#include <sys/socket.h>
#include <fcntl.h>
#include <netdb.h>
+#include <stdio.h>
#include "config.h"
@@ -37,12 +38,13 @@
extern struct layer *flayer;
extern int visual_bell;
extern char screenterm[];
+extern int af;
static void TelReply __P((struct win *, char *, int));
static void TelDocmd __P((struct win *, int, int));
static void TelDosub __P((struct win *));
-
-#define TEL_DEFPORT 23
+// why TEL_DEFPORT has "
+#define TEL_DEFPORT "23"
#define TEL_CONNECTING (-2)
#define TC_IAC 255
@@ -99,86 +101,78 @@
}
int
-TelOpen(args)
-char **args;
-{
- int fd;
- int on = 1;
-
- if ((fd = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) == -1)
- {
- Msg(errno, "TelOpen: socket");
- return -1;
- }
- if (setsockopt(fd, SOL_SOCKET, SO_OOBINLINE, (char *)&on, sizeof(on)))
- Msg(errno, "TelOpen: setsockopt SO_OOBINLINE");
- return fd;
-}
-
-int
-TelConnect(p)
-struct win *p;
-{
- int port = TEL_DEFPORT;
- struct hostent *hp;
- char **args;
+TelOpenAndConnect(struct win *p) {
+ int fd, on = 1;
char buf[256];
- args = p->w_cmdargs + 1;
-
- if (!*args)
- {
- Msg(0, "Usage: screen //telnet host [port]");
- return -1;
- }
- if (args[1])
- port = atoi(args[1]);
- p->w_telsa.sin_family = AF_INET;
- if((p->w_telsa.sin_addr.s_addr = inet_addr(*args)) == -1)
- {
- if ((hp = gethostbyname(*args)) == NULL)
- {
- Msg(0, "unknown host: %s", *args);
- return -1;
- }
- if (hp->h_length != sizeof(p->w_telsa.sin_addr.s_addr) || hp->h_addrtype != AF_INET)
- {
- Msg(0, "Bad address type for %s", hp->h_name);
- return -1;
- }
- bcopy((char *)hp->h_addr,(char *)&p->w_telsa.sin_addr.s_addr, hp->h_length);
- p->w_telsa.sin_family = hp->h_addrtype;
- }
- p->w_telsa.sin_port = htons(port);
- if (port != TEL_DEFPORT)
- sprintf(buf, "Trying %s %d...", inet_ntoa(p->w_telsa.sin_addr), port);
- else
- sprintf(buf, "Trying %s...", inet_ntoa(p->w_telsa.sin_addr));
- WriteString(p, buf, strlen(buf));
- if (connect(p->w_ptyfd, (struct sockaddr *)&p->w_telsa, sizeof(p->w_telsa)))
- {
- if (errno == EINPROGRESS)
- {
- p->w_telstate = TEL_CONNECTING;
- p->w_telconnev.fd = p->w_ptyfd;
- p->w_telconnev.handler = tel_connev_fn;
- p->w_telconnev.data = (char *)p;
- p->w_telconnev.type = EV_WRITE;
- p->w_telconnev.pri = 1;
- debug("telnet connect in progress...\n");
- evenq(&p->w_telconnev);
- }
- else
- {
- Msg(errno, "TelOpen: connect");
- return -1;
- }
- }
- else
- WriteString(p, "connected.\r\n", 12);
- if (port == TEL_DEFPORT)
- TelReply(p, (char *)tn_init, sizeof(tn_init));
- return 0;
+ struct addrinfo hints, *res0, *res;
+
+ if (!(p->w_cmdargs[1])) {
+ Msg(0, "Usage: screen //telnet host [port]");
+ return -1;
+ }
+
+ memset(&hints, 0, sizeof(hints));
+ hints.ai_family = af;
+ hints.ai_socktype = SOCK_STREAM;
+ hints.ai_protocol = IPPROTO_TCP;
+ if(getaddrinfo(p->w_cmdargs[1], p->w_cmdargs[2] ? p->w_cmdargs[2] : TEL_DEFPORT,
+ &hints, &res0)) {
+ Msg(0, "unknown host: %s", p->w_cmdargs[1]);
+ return -1;
+ }
+
+ for(res = res0; res; res = res->ai_next) {
+ if((fd = socket(res->ai_family, res->ai_socktype, res->ai_protocol)) == -1) {
+ if(res->ai_next)
+ continue;
+ else {
+ Msg(errno, "TelOpenAndConnect: socket");
+ freeaddrinfo(res0);
+ return -1;
+ }
+ }
+
+ if (setsockopt(fd, SOL_SOCKET, SO_OOBINLINE, (char *)&on, sizeof(on)))
+ Msg(errno, "TelOpenAndConnect: setsockopt SO_OOBINLINE");
+
+ if (p->w_cmdargs[2] && strcmp(p->w_cmdargs[2], TEL_DEFPORT))
+ snprintf(buf, 256, "Trying %s %s...", p->w_cmdargs[1], p->w_cmdargs[2]);
+ else
+ snprintf(buf, 256, "Trying %s...", p->w_cmdargs[1]);
+ WriteString(p, buf, strlen(buf));
+ if (connect(fd, res->ai_addr, res->ai_addrlen)) {
+ if (errno == EINPROGRESS) {
+ p->w_telstate = TEL_CONNECTING;
+ p->w_telconnev.fd = fd;
+ p->w_telconnev.handler = tel_connev_fn;
+ p->w_telconnev.data = (char *)p;
+ p->w_telconnev.type = EV_WRITE;
+ p->w_telconnev.pri = 1;
+ debug("telnet connect in progress...\n");
+ evenq(&p->w_telconnev);
+ }
+ else {
+ close(fd);
+ if(res->ai_next)
+ continue;
+ else {
+ Msg(errno, "TelOpenAndConnect: connect");
+ freeaddrinfo(res0);
+ return -1;
+ }
+ }
+ }
+ else
+ WriteString(p, "connected.\r\n", 12);
+ if (!(p->w_cmdargs[2] && strcmp(p->w_cmdargs[2], TEL_DEFPORT)))
+ TelReply(p, (char *)tn_init, sizeof(tn_init));
+ p->w_ptyfd = fd;
+ memcpy(&p->w_telsa, &res->ai_addr, sizeof(res->ai_addr));
+ freeaddrinfo(res0);
+ return 0;
+ }
+ return -1;
}
int
--- screen-4.0.3/help.c.ipv6 2003-09-08 16:25:33.000000000 +0200
+++ screen-4.0.3/help.c 2006-11-15 13:36:57.000000000 +0100
@@ -49,6 +49,10 @@
{
printf("Use: %s [-opts] [cmd [args]]\n", myname);
printf(" or: %s -r [host.tty]\n\nOptions:\n", myname);
+#ifdef BUILTIN_TELNET
+ printf("-4 Use IPv4.\n");
+ printf("-6 Use IPv6.\n");
+#endif
printf("-a Force all capabilities into each window's termcap.\n");
printf("-A -[r|R] Adapt all windows to the new display width & height.\n");
printf("-c file Read configuration file instead of '.screenrc'.\n");
--- screen-4.0.3/screen.c.ipv6 2003-09-08 16:26:41.000000000 +0200
+++ screen-4.0.3/screen.c 2006-11-15 13:36:57.000000000 +0100
@@ -231,8 +231,9 @@
struct win *fore;
struct win *windows;
struct win *console_window;
-
-
+#ifdef BUILTIN_TELNET
+int af;
+#endif
/*
* Do this last
@@ -471,6 +472,9 @@
nwin = nwin_undef;
nwin_options = nwin_undef;
strcpy(screenterm, "screen");
+#ifdef BUILTIN_TELNET
+ af = AF_UNSPEC;
+#endif
logreopen_register(lf_secreopen);
@@ -505,6 +509,14 @@
{
switch (*ap)
{
+#ifdef BUILTIN_TELNET
+ case '4':
+ af = AF_INET;
+ break;
+ case '6':
+ af = AF_INET6;
+ break;
+#endif
case 'a':
nwin_options.aflag = 1;
break;
--- screen-4.0.3/extern.h.ipv6 2003-08-22 14:27:57.000000000 +0200
+++ screen-4.0.3/extern.h 2006-11-15 13:36:57.000000000 +0100
@@ -446,8 +446,7 @@
/* teln.c */
#ifdef BUILTIN_TELNET
-extern int TelOpen __P((char **));
-extern int TelConnect __P((struct win *));
+extern int TelOpenAndConnect __P((struct win *));
extern int TelIsline __P((struct win *p));
extern void TelProcessLine __P((char **, int *));
extern int DoTelnet __P((char *, int *, int));

View File

@ -1,3 +1,9 @@
-------------------------------------------------------------------
Fri Jul 31 02:17:31 CEST 2009 - crrodriguez@suse.de
- add fedora patch for IPv6 support, this removes usage
of gethostbyname(3)
-------------------------------------------------------------------
Tue May 26 14:22:07 CEST 2009 - mls@suse.de

View File

@ -26,7 +26,7 @@ Group: System/Console
PreReq: %install_info_prereq
AutoReqProv: on
Version: 4.0.2
Release: 189
Release: 190
Summary: A program to allow multiple screens on a VT100/ANSI Terminal
Source: screen-4.0.2.tar.gz
Patch: screen-4.0.2.dif
@ -34,6 +34,7 @@ Patch1: screen-__P.diff
Patch2: screen-gcc4.diff
Patch3: screen-4.0.2-comb.diff
Patch4: screen-man-loginshell.diff
Patch5: screen-4.0.3-ipv6.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%description
@ -58,6 +59,7 @@ Authors:
%patch2 -p1
%patch3
%patch4 -p1
%patch5 -p1
%build
CFLAGS="-DMAXWIN=1000 $RPM_OPT_FLAGS" ./configure --prefix=/usr --infodir=%{_infodir} \
@ -101,117 +103,3 @@ install -m 644 screenrc $RPM_BUILD_ROOT/etc/screenrc
%install_info_delete --info-dir=%{_infodir} %{_infodir}/%{name}.info.gz
%changelog
* Tue May 26 2009 mls@suse.de
- re-add lost maxwin definition [fate#301190]
* Wed May 14 2008 jw@suse.de
- A few lines added to docu explaining login-shells and
starting with '-' trick.
* Thu Mar 29 2007 dmueller@suse.de
- add ncurses-devel BuildRequires
* Mon Oct 23 2006 mls@suse.de
- fix two bugs in handling of combining characters [#214412]
* Fri Feb 10 2006 mls@suse.de
- enable support for 256 colors [#136684]
* Thu Jan 26 2006 sbrabec@suse.cz
- Added %%install_info_prereq.
* Wed Jan 25 2006 mls@suse.de
- converted neededforbuild to BuildRequires
* Sat Oct 29 2005 mls@suse.de
- fix ut_time aliasing problem
* Fri Apr 08 2005 meissner@suse.de
- execl 0 -> (char*)0.
* Tue Sep 28 2004 mls@suse.de
- clear ti/te for xterms so that users can use xterm's scrollbar
* Sun Sep 12 2004 kukuk@suse.de
- Don't use __P from glibc
* Mon Feb 16 2004 mls@suse.de
- fix socketdir quoting
* Thu Feb 12 2004 mls@suse.de
- update to 4.0.2
- move sockdirs to /var/run and include them in package
* Sat Jan 10 2004 adrian@suse.de
- add %%defattr
* Thu Sep 18 2003 mls@suse.de
- update to 4.0.1 (fixes another bug of the parser)
* Fri Sep 12 2003 mls@suse.de
- fix off by one error in variable expansion
* Fri Sep 12 2003 mls@suse.de
- don't resize xterms on startup
* Mon Sep 08 2003 mls@suse.de
- update to 4.0.0final
* Wed Aug 27 2003 mls@suse.de
- update to 4.0.0beta2
* Fri Aug 01 2003 mls@suse.de
- update to 4.0.0beta1
* Thu Apr 24 2003 ro@suse.de
- fix install_info --delete call and move from preun to postun
* Thu Mar 13 2003 mls@suse.de
- update to 3.9.15: changing the window title could append
junk to the title
* Wed Mar 12 2003 mls@suse.de
- update to 3.9.14: one small docu change and a small improvement
in the windowlist command
* Mon Feb 24 2003 mls@suse.de
- update to 3.9.14beta1
- build screen with buildroot
- remove xf86 dependency, use configure option instead
- use install-info macro to install info page
* Tue Oct 01 2002 mls@suse.de
- fix WrapChar() scrolling region reset code to always use a
valid scrolling region (#20367)
* Tue Sep 17 2002 ro@suse.de
- removed bogus self-provides
* Thu Sep 05 2002 mls@suse.de
- update to official screen-3.9.13, contains one small bug
fix
* Thu Aug 29 2002 mls@suse.de
- update to official screen-3.9.12
* Mon Aug 19 2002 mls@suse.de
- update to screen-3.9.12beta2
* Fri Mar 08 2002 kukuk@suse.de
- Add /usr/share/screen to filelist
* Wed Mar 06 2002 mls@suse.de
- disable pam support again
- fix segmentation fault in screen's reattach password check
* Fri Feb 22 2002 mls@suse.de
- fix passing of NUL bytes when recoding is active
- moved uid/gid retrieval in front of FindEncoding
* Mon Feb 18 2002 mls@suse.de
- added missing /usr/share/screen/utf8encodings files
- small patch to fix hardstatus width
* Thu Feb 14 2002 mls@suse.de
- update to official screen-3.9.11
- enabled pam & localized dates
* Mon Feb 11 2002 mls@suse.de
- update to screen-3.9.11beta7
* Tue Jan 29 2002 okir@suse.de
- require utempter to build; zapped s bit
* Fri Jan 25 2002 okir@suse.de
- require utempter to build
* Wed Sep 05 2001 mls@suse.de
- nominal upgrade to screen-3.9.10
* Mon Sep 03 2001 mls@suse.de
- Security fix for the Multiattach-bug in /usr/bin/screen
* Mon Jul 23 2001 bk@suse.de
- added select-fix for fifo-testcase to build on s390x
* Fri May 25 2001 mls@suse.de
- update -> 3.9.9
* Tue May 08 2001 mls@suse.de
- added workaround for broken xterm to global screenrc
* Fri Apr 27 2001 mls@suse.de
- fix screen -wipe (bugzilla bug #2990)
- fix f10 function key (bugzilla bug #4326)
- fix 0620 pty mode autodetection (bugzilla bug #6304)
* Mon Sep 04 2000 uli@suse.de
- fix for root compromise using configurable visual bell string
* Fri Feb 25 2000 kukuk@suse.de
- Move /usr/{info,man} -> /usr/share/{info,man}
* Fri Oct 22 1999 uli@suse.de
- update -> 3.9.5
* Mon Sep 13 1999 bs@suse.de
- ran old prepare_spec on spec file to switch to new prepare_spec.
* Fri Nov 27 1998 uli@suse.de
- Update 3.7.3 -> 3.7.6
* Wed Apr 30 1997 florian@suse.de
- update to version 3.7.3
- mv /usr/etc/screenrc /etc/