argv@island.uu.net (Dan Heller) (06/04/89)
Submitted-by: Richard Johnson <raj%tertius.ics.uci.edu@PARIS.ICS.UCI.EDU> Posting-number: Volume 4, Issue 16 Archive-name: xgone/patch1 [ The patch that Richard sent me didn't quite apply to the version that was originally posted, so I modified it somewhat so that it would. The patch fixes a problem where the program would dump if you typed too many characters at the password prompt. --argv ] *** patchlevel.h.orig Sat Jun 3 14:49:59 1989 --- patchlevel.h Sat Jun 3 14:50:05 1989 *************** *** 1 **** ! #define PATCHLEVEL 0 --- 1 ---- ! #define PATCHLEVEL 1 *** xgone.c.orig Sat Jun 3 14:41:13 1989 --- xgone.c Sat Jun 3 14:51:38 1989 *************** *** 20,25 **** --- 20,26 ---- #define FALSE 0 #define TRUE 1 #define UTMP "/etc/utmp" /* the utmp file */ + #define RESPBUFSIZ 100 /* size of response from user */ #define control(a) ((a) - ('@')) /* control characters */ char DspMsg[1024]="X Gone"; /* Default message to display */ *************** *** 51,58 **** XColor whitecolor; Pixmap pixmap; Cursor cursor; ! char buffer[100], inputbuf[80], *string, *user_name ! ,*getenv(), *ctime(), *rindex(), response[100]; char *crypt(), *pw, root_pw[20], *user_passwd; int len, password_bad = 1, response_i, nbytes, i; struct passwd *u; --- 52,60 ---- XColor whitecolor; Pixmap pixmap; Cursor cursor; ! char buffer[100], inputbuf[80], *string, *user_name, ! *getenv(), *ctime(), *rindex(), ! response[RESPBUFSIZ]; char *crypt(), *pw, root_pw[20], *user_passwd; int len, password_bad = 1, response_i, nbytes, i; struct passwd *u; *************** *** 284,293 **** response_i--; /* delete */ else if(inputbuf[i] == control('U')) response_i = 1; /* reset to first char */ ! else { response[response_i] = inputbuf[i++]; if(response[response_i++] == '\r') break; ! } } } if(response[response_i - 1] == '\r') break; /* finished */ --- 286,296 ---- response_i--; /* delete */ else if(inputbuf[i] == control('U')) response_i = 1; /* reset to first char */ ! else if(response_i < RESPBUFSIZ) { response[response_i] = inputbuf[i++]; if(response[response_i++] == '\r') break; ! } else /* too many char's */ ! XBell(dpy, 100 /* % */); } } if(response[response_i - 1] == '\r') break; /* finished */