summaryrefslogtreecommitdiff
path: root/screen.c
diff options
context:
space:
mode:
authorAxel Beckert <abe@deuxchevaux.org>2014-04-28 02:46:50 +0200
committerAxel Beckert <abe@deuxchevaux.org>2014-04-28 02:46:50 +0200
commit285cd429f731082e1378c7e1362b083103c8a426 (patch)
tree90ce9c284c2812055530b6577591d725e125f75b /screen.c
parentc3927cc39106d6b7cd746109784b6e8af203ec6b (diff)
downloadscreen-upstream.tar.gz
Imported Upstream version 4.2.1upstream/4.2.1upstream
Diffstat (limited to 'screen.c')
-rw-r--r--screen.c25
1 files changed, 18 insertions, 7 deletions
diff --git a/screen.c b/screen.c
index 6e19732..473e4fa 100644
--- a/screen.c
+++ b/screen.c
@@ -655,6 +655,8 @@ char **av;
}
break;
case 'w':
+ if (strcmp(ap+1, "ipe"))
+ exit_with_usage(myname, "Unknown option %s", --ap);
lsflag = 1;
wipeflag = 1;
if (ac > 1 && !SockMatch)
@@ -970,18 +972,23 @@ 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)
if (home == 0 || *home == '\0')
home = ppp->pw_dir;
- if (strlen(LoginName) > 20)
+ if (strlen(LoginName) > MAXLOGINLEN)
Panic(0, "LoginName too long - sorry.");
#ifdef MULTIUSER
- if (multi && strlen(multi) > 20)
+ if (multi && strlen(multi) > MAXLOGINLEN)
Panic(0, "Screen owner name too long - sorry.");
#endif
if (strlen(home) > MAXPATHLEN - 25)
@@ -1108,7 +1115,7 @@ char **av;
sprintf(SockPath, "%s/S-%s", SockDir, LoginName);
if (access(SockPath, F_OK))
{
- if (mkdir(SockPath, 0700) == -1)
+ if (mkdir(SockPath, 0700) == -1 && errno != EEXIST)
Panic(errno, "Cannot make directory '%s'", SockPath);
(void) chown(SockPath, real_uid, real_gid);
}
@@ -1164,8 +1171,12 @@ char **av;
#endif
SET_GUID();
i = FindSocket((int *)NULL, &fo, &oth, SockMatch);
- if (quietflag)
- exit(8 + (fo ? ((oth || i) ? 2 : 1) : 0) + i);
+ if (quietflag) {
+ if (rflag)
+ exit(10 + i);
+ else
+ exit(9 + (fo || oth ? 1 : 0) + fo);
+ }
if (fo == 0)
Panic(0, "No Sockets found in %s.\n", SockPath);
Panic(0, "%d Socket%s in %s.\n", fo, fo > 1 ? "s" : "", SockPath);