Update patches against upstream version

epel9
Petr Hracek 11 years ago
parent 810d81d695
commit d74b327256

@ -1,114 +0,0 @@
diff -Naur screen-orig/src/acls.c screen/src/acls.c
--- screen-orig/src/acls.c 2012-03-07 06:05:35.000000000 -0500
+++ screen/src/acls.c 2012-04-23 22:57:03.595468724 -0400
@@ -544,12 +544,25 @@
if (pw2 && *pw2 && *pw2 != '\377') /* provided a system password */
{
- if (!*pass || /* but needed none */
- strcmp(crypt(pw2, pass), pass))
+ if (!*pass) /* but needed none */
{
debug("System password mismatch\n");
sorry++;
}
+ else
+ {
+ char *cryptbuf = crypt(pw2, pass);
+ if(cryptbuf == NULL)
+ {
+ debug("System crypt() failed\n");
+ sorry++;
+ }
+ else if (strcmp(cryptbuf, pass))
+ {
+ debug("System password mismatch\n");
+ sorry++;
+ }
+ }
}
else /* no pasword provided */
if (*pass) /* but need one */
@@ -557,12 +570,29 @@
#endif
if (pw1 && *pw1 && *pw1 != '\377') /* provided a screen password */
{
- if (!*u->u_password || /* but needed none */
- strcmp(crypt(pw1, u->u_password), u->u_password))
+ char *cryptbuf;
+ if (!*u->u_password) /* but needed none */
{
debug("screen password mismatch\n");
- sorry++;
+ sorry++;
}
+ else
+ {
+ cryptbuf = crypt(pw1, u->u_password);
+ if (cryptbuf == NULL)
+ {
+ debug("crypt() failed\n");
+ sorry++;
+ }
+ else
+ {
+ if(strcmp(cryptbuf, u->u_password))
+ {
+ debug("screen password mismatch\n");
+ sorry++;
+ }
+ }
+ }
}
else /* no pasword provided */
if (*u->u_password) /* but need one */
diff -Naur screen-orig/src/misc.c screen/src/misc.c
--- screen-orig/src/misc.c 2012-03-07 06:05:35.000000000 -0500
+++ screen/src/misc.c 2012-04-23 22:34:56.740665509 -0400
@@ -56,6 +56,8 @@
{
register char *cp;
+ if(str == NULL)
+ Panic(0, "SaveStr() received NULL - possibly failed crypt()");
if ((cp = malloc(strlen(str) + 1)) == NULL)
Panic(0, "%s", strnomem);
else
diff -Naur screen-orig/src/process.c screen/src/process.c
--- screen-orig/src/process.c 2012-03-07 06:05:35.000000000 -0500
+++ screen/src/process.c 2012-04-23 22:41:09.318930088 -0400
@@ -6343,6 +6343,10 @@
salt[st] = 'A' + (int)((time(0) >> 6 * st) % 26);
salt[2] = 0;
buf = crypt(u->u_password, salt);
+ if(buf == NULL) {
+ Msg(0, "[ no working crypt() - no secure ]");
+ return;
+ }
bzero(u->u_password, strlen(u->u_password));
free((char *)u->u_password);
u->u_password = SaveStr(buf);
diff -Naur screen-orig/src/socket.c screen/src/socket.c
--- screen-orig/src/socket.c 2012-04-23 22:17:55.678316716 -0400
+++ screen/src/socket.c 2012-04-23 22:29:12.225173900 -0400
@@ -1565,13 +1565,18 @@
c = *(unsigned char *)ibuf++;
if (c == '\r' || c == '\n')
{
+ char *buf;
up = D_user->u_password;
pwdata->buf[l] = 0;
- if (strncmp(crypt(pwdata->buf, up), up, strlen(up)))
+ buf = crypt(pwdata->buf, up);
+ if((buf == NULL) || (strncmp(buf, up, strlen(up))))
{
/* uh oh, user failed */
bzero(pwdata->buf, sizeof(pwdata->buf));
- AddStr("\r\nPassword incorrect.\r\n");
+ if(buf==NULL)
+ AddStr("\r\ncrypt() failed.\r\n");
+ else
+ AddStr("\r\nPassword incorrect.\r\n");
D_processinputdata = 0; /* otherwise freed by FreeDis */
FreeDisplay();
Msg(0, "Illegal reattach attempt from terminal %s.", pwdata->m.m_tty);

@ -1,26 +0,0 @@
diff --git a/src/display.h b/src/display.h
index e8b3b80..b1ab748 100644
--- a/src/display.h
+++ b/src/display.h
@@ -73,7 +73,7 @@ struct display
struct win *d_other; /* pointer to other window */
int d_nonblock; /* -1 don't block if obufmax reached */
/* >0: block after nonblock secs */
- char d_termname[20 + 1]; /* $TERM */
+ char d_termname[40 + 1]; /* $TERM */
char *d_tentry; /* buffer for tgetstr */
char d_tcinited; /* termcap inited flag */
int d_width, d_height; /* width/height of the screen */
diff --git a/src/screen.h b/src/screen.h
index 5c93f32..1a388e3 100644
--- a/src/screen.h
+++ b/src/screen.h
@@ -214,7 +214,7 @@ struct msg
char preselect[20];
int esc; /* his new escape character unless -1 */
int meta_esc; /* his new meta esc character unless -1 */
- char envterm[20 + 1]; /* terminal type */
+ char envterm[40 + 1]; /* terminal type */
int encoding; /* encoding of display */
int detachfirst; /* whether to detach remote sessions first */
}

@ -1,13 +0,0 @@
diff --git a/src/screen.c b/src/screen.c
index af0fd82..cd0c71b 100644
--- a/src/screen.c
+++ b/src/screen.c
@@ -1005,7 +1005,7 @@ char **av;
Panic(0, "$HOME too long - sorry.");
attach_tty = "";
- if (!detached && !lsflag && !cmdflag && !(dflag && !mflag && !rflag && !xflag) && !(!mflag && !SockMatch && sty && !xflag))
+ if (!detached && !lsflag && !cmdflag && !(dflag && !mflag && !rflag && !xflag) && !(!mflag && !SockMatch && sty && !xflag && !rflag))
{
#ifndef NAMEDPIPE
int fl;

@ -9,10 +9,10 @@ Date: Mon Jul 18 17:26:47 2011 +0200
extended capability E3. This is useful to prevent an attacker to read
content of a locked terminal via Shift-PgUp key.
diff --git a/src/display.c b/src/display.c
diff --git a/display.c b/display.c
index 5fa11cb..038c435 100644
--- a/src/display.c
+++ b/src/display.c
--- a/display.c
+++ b/display.c
@@ -3779,4 +3779,10 @@ char **cmdv;
#endif /* BLANKER_PRG */
@ -24,10 +24,10 @@ index 5fa11cb..038c435 100644
+ AddCStr(D_CE3);
+}
diff --git a/src/extern.h b/src/extern.h
diff --git a/extern.h b/extern.h
index c787d99..d3fecf0 100644
--- a/src/extern.h
+++ b/src/extern.h
--- a/extern.h
+++ b/extern.h
@@ -316,6 +316,7 @@ extern int color256to88 __P((int));
extern void ResetIdle __P((void));
extern void KillBlanker __P((void));
@ -36,10 +36,10 @@ index c787d99..d3fecf0 100644
/* resize.c */
extern int ChangeWindowSize __P((struct win *, int, int, int));
diff --git a/src/screen.c b/src/screen.c
diff --git a/screen.c b/screen.c
index cc8f565..3efb67b 100644
--- a/src/screen.c
+++ b/src/screen.c
--- a/screen.c
+++ b/screen.c
@@ -1967,6 +1967,7 @@ int mode;
#endif
case D_LOCK:
@ -48,10 +48,10 @@ index cc8f565..3efb67b 100644
sign = SIG_LOCK;
/* tell attacher to lock terminal with a lockprg. */
break;
diff --git a/src/term.c b/src/term.c
diff --git a/term.c b/term.c
index 991de1b..7485900 100644
--- a/src/term.c
+++ b/src/term.c
--- a/term.c
+++ b/term.c
@@ -83,6 +83,7 @@ struct term term[T_N] =
{ "CD", T_STR },
{ "ce", T_STR },

@ -1,14 +1,14 @@
diff --git a/src/ansi.c b/src/ansi.c
index d88e153..8df79b2 100644
--- a/src/ansi.c
+++ b/src/ansi.c
@@ -1438,8 +1438,8 @@ int c, intermediate;
}
diff --git a/ansi.c b/ansi.c
index e76eef4..bbdc119 100644
--- a/ansi.c
+++ b/ansi.c
@@ -1444,8 +1444,8 @@ int c, intermediate;
else
{
- LeaveAltScreen(curr);
RestoreCursor(&curr->w_alt.cursor);
+ LeaveAltScreen(curr);
if (curr->w_alt.on) {
- LeaveAltScreen(curr);
RestoreCursor(&curr->w_alt.cursor);
+ LeaveAltScreen(curr);
}
}
if (a1 == 47 && !i)
curr->w_saved.on = 0;

@ -1,323 +0,0 @@
commit 6eb1f1426bfd99f88d927838d51eabc2b13e73af
Author: Miroslav Lichvar <mlichvar@redhat.com>
Date: Thu Jan 13 17:37:47 2011 +0100
Avoid dereferencing null pointer in utmp.c.
diff --git a/src/utmp.c b/src/utmp.c
index aae1948..fa8b87b 100644
--- a/src/utmp.c
+++ b/src/utmp.c
@@ -575,7 +575,7 @@ struct win *wi;
return ut_delete_user(slot, u.ut_pid, 0, 0) != 0;
#endif
#ifdef HAVE_UTEMPTER
- if (eff_uid && wi->w_ptyfd != -1)
+ if (eff_uid && wi && wi->w_ptyfd != -1)
{
/* sigh, linux hackers made the helper functions void */
if (SLOT_USED(u))
commit 4ebd6db10c712eb56d4e61f1a8d4a41d0465ed89
Author: Miroslav Lichvar <mlichvar@redhat.com>
Date: Thu Jan 13 17:36:06 2011 +0100
Add more tty checks.
diff --git a/src/extern.h b/src/extern.h
index 2b9722e..c787d99 100644
--- a/src/extern.h
+++ b/src/extern.h
@@ -110,6 +110,7 @@ extern void brktty __P((int));
extern struct baud_values *lookup_baud __P((int bps));
extern int SetBaud __P((struct mode *, int, int));
extern int SttyMode __P((struct mode *, char *));
+extern int CheckTtyname __P((char *));
/* mark.c */
diff --git a/src/screen.c b/src/screen.c
index 3dde3b4..cc8f565 100644
--- a/src/screen.c
+++ b/src/screen.c
@@ -970,8 +970,13 @@ char **av;
else \
attach_tty = ""; \
} \
- else if (stat(attach_tty, &st)) \
- Panic(errno, "Cannot access '%s'", attach_tty); \
+ else \
+ { \
+ if (stat(attach_tty, &st)) \
+ Panic(errno, "Cannot access '%s'", attach_tty); \
+ if (CheckTtyname(attach_tty)) \
+ Panic(0, "Bad tty '%s'", attach_tty); \
+ } \
if (strlen(attach_tty) >= MAXPATHLEN) \
Panic(0, "TtyName too long - sorry."); \
} while (0)
diff --git a/src/tty.sh b/src/tty.sh
index f2afd54..e264796 100644
--- a/src/tty.sh
+++ b/src/tty.sh
@@ -60,6 +60,7 @@ exit 0
#include <sys/types.h>
#include <signal.h>
#include <fcntl.h>
+#include <sys/stat.h>
#ifndef sgi
# include <sys/file.h>
#endif
@@ -1506,6 +1507,19 @@ int ibaud, obaud;
return 0;
}
+
+int
+CheckTtyname (tty)
+char *tty;
+{
+ struct stat st;
+
+ if (lstat(tty, &st) || !S_ISCHR(st.st_mode) ||
+ (st.st_nlink > 1 && strncmp(tty, "/dev/", 5)))
+ return -1;
+ return 0;
+}
+
/*
* Write out the mode struct in a readable form
*/
diff --git a/src/utmp.c b/src/utmp.c
index afa0948..aae1948 100644
--- a/src/utmp.c
+++ b/src/utmp.c
@@ -361,7 +361,7 @@ RemoveLoginSlot()
char *tty;
debug("couln't zap slot -> do mesg n\n");
D_loginttymode = 0;
- if ((tty = ttyname(D_userfd)) && stat(tty, &stb) == 0 && (int)stb.st_uid == real_uid && ((int)stb.st_mode & 0777) != 0666)
+ if ((tty = ttyname(D_userfd)) && stat(tty, &stb) == 0 && (int)stb.st_uid == real_uid && !CheckTtyname(tty) && ((int)stb.st_mode & 0777) != 0666)
{
D_loginttymode = (int)stb.st_mode & 0777;
chmod(D_usertty, stb.st_mode & 0600);
@@ -387,7 +387,7 @@ RestoreLoginSlot()
}
UT_CLOSE;
D_loginslot = (slot_t)0;
- if (D_loginttymode && (tty = ttyname(D_userfd)))
+ if (D_loginttymode && (tty = ttyname(D_userfd)) && !CheckTtyname(tty))
chmod(tty, D_loginttymode);
}
@@ -853,7 +853,7 @@ getlogin()
for (fd = 0; fd <= 2 && (tty = ttyname(fd)) == NULL; fd++)
;
- if ((tty == NULL) || ((fd = open(UTMP_FILE, O_RDONLY)) < 0))
+ if ((tty == NULL) || CheckTtyname(tty) || ((fd = open(UTMP_FILE, O_RDONLY)) < 0))
return NULL;
tty = stripdev(tty);
retbuf[0] = '\0';
commit 8e7fcb821dc7204a27d88707284e259444671c12
Author: Miroslav Lichvar <mlichvar@redhat.com>
Date: Thu Jan 13 17:31:16 2011 +0100
Don't assign address of auto variable to outer scope symbol.
diff --git a/src/socket.c b/src/socket.c
index 940034d..7507d75 100644
--- a/src/socket.c
+++ b/src/socket.c
@@ -722,6 +722,7 @@ struct msg *mp;
char *args[MAXARGS];
register int n;
register char **pp = args, *p = mp->m.create.line;
+ char buf[20];
nwin = nwin_undef;
n = mp->m.create.nargs;
@@ -731,7 +732,6 @@ struct msg *mp;
if (n)
{
int l, num;
- char buf[20];
l = strlen(p);
if (IsNumColon(p, 10, buf, sizeof(buf)))
commit 2a0e0dc7e05b36f374a074f6627efece3695f8c7
Author: Miroslav Lichvar <mlichvar@redhat.com>
Date: Thu Jan 13 17:24:04 2011 +0100
Remove redundant if statements.
diff --git a/src/braille_tsi.c b/src/braille_tsi.c
index 6768291..6f84913 100644
--- a/src/braille_tsi.c
+++ b/src/braille_tsi.c
@@ -127,7 +127,6 @@ display_status_tsi()
r = read(bd.bd_fd,ibuf,1);
if (r != 1)
return -1;
- if (r != -1)
if (ibuf[0] == 'V')
r = read(bd.bd_fd, ibuf, 3);
else
diff --git a/src/fileio.c b/src/fileio.c
index 88fbf64..bd29011 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -80,8 +80,6 @@ register char *str1, *str2;
}
else
{
- if (len1 == 0)
- return 0;
if ((cp = malloc((unsigned) len1 + add_colon + 1)) == NULL)
Panic(0, "%s", strnomem);
cp[len1 + add_colon] = '\0';
commit e75e7a0cf5319e10aae0c45e17ce70d86ef2aee8
Author: Miroslav Lichvar <mlichvar@redhat.com>
Date: Thu Jan 13 17:18:59 2011 +0100
Set PAM_TTY item.
diff --git a/src/attacher.c b/src/attacher.c
index 1fab5b2..460f1ea 100644
--- a/src/attacher.c
+++ b/src/attacher.c
@@ -861,6 +861,7 @@ screen_builtin_lck()
#ifdef USE_PAM
pam_handle_t *pamh = 0;
int pam_error;
+ char *tty_name;
#else
char *pass, mypass[16 + 1], salt[3];
#endif
@@ -932,6 +933,15 @@ screen_builtin_lck()
pam_error = pam_start("screen", ppp->pw_name, &PAM_conversation, &pamh);
if (pam_error != PAM_SUCCESS)
AttacherFinit(SIGARG); /* goodbye */
+
+ if (strncmp(attach_tty, "/dev/", 5) == 0)
+ tty_name = attach_tty + 5;
+ else
+ tty_name = attach_tty;
+ pam_error = pam_set_item(pamh, PAM_TTY, tty_name);
+ if (pam_error != PAM_SUCCESS)
+ AttacherFinit(SIGARG); /* goodbye */
+
pam_error = pam_authenticate(pamh, 0);
pam_end(pamh, pam_error);
PAM_conversation.appdata_ptr = 0;
commit eb2e13f633f9615e9b60f19e1649f46bd07b2802
Author: Miroslav Lichvar <mlichvar@redhat.com>
Date: Thu Jan 13 17:16:59 2011 +0100
Check return code from setgid/setuid.
diff --git a/src/attacher.c b/src/attacher.c
index 370d594..1fab5b2 100644
--- a/src/attacher.c
+++ b/src/attacher.c
@@ -185,8 +185,8 @@ int how;
if (ret == SIG_POWER_BYE)
{
int ppid;
- setgid(real_gid);
- setuid(real_uid);
+ if (setgid(real_gid) || setuid(real_uid))
+ Panic(errno, "setuid/gid");
if ((ppid = getppid()) > 1)
Kill(ppid, SIGHUP);
exit(0);
@@ -282,7 +282,10 @@ int how;
#ifdef MULTIUSER
if (!multiattach)
#endif
- setuid(real_uid);
+ {
+ if (setuid(real_uid))
+ Panic(errno, "setuid");
+ }
#if defined(MULTIUSER) && defined(USE_SETEUID)
else
{
@@ -290,7 +293,8 @@ int how;
xseteuid(real_uid); /* multi_uid, allow backend to send signals */
}
#endif
- setgid(real_gid);
+ if (setgid(real_gid))
+ Panic(errno, "setgid");
eff_uid = real_uid;
eff_gid = real_gid;
@@ -486,7 +490,8 @@ AttacherFinit SIGDEFARG
#ifdef MULTIUSER
if (tty_oldmode >= 0)
{
- setuid(own_uid);
+ if (setuid(own_uid))
+ Panic(errno, "setuid");
chmod(attach_tty, tty_oldmode);
}
#endif
@@ -504,11 +509,14 @@ AttacherFinitBye SIGDEFARG
if (multiattach)
exit(SIG_POWER_BYE);
#endif
- setgid(real_gid);
+ if (setgid(real_gid))
+ Panic(errno, "setgid");
#ifdef MULTIUSER
- setuid(own_uid);
+ if (setuid(own_uid))
+ Panic(errno, "setuid");
#else
- setuid(real_uid);
+ if (setuid(real_uid))
+ Panic(errno, "setuid");
#endif
/* we don't want to disturb init (even if we were root), eh? jw */
if ((ppid = getppid()) > 1)
@@ -679,11 +687,14 @@ static sigret_t
LockHup SIGDEFARG
{
int ppid = getppid();
- setgid(real_gid);
+ if (setgid(real_gid))
+ Panic(errno, "setgid");
#ifdef MULTIUSER
- setuid(own_uid);
+ if (setuid(own_uid))
+ Panic(errno, "setuid");
#else
- setuid(real_uid);
+ if (setuid(real_uid))
+ Panic(errno, "setuid");
#endif
if (ppid > 1)
Kill(ppid, SIGHUP);
@@ -710,11 +721,14 @@ LockTerminal()
if ((pid = fork()) == 0)
{
/* Child */
- setgid(real_gid);
+ if (setgid(real_gid))
+ Panic(errno, "setgid");
#ifdef MULTIUSER
- setuid(own_uid);
+ if (setuid(own_uid))
+ Panic(errno, "setuid");
#else
- setuid(real_uid); /* this should be done already */
+ if (setuid(real_uid)) /* this should be done already */
+ Panic(errno, "setuid");
#endif
closeallfiles(0); /* important: /etc/shadow may be open */
execl(prg, "SCREEN-LOCK", NULL);

@ -1,40 +0,0 @@
diff --git a/src/help.c b/src/help.c
index 095f96b..a2b8614 100644
--- a/src/help.c
+++ b/src/help.c
@@ -86,12 +86,14 @@ char *myname, *message, *arg;
#if defined(LOGOUTOK) && defined(UTMPOK)
printf("-l Login mode on (update %s), -ln = off.\n", UTMPFILE);
#endif
- printf("-ls [match] or -list. Do nothing, just list our SockDir [on possible matches].\n");
+ printf("-ls [match] or\n");
+ printf("-list Do nothing, just list our SockDir [on possible matches].\n");
printf("-L Turn on output logging.\n");
printf("-m ignore $STY variable, do create a new screen session.\n");
printf("-O Choose optimal output rather than exact vt100 emulation.\n");
printf("-p window Preselect the named window if it exists.\n");
printf("-q Quiet startup. Exits with non-zero return code if unsuccessful.\n");
+ printf("-Q Commands will send the response to the stdout of the querying process.\n");
printf("-r [session] Reattach to a detached screen process.\n");
printf("-R Reattach if possible, otherwise start a new session.\n");
printf("-s shell Shell to execute rather than $SHELL.\n");
diff --git a/src/help.c.ipv6 b/src/help.c.ipv6
index 8726b1b..8446f34 100644
--- a/src/help.c.ipv6
+++ b/src/help.c.ipv6
@@ -82,12 +82,14 @@ char *myname, *message, *arg;
#if defined(LOGOUTOK) && defined(UTMPOK)
printf("-l Login mode on (update %s), -ln = off.\n", UTMPFILE);
#endif
- printf("-ls [match] or -list. Do nothing, just list our SockDir [on possible matches].\n");
+ printf("-ls [match] or\n");
+ printf("-list Do nothing, just list our SockDir [on possible matches].\n");
printf("-L Turn on output logging.\n");
printf("-m ignore $STY variable, do create a new screen session.\n");
printf("-O Choose optimal output rather than exact vt100 emulation.\n");
printf("-p window Preselect the named window if it exists.\n");
printf("-q Quiet startup. Exits with non-zero return code if unsuccessful.\n");
+ printf("-Q Commands will send the response to the stdout of the querying process.\n");
printf("-r [session] Reattach to a detached screen process.\n");
printf("-R Reattach if possible, otherwise start a new session.\n");
printf("-s shell Shell to execute rather than $SHELL.\n");

@ -1,23 +1,26 @@
diff -up screen/src/doc/screen.1.ipv6 screen/src/doc/screen.1
--- screen/src/doc/screen.1.ipv6 2010-11-11 03:47:46.000000000 +0100
+++ screen/src/doc/screen.1 2011-02-03 16:05:35.957087079 +0100
@@ -398,6 +398,12 @@ Send the specified command to a running
the \fB-d\fP or \fB-r\fP option to tell screen to look only for
attached or detached screen sessions. Note that this command doesn't
work if the session is password protected.
diff --git a/doc/screen.1 b/doc/screen.1
index fd5c06e..3703596 100644
--- a/doc/screen.1
+++ b/doc/screen.1
@@ -403,6 +403,13 @@ several screen sessions running. You can use the \fB-d\fP or
\fB-r\fP option to tell screen to look only for attached or
detached screen sessions. Note that this command doesn't work if
the session is password protected.
+.TP 5
+.B \-4
+Resolve hostnames only to IPv4 addresses.
+.TP 5
+.B \-6
+Resolve hostnames only to IPv6 addresses.
+
.SH "DEFAULT KEY BINDINGS"
.ta 12n 26n
diff -up screen/src/extern.h.ipv6 screen/src/extern.h
--- screen/src/extern.h.ipv6 2010-11-11 03:47:46.000000000 +0100
+++ screen/src/extern.h 2011-02-03 16:04:35.995743620 +0100
@@ -455,8 +455,7 @@ extern void ExitOverlayPage __P((void))
diff --git a/extern.h b/extern.h
index a3e3ca2..9b564e6 100644
--- a/extern.h
+++ b/extern.h
@@ -459,8 +459,7 @@ extern void LayProcessMouseSwitch __P((struct layer *, int));
/* teln.c */
#ifdef BUILTIN_TELNET
@ -27,9 +30,10 @@ diff -up screen/src/extern.h.ipv6 screen/src/extern.h
extern int TelIsline __P((struct win *p));
extern void TelProcessLine __P((char **, int *));
extern int DoTelnet __P((char *, int *, int));
diff -up screen/src/help.c.ipv6 screen/src/help.c
--- screen/src/help.c.ipv6 2010-11-11 03:47:46.000000000 +0100
+++ screen/src/help.c 2011-02-03 16:04:35.992744154 +0100
diff --git a/help.c b/help.c
index 8446f34..a2b8614 100644
--- a/help.c
+++ b/help.c
@@ -66,6 +66,10 @@ char *myname, *message, *arg;
{
printf("Use: %s [-opts] [cmd [args]]\n", myname);
@ -41,22 +45,22 @@ diff -up screen/src/help.c.ipv6 screen/src/help.c
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");
diff -up screen/src/screen.c.ipv6 screen/src/screen.c
--- screen/src/screen.c.ipv6 2010-11-11 03:47:46.000000000 +0100
+++ screen/src/screen.c 2011-02-03 16:04:35.994743798 +0100
@@ -248,8 +248,9 @@ struct layer *flayer;
struct win *fore;
struct win *windows;
diff --git a/screen.c b/screen.c
index 473e4fa..c193f46 100644
--- a/screen.c
+++ b/screen.c
@@ -250,6 +250,10 @@ struct win *windows;
struct win *console_window;
-
-
+#ifdef BUILTIN_TELNET
+int af;
+#endif
+
/*
* Do this last
@@ -507,6 +508,9 @@ char **av;
@@ -507,6 +511,9 @@ char **av;
nwin = nwin_undef;
nwin_options = nwin_undef;
strcpy(screenterm, "screen");
@ -66,7 +70,7 @@ diff -up screen/src/screen.c.ipv6 screen/src/screen.c
logreopen_register(lf_secreopen);
@@ -541,6 +545,14 @@ char **av;
@@ -541,6 +548,14 @@ char **av;
{
switch (*ap)
{
@ -81,9 +85,10 @@ diff -up screen/src/screen.c.ipv6 screen/src/screen.c
case 'a':
nwin_options.aflag = 1;
break;
diff -up screen/src/teln.c.ipv6 screen/src/teln.c
--- screen/src/teln.c.ipv6 2010-11-11 03:47:46.000000000 +0100
+++ screen/src/teln.c 2011-02-03 16:04:35.992744154 +0100
diff --git a/teln.c b/teln.c
index 1764dbc..5f0cb0b 100644
--- a/teln.c
+++ b/teln.c
@@ -30,6 +30,7 @@
#include <sys/socket.h>
#include <fcntl.h>
@ -92,7 +97,7 @@ diff -up screen/src/teln.c.ipv6 screen/src/teln.c
#include "config.h"
@@ -42,12 +43,13 @@ extern struct win *fore;
@@ -42,12 +43,14 @@ extern struct win *fore;
extern struct layer *flayer;
extern int visual_bell;
extern char screenterm[];
@ -101,14 +106,14 @@ diff -up screen/src/teln.c.ipv6 screen/src/teln.c
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
@@ -105,86 +107,78 @@ char *data;
@@ -105,86 +108,76 @@ char *data;
}
int
@ -137,6 +142,7 @@ diff -up screen/src/teln.c.ipv6 screen/src/teln.c
- char **args;
+TelOpenAndConnect(struct win *p) {
+ int fd, on = 1;
+ struct addrinfo hints, *res0, *res;
char buf[256];
- args = p->w_cmdargs + 1;
@ -145,7 +151,31 @@ diff -up screen/src/teln.c.ipv6 screen/src/teln.c
- {
- Msg(0, "Usage: screen //telnet host [port]");
- return -1;
- }
+ 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 (args[1])
- port = atoi(args[1]);
- p->w_telsa.sin_family = AF_INET;
@ -188,40 +218,6 @@ diff -up screen/src/teln.c.ipv6 screen/src/teln.c
- 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");
+
@ -251,7 +247,12 @@ diff -up screen/src/teln.c.ipv6 screen/src/teln.c
+ return -1;
+ }
+ }
+ }
}
- else
- WriteString(p, "connected.\r\n", 12);
- if (port == TEL_DEFPORT)
- TelReply(p, (char *)tn_init, sizeof(tn_init));
- return 0;
+ else
+ WriteString(p, "connected.\r\n", 12);
+ if (!(p->w_cmdargs[2] && strcmp(p->w_cmdargs[2], TEL_DEFPORT)))
@ -265,13 +266,14 @@ diff -up screen/src/teln.c.ipv6 screen/src/teln.c
}
int
diff -up screen/src/window.c.ipv6 screen/src/window.c
--- screen/src/window.c.ipv6 2010-11-11 03:47:46.000000000 +0100
+++ screen/src/window.c 2011-02-03 16:30:56.900750293 +0100
@@ -605,6 +605,13 @@ struct NewWindow *newwin;
diff --git a/window.c b/window.c
index c9d6817..2ad6041 100644
--- a/window.c
+++ b/window.c
@@ -610,6 +610,13 @@ struct NewWindow *newwin;
#endif
n = pp - wtab;
debug1("Makewin creating %d\n", n);
+#ifdef BUILTIN_TELNET
+ if(!strcmp(nwin.args[0], "//telnet")) {
+ type = W_TYPE_TELNET;
@ -279,10 +281,10 @@ diff -up screen/src/window.c.ipv6 screen/src/window.c
+ }
+ else
+#endif
if ((f = OpenDevice(nwin.args, nwin.lflag, &type, &TtyName)) < 0)
return -1;
if (type == W_TYPE_GROUP)
@@ -766,7 +773,7 @@ struct NewWindow *newwin;
@@ -772,7 +779,7 @@ struct NewWindow *newwin;
#ifdef BUILTIN_TELNET
if (type == W_TYPE_TELNET)
{
@ -291,7 +293,7 @@ diff -up screen/src/window.c.ipv6 screen/src/window.c
{
FreeWindow(p);
return -1;
@@ -878,6 +885,13 @@ struct win *p;
@@ -884,6 +891,13 @@ struct win *p;
int lflag, f;
lflag = nwin_default.lflag;
@ -305,7 +307,7 @@ diff -up screen/src/window.c.ipv6 screen/src/window.c
if ((f = OpenDevice(p->w_cmdargs, lflag, &p->w_type, &TtyName)) < 0)
return -1;
@@ -909,7 +923,7 @@ struct win *p;
@@ -917,7 +931,7 @@ struct win *p;
#ifdef BUILTIN_TELNET
if (p->w_type == W_TYPE_TELNET)
{
@ -314,7 +316,7 @@ diff -up screen/src/window.c.ipv6 screen/src/window.c
return -1;
}
else
@@ -1068,16 +1082,6 @@ char **namep;
@@ -1076,16 +1090,6 @@ char **namep;
*namep = "telnet";
return 0;
}
@ -331,9 +333,10 @@ diff -up screen/src/window.c.ipv6 screen/src/window.c
if (strncmp(arg, "//", 2) == 0)
{
Msg(0, "Invalid argument '%s'", arg);
diff -up screen/src/window.h.ipv6 screen/src/window.h
--- screen/src/window.h.ipv6 2010-11-11 03:47:46.000000000 +0100
+++ screen/src/window.h 2011-02-03 16:04:35.989744687 +0100
diff --git a/window.h b/window.h
index 7311ecb..7fc7c72 100644
--- a/window.h
+++ b/window.h
@@ -268,7 +268,7 @@ struct win
struct display *w_zdisplay;
#endif

@ -1,13 +0,0 @@
diff --git a/src/doc/screen.1 b/src/doc/screen.1
index 70b39df..22d8dc8 100644
--- a/src/doc/screen.1
+++ b/src/doc/screen.1
@@ -3058,7 +3058,7 @@ Stuff the string
.I string
in the input buffer of the current window.
This is like the \*Qpaste\*U command but with much less overhead.
-Without a paramter, screen will prompt for a string to stuff.
+Without a parameter, screen will prompt for a string to stuff.
You cannot paste
large buffers with the \*Qstuff\*U command. It is most useful for key
bindings. See also \*Qbindkey\*U.

@ -23,15 +23,10 @@ Source1: screen.pam
Patch1: screen-4.0.3-libs.patch
Patch2: screen-4.0.3-screenrc.patch
Patch3: screen-ipv6.patch
Patch4: screen-cc.patch
Patch5: screen-E3.patch
Patch6: screen-4.1.0-suppress_remap.patch
Patch7: screen-4.1.0-reattach.patch
Patch8: screen-4.1.0-crypt.patch
Patch9: screen-4.1.0-long-term.patch
Patch10: screen-help-update.patch
Patch11: screen-altscreen.patch
Patch12: screen-man-update.patch
Patch4: screen-E3.patch
Patch5: screen-4.1.0-suppress_remap.patch
Patch6: screen-4.2.1-crypt.patch
Patch7: screen-altscreen.patch
%description
The screen utility allows you to have multiple logins on just one
@ -44,19 +39,14 @@ support multiple logins on one terminal.
%prep
%setup -q -n screen/src
%setup -q -n %{name}-%{version}
%patch1 -p1 -b .libs
%patch2 -p1 -b .screenrc
%patch3 -p2 -b .ipv6
%patch4 -p2 -b .cc
%patch5 -p2 -b .E3
%patch6 -p1 -b .suppress_remap
%patch7 -p2 -b .reattach
%patch8 -p2 -b .crypto
%patch9 -p2 -b .long-term
%patch10 -p2 -b .help-update
%patch11 -p2 -b .altscreen.patch
%patch12 -p2 -b .man-update.patch
%patch3 -p1 -b .ipv6
%patch4 -p1 -b .E3
%patch5 -p1 -b .suppress_remap
%patch6 -p1 -b .crypto
%patch7 -p1 -b .altscreen.patch
%build
@ -91,7 +81,7 @@ make
rm -rf $RPM_BUILD_ROOT
make install DESTDIR=$RPM_BUILD_ROOT
mv -f $RPM_BUILD_ROOT%{_bindir}/screen{-4.1.0,}
mv -f $RPM_BUILD_ROOT%{_bindir}/screen{-%{version},}
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}
install -m 0644 etc/etcscreenrc $RPM_BUILD_ROOT%{_sysconfdir}/screenrc

Loading…
Cancel
Save