>From 32d50dc39eb413e7b6f22b4f920567014e79c0bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Amadeusz=20S=C5=82awi=C5=84ski?= Date: Sat, 6 Oct 2012 14:35:12 +0200 Subject: [PATCH] Allow screen to run for users with long logins Seems like logins can be as long as 32 characters Also just include screen.h in comm.c so we don't have to include os.h --- src/acls.c | 2 +- src/acls.h | 2 +- src/comm.c | 5 +---- src/os.h | 5 +++++ src/screen.c | 4 ++-- src/screen.h | 9 +++++---- src/socket.c | 2 +- 7 files changed, 16 insertions(+), 13 deletions(-) diff --git a/src/acls.c b/src/acls.c index 2f8c809..178d7ba 100644 --- a/src/acls.c +++ b/src/acls.c @@ -182,7 +182,7 @@ struct acluser **up; #endif (*up)->u_Esc = DefaultEsc; (*up)->u_MetaEsc = DefaultMetaEsc; - strncpy((*up)->u_name, name, 20); + strncpy((*up)->u_name, name, MAXLOGINLEN); (*up)->u_password = NULL; if (pass) (*up)->u_password = SaveStr(pass); diff --git a/src/acls.h b/src/acls.h index 907e953..42c7c18 100644 --- a/src/acls.h +++ b/src/acls.h @@ -78,7 +78,7 @@ struct plop typedef struct acluser { struct acluser *u_next; /* continue the main user list */ - char u_name[20+1]; /* login name how he showed up */ + char u_name[MAXLOGINLEN + 1]; /* login name how he showed up */ char *u_password; /* his password (may be NullStr). */ int u_checkpassword; /* nonzero if this u_password is valid */ int u_detachwin; /* the window where he last detached */ diff --git a/src/comm.c b/src/comm.c index 5f4af8a..928f1ac 100644 --- a/src/comm.c +++ b/src/comm.c @@ -36,10 +36,7 @@ */ #include "config.h" -#include "acls.h" -#include "comm.h" - -#define bcopy :-( /* or include screen.h here */ +#include "screen.h" /* Must be in alpha order ! */ diff --git a/src/os.h b/src/os.h index f1d849c..c7b1592 100644 --- a/src/os.h +++ b/src/os.h @@ -311,6 +311,11 @@ extern int errno; # define LOGINDEFAULT 1 #endif +#if defined(UT_NAMESIZE) && !defined(MAXLOGINLEN) +# define MAXLOGINLEN UT_NAMESIZE +#else +# define MAXLOGINLEN 32 +#endif /***************************************************************** * file stuff diff --git a/src/screen.c b/src/screen.c index 6e19732..aacacf6 100644 --- a/src/screen.c +++ b/src/screen.c @@ -978,10 +978,10 @@ char **av; 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) diff --git a/src/screen.h b/src/screen.h index c7d38a3..787b635 100644 --- a/src/screen.h +++ b/src/screen.h @@ -183,8 +183,9 @@ struct mode * carried version 1, but should have carried 2. * 2: screen version 4.1.0devel (revisions 8b46d8a upto YYYYYYY) * 3: screen version 4.1.0devel + * 4: screen version 4.1.0devel */ -#define MSG_VERSION 3 +#define MSG_VERSION 4 #define MSG_REVISION (('m'<<24) | ('s'<<16) | ('g'<<8) | MSG_VERSION) struct msg @@ -208,7 +209,7 @@ struct msg create; struct { - char auser[20 + 1]; /* username */ + char auser[MAXLOGINLEN + 1]; /* username */ int apid; /* pid of frontend */ int adaptflag; /* adapt window size? */ int lines, columns; /* display size */ @@ -222,13 +223,13 @@ struct msg attach; struct { - char duser[20 + 1]; /* username */ + char duser[MAXLOGINLEN + 1]; /* username */ int dpid; /* pid of frontend */ } detach; struct { - char auser[20 + 1]; /* username */ + char auser[MAXLOGINLEN + 1]; /* username */ int nargs; char cmd[MAXPATHLEN]; /* command */ int apid; /* pid of frontend */ diff --git a/src/socket.c b/src/socket.c index a7755a4..711c709 100644 --- a/src/socket.c +++ b/src/socket.c @@ -1528,7 +1528,7 @@ static void PasswordProcessInput __P((char *, int)); struct pwdata { int l; - char buf[20 + 1]; + char buf[MAXLOGINLEN + 1]; struct msg m; }; -- 1.8.1.4