mirror of
https://github.com/EnergyMech/energymech.git
synced 2025-12-29 16:14:43 +00:00
newbie warnings for files readable to others
This commit is contained in:
7
.gitignore
vendored
7
.gitignore
vendored
@@ -23,14 +23,9 @@ trivia/mkindex
|
|||||||
# mech typical user config files
|
# mech typical user config files
|
||||||
*~
|
*~
|
||||||
*.bak
|
*.bak
|
||||||
mech.passwd
|
mech.*
|
||||||
mech.conf
|
|
||||||
mech.users
|
|
||||||
mech.pid
|
|
||||||
mech.session
|
|
||||||
root.zone*
|
root.zone*
|
||||||
trick.conf
|
trick.conf
|
||||||
mech.trivscore
|
|
||||||
trivia/megatrivia.txt
|
trivia/megatrivia.txt
|
||||||
*.log
|
*.log
|
||||||
*.stats
|
*.stats
|
||||||
|
|||||||
1
VERSIONS
1
VERSIONS
@@ -1,5 +1,6 @@
|
|||||||
3.1 -- WORK IN PROGRESS (~April, 2018)
|
3.1 -- WORK IN PROGRESS (~April, 2018)
|
||||||
|
|
||||||
|
* Added: Newbie mode warnings about config/userfiles readable by others (exposing passwords)
|
||||||
* Fixed: Issue #25, clients lost when doing reset, no more
|
* Fixed: Issue #25, clients lost when doing reset, no more
|
||||||
* Fixed: compiler warnings and missing defines/conflicting defines with certain options
|
* Fixed: compiler warnings and missing defines/conflicting defines with certain options
|
||||||
* Added: configure now saves the options selected in ./myconfig for later re-use
|
* Added: configure now saves the options selected in ./myconfig for later re-use
|
||||||
|
|||||||
48
src/main.c
48
src/main.c
@@ -1066,6 +1066,27 @@ int main(int argc, char **argv, char **envp)
|
|||||||
to_file(1,TEXT_HDR_FEAT,__mx_opts);
|
to_file(1,TEXT_HDR_FEAT,__mx_opts);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef NEWBIE
|
||||||
|
if (stat(configfile,&st));
|
||||||
|
{
|
||||||
|
if ((st.st_mode & (S_IWGRP|S_IWOTH)) != 0)
|
||||||
|
{
|
||||||
|
to_file(1,"error: configfile is writeable by others, exiting...\n");
|
||||||
|
_exit(0);
|
||||||
|
}
|
||||||
|
if ((st.st_mode & (S_IRGRP|S_IROTH)) != 0)
|
||||||
|
to_file(1,"warning: configfile is readable by others\n");
|
||||||
|
}
|
||||||
|
if (stat(".",&st));
|
||||||
|
{
|
||||||
|
if ((st.st_mode & (S_IWGRP|S_IWOTH)) != 0)
|
||||||
|
{
|
||||||
|
to_file(1,"error: energymech home directory is writeable by others, exiting...\n");
|
||||||
|
_exit(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif /* NEWBIE */
|
||||||
|
|
||||||
if (versiononly)
|
if (versiononly)
|
||||||
_exit(0); /* _exit() here because we dont want a profile file to be written */
|
_exit(0); /* _exit() here because we dont want a profile file to be written */
|
||||||
|
|
||||||
@@ -1117,8 +1138,23 @@ int main(int argc, char **argv, char **envp)
|
|||||||
for(current=botlist;current;current=current->next)
|
for(current=botlist;current;current=current->next)
|
||||||
{
|
{
|
||||||
if ((opt = current->setting[STR_USERFILE].str_var))
|
if ((opt = current->setting[STR_USERFILE].str_var))
|
||||||
|
#ifndef NEWBIE
|
||||||
read_userlist(opt);
|
read_userlist(opt);
|
||||||
#ifdef NEWBIE
|
}
|
||||||
|
#else
|
||||||
|
{
|
||||||
|
if (stat(opt,&st));
|
||||||
|
{
|
||||||
|
if ((st.st_mode & (S_IWGRP|S_IWOTH)) != 0)
|
||||||
|
{
|
||||||
|
to_file(1,"error: userfile(%s) is writeable by others, exiting...\n",opt);
|
||||||
|
_exit(0);
|
||||||
|
}
|
||||||
|
if ((st.st_mode & (S_IRGRP|S_IROTH)) != 0)
|
||||||
|
to_file(1,"warning: userfile(%s) is readable by others\n",opt);
|
||||||
|
}
|
||||||
|
read_userlist(opt);
|
||||||
|
}
|
||||||
if (current->userlist == NULL)
|
if (current->userlist == NULL)
|
||||||
{
|
{
|
||||||
to_file(1,"init: No userlist loaded for %s\n",nullstr(current->nick));
|
to_file(1,"init: No userlist loaded for %s\n",nullstr(current->nick));
|
||||||
@@ -1129,9 +1165,8 @@ int main(int argc, char **argv, char **envp)
|
|||||||
{
|
{
|
||||||
_exit(1);
|
_exit(1);
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
}
|
|
||||||
#endif /* NEWBIE */
|
#endif /* NEWBIE */
|
||||||
|
|
||||||
for(current=botlist;current;current=current->next)
|
for(current=botlist;current;current=current->next)
|
||||||
{
|
{
|
||||||
mirror_userlist();
|
mirror_userlist();
|
||||||
@@ -1143,7 +1178,7 @@ int main(int argc, char **argv, char **envp)
|
|||||||
if (!mechresetenv)
|
if (!mechresetenv)
|
||||||
to_file(1,INFO_RUNNING);
|
to_file(1,INFO_RUNNING);
|
||||||
|
|
||||||
if (do_fork)
|
if (do_fork && startup != 666)
|
||||||
{
|
{
|
||||||
close(0);
|
close(0);
|
||||||
close(1);
|
close(1);
|
||||||
@@ -1205,7 +1240,10 @@ int main(int argc, char **argv, char **envp)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (startup == 666)
|
if (startup == 666)
|
||||||
exit(0);
|
{
|
||||||
|
to_file(1,"init: test run completed, exiting...\n");
|
||||||
|
_exit(0);
|
||||||
|
}
|
||||||
startup = FALSE;
|
startup = FALSE;
|
||||||
doit();
|
doit();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user