Description: Patch to allow usernames longer than 20 characters. Source: http://www.mail-archive.com/screen-devel@gnu.org/msg00186.html Author: Steve Kemp Upstream-Bug: http://savannah.gnu.org/bugs/?21653 Debian-Bug: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=560231 Ubuntu-Bug: https://bugs.launchpad.net/ubuntu/+source/screen/+bug/582153 Index: screen/acconfig.h =================================================================== --- screen.orig/acconfig.h 2011-10-08 21:20:48.000000000 +0200 +++ screen/acconfig.h 2011-10-08 21:20:57.000000000 +0200 @@ -39,6 +39,13 @@ #endif /* + * Length of longest username. + */ +#ifndef MAX_USERNAME_LEN +# define MAX_USERNAME_LEN 50 +#endif + +/* * Define SOCKDIR to be the directory to contain the named sockets * screen creates. This should be in a common subdirectory, such as * /usr/local or /tmp. It makes things a little more secure if you Index: screen/acls.c =================================================================== --- screen.orig/acls.c 2011-10-08 21:20:48.000000000 +0200 +++ screen/acls.c 2011-10-08 21:20:57.000000000 +0200 @@ -182,7 +182,7 @@ #endif (*up)->u_Esc = DefaultEsc; (*up)->u_MetaEsc = DefaultMetaEsc; - strncpy((*up)->u_name, name, 20); + strncpy((*up)->u_name, name, MAX_USERNAME_LEN); (*up)->u_password = NULL; if (pass) (*up)->u_password = SaveStr(pass); @@ -318,8 +318,8 @@ return UserAdd(name, pass, up); if (!strcmp(name, "nobody")) /* he remains without password */ return -1; - strncpy((*up)->u_password, pass ? pass : "", 20); - (*up)->u_password[20] = '\0'; + strncpy((*up)->u_password, pass ? pass : "", MAX_USERNAME_LEN); + (*up)->u_password[MAX_USERNAME_LEN] = '\0'; return 0; } #endif Index: screen/acls.h =================================================================== --- screen.orig/acls.h 2011-10-08 21:20:48.000000000 +0200 +++ screen/acls.h 2011-10-08 21:20:57.000000000 +0200 @@ -78,7 +78,7 @@ 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[MAX_USERNAME_LEN+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 */ Index: screen/screen.c =================================================================== --- screen.orig/screen.c 2011-10-08 21:20:56.000000000 +0200 +++ screen/screen.c 2011-10-08 21:20:57.000000000 +0200 @@ -997,7 +997,7 @@ if (home == 0 || *home == '\0') home = ppp->pw_dir; - if (strlen(LoginName) > 20) + if (strlen(LoginName) > MAX_USERNAME_LEN) Panic(0, "LoginName too long - sorry."); #ifdef MULTIUSER if (multi && strlen(multi) > 20) Index: screen/screen.h =================================================================== --- screen.orig/screen.h 2011-10-08 21:20:48.000000000 +0200 +++ screen/screen.h 2011-10-08 21:20:57.000000000 +0200 @@ -207,7 +207,7 @@ create; struct { - char auser[20 + 1]; /* username */ + char auser[MAX_USERNAME_LEN + 1]; /* username */ int apid; /* pid of frontend */ int adaptflag; /* adapt window size? */ int lines, columns; /* display size */ @@ -221,13 +221,13 @@ attach; struct { - char duser[20 + 1]; /* username */ + char duser[MAX_USERNAME_LEN + 1]; /* username */ int dpid; /* pid of frontend */ } detach; struct { - char auser[20 + 1]; /* username */ + char auser[MAX_USERNAME_LEN + 1]; /* username */ int nargs; char cmd[MAXPATHLEN]; /* command */ int apid; /* pid of frontend */