Added automatic creation of new password file

SVN revision: 202
This commit is contained in:
Stefan Ritt 2002-08-06 09:26:16 +00:00
parent f047036be2
commit 6de938eaa0

22
elogd.c
View File

@ -6,6 +6,9 @@
Contents: Web server program for Electronic Logbook ELOG Contents: Web server program for Electronic Logbook ELOG
$Log$ $Log$
Revision 2.58 2002/08/06 09:26:16 midas
Added automatic creation of new password file
Revision 2.57 2002/08/06 09:03:41 midas Revision 2.57 2002/08/06 09:03:41 midas
Removed itoa() Removed itoa()
@ -4733,8 +4736,14 @@ int i, size;
f = fopen(file_name, "r+b"); f = fopen(file_name, "r+b");
if (f == NULL) if (f == NULL)
{ {
show_error(""); /* try to create file */
return 0; f = fopen(file_name, "wb");
if (f == NULL)
{
sprintf(str, loc("Cannot open file <b>%s</b>"), file_name);
show_error(str);
return 0;
}
} }
fseek(f, 0, SEEK_END); fseek(f, 0, SEEK_END);
@ -8316,7 +8325,12 @@ int i;
return TRUE; return TRUE;
} }
else else
return FALSE; {
if (user[0])
return FALSE;
else
return TRUE;
}
} }
/*------------------------------------------------------------------*/ /*------------------------------------------------------------------*/
@ -8422,7 +8436,7 @@ char str[256], upwd[256], full_name[256], email[256];
else else
{ {
getcfg(lbs->name, "Password file", str); getcfg(lbs->name, "Password file", str);
sprintf(full_name, "Error: Password file \"%s\" not found", str); sprintf(full_name, loc("Cannot open file <b>%s</b>"), str);
show_error(full_name); show_error(full_name);
return FALSE; return FALSE;
} }