mirror of
https://gitea.psi.ch/ELOG/elog.git
synced 2026-09-10 18:23:28 +00:00
Create password file if not present
SVN revision: 613
This commit is contained in:
parent
ee3f876ad5
commit
fb13ed3acf
16
src/elogd.c
16
src/elogd.c
@ -6,6 +6,9 @@
|
|||||||
Contents: Web server program for Electronic Logbook ELOG
|
Contents: Web server program for Electronic Logbook ELOG
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.147 2003/09/29 13:14:33 midas
|
||||||
|
Create password file if not present
|
||||||
|
|
||||||
Revision 1.146 2003/09/08 10:57:46 midas
|
Revision 1.146 2003/09/08 10:57:46 midas
|
||||||
Fixed even more HTML errors
|
Fixed even more HTML errors
|
||||||
|
|
||||||
@ -11914,7 +11917,7 @@ int get_user_line(char *logbook_name, char *user, char *password, char *full_nam
|
|||||||
{
|
{
|
||||||
char str[256], line[256], file_name[256], *p;
|
char str[256], line[256], file_name[256], *p;
|
||||||
FILE *f;
|
FILE *f;
|
||||||
int i;
|
int i, fd;
|
||||||
|
|
||||||
if (password) password[0] = 0;
|
if (password) password[0] = 0;
|
||||||
if (full_name) full_name[0] = 0;
|
if (full_name) full_name[0] = 0;
|
||||||
@ -11935,6 +11938,17 @@ int i;
|
|||||||
}
|
}
|
||||||
|
|
||||||
f = fopen(file_name, "r");
|
f = fopen(file_name, "r");
|
||||||
|
|
||||||
|
/* if password file doen't exist, try to create it */
|
||||||
|
if (f == NULL)
|
||||||
|
{
|
||||||
|
fd = open(file_name, O_CREAT | O_RDWR, 0600);
|
||||||
|
if (fd < 0)
|
||||||
|
return 3;
|
||||||
|
close(fd);
|
||||||
|
f = fopen(file_name, "r");
|
||||||
|
}
|
||||||
|
|
||||||
if (f != NULL)
|
if (f != NULL)
|
||||||
{
|
{
|
||||||
if (!user[0])
|
if (!user[0])
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user