int match = -1;
int firstmatch = -1;
int nmatches = 0;
- char findname[21];
+ char findname[DGL_PLAYERNAMELEN+1];
if (len <= 0) break;
findname[0] = '\0';
mvprintw ((btm+2+top_banner_hei), 1, "Watch which player? => "); /* stupid... */
mvaddstr ((btm+2+top_banner_hei), 1, "Watch which player? => ");
- if ((mygetnstr(findname, 20, 1) == OK) && (strlen(findname) > 1)) {
+ if ((mygetnstr(findname, DGL_PLAYERNAMELEN, 1) == OK) && (strlen(findname) > 1)) {
int mlen = strlen(findname);
for (i = 0; i < len; i++)
if (!strncasecmp(games[i]->name, findname, mlen)) {
void
loginprompt (int from_ttyplay)
{
- char user_buf[22], pw_buf[22];
+ char user_buf[DGL_PLAYERNAMELEN+1], pw_buf[22];
int error = 2;
loggedin = 0;
refresh ();
- /* keep this at 20 chars for hysterical raisins */
- if (mygetnstr (user_buf, 20, 1) != OK)
+ if (mygetnstr (user_buf, DGL_PLAYERNAMELEN, 1) != OK)
return;
if (*user_buf == '\0')
for (i = 0; i < f_num; i++)
{
- if (!strncasecmp (cname, users[i]->username, (isnew ? globalconfig.max_newnick_len : 20))) {
+ if (!strncasecmp (cname, users[i]->username, (isnew ? globalconfig.max_newnick_len : DGL_PLAYERNAMELEN))) {
userexist_tmp_me = cpy_me(users[i]);
return userexist_tmp_me;
}
char *qbuf;
- char tmpbuf[32];
- strncpy(tmpbuf, cname, (isnew ? globalconfig.max_newnick_len : 20));
+ char tmpbuf[DGL_PLAYERNAMELEN+2];
+ strncpy(tmpbuf, cname, (isnew ? globalconfig.max_newnick_len : DGL_PLAYERNAMELEN));
/* Check that the nick doesn't interfere with already registered nicks */
if (isnew && (strlen(cname) >= globalconfig.max_newnick_len))
for (i = 0; i < f_num; i++)
{
- if (loggedin && !strncmp (me->username, users[i]->username, 20))
+ if (loggedin && !strncmp (me->username, users[i]->username, DGL_PLAYERNAMELEN))
{
if (requirenew)
{
authenticate ()
{
int i, len, me_index;
- char user_buf[22], pw_buf[22];
+ char user_buf[DGL_PLAYERNAMELEN+1], pw_buf[22];
struct dg_game **games = NULL;
/* We use simple password authentication, rather than challenge/response. */
user_buf[--len] = '\0';
else
{
- fprintf (stderr, "Username too long (max 20 chars).\n");
+ fprintf (stderr, "Username too long (max %i chars).\n", DGL_PLAYERNAMELEN);
return 1;
}
DIR *pdir;
struct dirent *pdirent;
struct stat pstat;
- char fullname[130], ttyrecname[130], pidws[80], playername[30];
+ char fullname[130], ttyrecname[130], pidws[80], playername[DGL_PLAYERNAMELEN+1];
char *replacestr, *dir, *p;
struct dg_game **games = NULL;
struct flock fl = { 0 };
if (!is_nhext)
{
char *ttrecdir = NULL;
- strncpy(playername, pdirent->d_name, 29);
- playername[29] = '\0';
+ strncpy(playername, pdirent->d_name, DGL_PLAYERNAMELEN);
+ playername[DGL_PLAYERNAMELEN] = '\0';
if ((replacestr = strchr(playername, ':')))
*replacestr = '\0';
if (!globalconfig.chroot) globalconfig.chroot = "/var/lib/dgamelaunch/";
if (globalconfig.max == 0) globalconfig.max = 64000;
- if (globalconfig.max_newnick_len == 0) globalconfig.max_newnick_len = 20;
+ if (globalconfig.max_newnick_len == 0) globalconfig.max_newnick_len = DGL_PLAYERNAMELEN;
if (!globalconfig.dglroot) globalconfig.dglroot = "/dgldir/";
if (!globalconfig.banner) globalconfig.banner = "/dgl-banner";