Honor case in login name. Also fix ttyrec path, probably lost in

strcpy->snprintf transition.


git-svn-id: svn://katsu.triplehelix.org/dgamelaunch/trunk@7 db0b04b0-f4d1-0310-9a6d-de3e77497b0e
This commit is contained in:
Joshua Kwan 2003-12-30 23:33:58 +00:00
parent 6f642ea6bf
commit c8d5020711
2 changed files with 26 additions and 5 deletions

View File

@ -537,9 +537,10 @@ freefile ()
free (users[i]);
}
free(users);
if (users)
free(users);
users = NULL;
me = NULL;
f_num = 0;
}
@ -558,6 +559,20 @@ initncurses ()
/* ************************************************************* */
struct dg_user *
deep_copy (struct dg_user * src)
{
struct dg_user *dest = malloc(sizeof (struct dg_user));
dest->username = strdup(src->username);
dest->email = strdup(src->email);
dest->env = strdup(src->env);
dest->password = strdup(src->password);
dest->flags = src->flags;
return dest;
}
void
login ()
{
@ -593,7 +608,7 @@ login ()
if ((me_index = userexist (user_buf)) != -1)
{
me = users[me_index];
me = deep_copy(users[me_index]);
error = 0;
}
}
@ -657,6 +672,8 @@ newuser ()
getnstr (buf, 20);
if (userexist (buf) == -1)
error = 0;
else
error = 1;
for (i = 0; i < strlen (buf); i++)
{
@ -1090,6 +1107,9 @@ main (void)
/* NOW we can safely kill this */
freefile ();
if (me)
free(me);
exit (1);
return 1;

View File

@ -104,12 +104,13 @@ ttyrec_main (char *username)
void finish ();
char dirname[100];
snprintf (dirname, 100, "/%s%s%s", LOC_TTYRECDIR, username,
ttyrec_filename);
snprintf (dirname, 100, "%s%s", LOC_TTYRECDIR, username);
if (access(dirname, F_OK) != 0)
mkdir (dirname, 0755);
snprintf (dirname, 100, "%s%s/%s", LOC_TTYRECDIR, username, ttyrec_filename);
if ((fscript = fopen (dirname, "w")) == NULL)
{
perror (dirname);