|
@@ -50,7 +50,6 @@ tellconf()
|
|
|
sdprintf(STR("tempdir: %s\n"), replace(tempdir, conf.homedir, "~"));
|
|
sdprintf(STR("tempdir: %s\n"), replace(tempdir, conf.homedir, "~"));
|
|
|
sdprintf(STR("features: %d\n"), conf.features);
|
|
sdprintf(STR("features: %d\n"), conf.features);
|
|
|
sdprintf(STR("uid: %d\n"), conf.uid);
|
|
sdprintf(STR("uid: %d\n"), conf.uid);
|
|
|
- sdprintf(STR("uname: %s\n"), conf.uname);
|
|
|
|
|
sdprintf(STR("homedir: %s\n"), conf.homedir);
|
|
sdprintf(STR("homedir: %s\n"), conf.homedir);
|
|
|
sdprintf(STR("username: %s\n"), conf.username);
|
|
sdprintf(STR("username: %s\n"), conf.username);
|
|
|
sdprintf(STR("binpath: %s\n"), replace(conf.binpath, conf.homedir, "~"));
|
|
sdprintf(STR("binpath: %s\n"), replace(conf.binpath, conf.homedir, "~"));
|
|
@@ -59,7 +58,6 @@ tellconf()
|
|
|
sdprintf(STR("portmin: %d\n"), conf.portmin);
|
|
sdprintf(STR("portmin: %d\n"), conf.portmin);
|
|
|
sdprintf(STR("portmax: %d\n"), conf.portmax);
|
|
sdprintf(STR("portmax: %d\n"), conf.portmax);
|
|
|
sdprintf(STR("autocron: %d\n"), conf.autocron);
|
|
sdprintf(STR("autocron: %d\n"), conf.autocron);
|
|
|
- sdprintf(STR("autouname: %d\n"), conf.autouname);
|
|
|
|
|
sdprintf(STR("watcher: %d\n"), conf.watcher);
|
|
sdprintf(STR("watcher: %d\n"), conf.watcher);
|
|
|
sdprintf(STR("bots:\n"));
|
|
sdprintf(STR("bots:\n"));
|
|
|
for (bot = conf.bots; bot && bot->nick; bot = bot->next) {
|
|
for (bot = conf.bots; bot && bot->nick; bot = bot->next) {
|
|
@@ -354,7 +352,6 @@ init_conf()
|
|
|
#else
|
|
#else
|
|
|
conf.autocron = 1;
|
|
conf.autocron = 1;
|
|
|
#endif /* !CYGWIN_HACKS */
|
|
#endif /* !CYGWIN_HACKS */
|
|
|
- conf.autouname = 0;
|
|
|
|
|
#ifdef CYGWIN_HACKS
|
|
#ifdef CYGWIN_HACKS
|
|
|
if (homedir())
|
|
if (homedir())
|
|
|
conf.binpath = strdup(homedir());
|
|
conf.binpath = strdup(homedir());
|
|
@@ -374,7 +371,6 @@ init_conf()
|
|
|
conf.portmin = 0;
|
|
conf.portmin = 0;
|
|
|
conf.portmax = 0;
|
|
conf.portmax = 0;
|
|
|
conf.uid = -1;
|
|
conf.uid = -1;
|
|
|
- conf.uname = NULL;
|
|
|
|
|
conf.username = NULL;
|
|
conf.username = NULL;
|
|
|
conf.homedir = NULL;
|
|
conf.homedir = NULL;
|
|
|
conf.datadir = strdup(STR("./..."));
|
|
conf.datadir = strdup(STR("./..."));
|
|
@@ -566,8 +562,6 @@ free_conf()
|
|
|
conf.bot = NULL;
|
|
conf.bot = NULL;
|
|
|
if (conf.localhub)
|
|
if (conf.localhub)
|
|
|
free(conf.localhub);
|
|
free(conf.localhub);
|
|
|
- if (conf.uname)
|
|
|
|
|
- free(conf.uname);
|
|
|
|
|
if (conf.username)
|
|
if (conf.username)
|
|
|
free(conf.username);
|
|
free(conf.username);
|
|
|
if (conf.datadir)
|
|
if (conf.datadir)
|
|
@@ -607,7 +601,7 @@ void prep_homedir(bool error)
|
|
|
int
|
|
int
|
|
|
parseconf(bool error)
|
|
parseconf(bool error)
|
|
|
{
|
|
{
|
|
|
- if (error && conf.uid == -1 && !conf.uname)
|
|
|
|
|
|
|
+ if (error && conf.uid == -1 && !conf.datadir)
|
|
|
werr(ERR_NOTINIT);
|
|
werr(ERR_NOTINIT);
|
|
|
|
|
|
|
|
if (!conf.username)
|
|
if (!conf.username)
|
|
@@ -623,17 +617,6 @@ parseconf(bool error)
|
|
|
} else if (!conf.uid)
|
|
} else if (!conf.uid)
|
|
|
conf.uid = myuid;
|
|
conf.uid = myuid;
|
|
|
|
|
|
|
|
- if (conf.uname && strcmp(conf.uname, my_uname()) && !conf.autouname) {
|
|
|
|
|
- baduname(conf.uname, my_uname()); /* its not auto, and its not RIGHT, bail out. */
|
|
|
|
|
- sdprintf(("wrong uname, conf: %s :: %s"), conf.uname, my_uname());
|
|
|
|
|
- if (error)
|
|
|
|
|
- werr(ERR_WRONGUNAME);
|
|
|
|
|
- } else if (conf.uname && conf.autouname) { /* if autouname, dont bother comparing, just set uname to output */
|
|
|
|
|
- str_redup(&conf.uname, my_uname());
|
|
|
|
|
- } else if (!conf.uname) { /* if not set, then just set it, wont happen again next time... */
|
|
|
|
|
- conf.uname = strdup(my_uname());
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
#endif /* !CYGWIN_HACKS */
|
|
#endif /* !CYGWIN_HACKS */
|
|
|
return 0;
|
|
return 0;
|
|
|
}
|
|
}
|
|
@@ -671,17 +654,7 @@ readconf(const char *fname, int bits)
|
|
|
sdprintf(STR("CONF LINE: %s"), line.c_str());
|
|
sdprintf(STR("CONF LINE: %s"), line.c_str());
|
|
|
// !strchr("_`|}][{*/#-+!abcdefghijklmnopqrstuvwxyzABDEFGHIJKLMNOPWRSTUVWXYZ", line[0])) {
|
|
// !strchr("_`|}][{*/#-+!abcdefghijklmnopqrstuvwxyzABDEFGHIJKLMNOPWRSTUVWXYZ", line[0])) {
|
|
|
/* - uid */
|
|
/* - uid */
|
|
|
- if (line[0] == '-') {
|
|
|
|
|
- if (conf.uid == -1)
|
|
|
|
|
- conf.uid = atoi(newsplit(line).c_str());
|
|
|
|
|
-
|
|
|
|
|
- /* + uname */
|
|
|
|
|
- } else if (line[0] == '+') {
|
|
|
|
|
- if (!conf.uname)
|
|
|
|
|
- conf.uname = strdup(newsplit(line).c_str());
|
|
|
|
|
-
|
|
|
|
|
- /* ! is misc options */
|
|
|
|
|
- } else if (line[0] == '!') {
|
|
|
|
|
|
|
+ if (line[0] == '!') {
|
|
|
++line;
|
|
++line;
|
|
|
line.trim();
|
|
line.trim();
|
|
|
|
|
|
|
@@ -698,10 +671,6 @@ readconf(const char *fname, int bits)
|
|
|
if (egg_isdigit(line[0]))
|
|
if (egg_isdigit(line[0]))
|
|
|
conf.autocron = atoi(line.c_str());
|
|
conf.autocron = atoi(line.c_str());
|
|
|
|
|
|
|
|
- } else if (option == STR("autouname")) { /* auto update uname contents? */
|
|
|
|
|
- if (egg_isdigit(line[0]))
|
|
|
|
|
- conf.autouname = atoi(line.c_str());
|
|
|
|
|
-
|
|
|
|
|
} else if (option == STR("username")) { /* shell username */
|
|
} else if (option == STR("username")) { /* shell username */
|
|
|
str_redup(&conf.username, line.c_str());
|
|
str_redup(&conf.username, line.c_str());
|
|
|
|
|
|
|
@@ -729,9 +698,6 @@ readconf(const char *fname, int bits)
|
|
|
if (str_isdigit(line.c_str()))
|
|
if (str_isdigit(line.c_str()))
|
|
|
conf.uid = atoi(line.c_str());
|
|
conf.uid = atoi(line.c_str());
|
|
|
|
|
|
|
|
- } else if (option == STR("uname")) { /* new method uname */
|
|
|
|
|
- str_redup(&conf.uname, line.c_str());
|
|
|
|
|
-
|
|
|
|
|
} else if (option == STR("watcher")) {
|
|
} else if (option == STR("watcher")) {
|
|
|
if (egg_isdigit(line[0]))
|
|
if (egg_isdigit(line[0]))
|
|
|
conf.watcher = atoi(line.c_str());
|
|
conf.watcher = atoi(line.c_str());
|
|
@@ -811,23 +777,6 @@ writeconf(char *filename, int fd, int bits)
|
|
|
} else
|
|
} else
|
|
|
*stream << buf.printf(STR("! uid %d\n"), conf.uid);
|
|
*stream << buf.printf(STR("! uid %d\n"), conf.uid);
|
|
|
|
|
|
|
|
- if (!conf.uname || (conf.uname && conf.autouname && strcmp(conf.uname, my_uname()))) {
|
|
|
|
|
- autowrote = 1;
|
|
|
|
|
- if (conf.uname)
|
|
|
|
|
- comment("# autouname is ON");
|
|
|
|
|
- else
|
|
|
|
|
- comment("# Automatically updated empty uname");
|
|
|
|
|
-
|
|
|
|
|
- *stream << buf.printf(STR("! uname %s\n"), my_uname());
|
|
|
|
|
- if (conf.uname)
|
|
|
|
|
- *stream << buf.printf(STR("#! uname %s\n"), conf.uname);
|
|
|
|
|
- } else if (conf.uname && !conf.autouname && strcmp(conf.uname, my_uname())) {
|
|
|
|
|
- conf_com();
|
|
|
|
|
- *stream << buf.printf(STR("%s! uname %s\n"), do_confedit == CONF_AUTO ? "" : "#", my_uname());
|
|
|
|
|
- *stream << buf.printf(STR("%s! uname %s\n"), do_confedit == CONF_STATIC ? "" : "#", conf.uname);
|
|
|
|
|
- } else
|
|
|
|
|
- *stream << buf.printf(STR("! uname %s\n"), conf.uname);
|
|
|
|
|
-
|
|
|
|
|
comment("");
|
|
comment("");
|
|
|
|
|
|
|
|
if (conf.username && my_username() && strcmp(conf.username, my_username())) {
|
|
if (conf.username && my_username() && strcmp(conf.username, my_username())) {
|
|
@@ -891,13 +840,6 @@ writeconf(char *filename, int fd, int bits)
|
|
|
comment("");
|
|
comment("");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- if (conf.autouname) {
|
|
|
|
|
- comment("# Automatically update 'uname' if it changes? (DANGEROUS)");
|
|
|
|
|
- *stream << buf.printf(STR("! autouname %d\n"), conf.autouname);
|
|
|
|
|
-
|
|
|
|
|
- comment("");
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
comment("# '|' means OR, [] means the enclosed is optional");
|
|
comment("# '|' means OR, [] means the enclosed is optional");
|
|
|
comment("# A '+' in front of HOST means the HOST is ipv6");
|
|
comment("# A '+' in front of HOST means the HOST is ipv6");
|
|
|
comment("# A '/' in front of BOT will disable that bot.");
|
|
comment("# A '/' in front of BOT will disable that bot.");
|
|
@@ -1041,7 +983,6 @@ bin_to_conf(bool error)
|
|
|
conf.uid = atol(settings.uid);
|
|
conf.uid = atol(settings.uid);
|
|
|
if (settings.username[0])
|
|
if (settings.username[0])
|
|
|
str_redup(&conf.username, settings.username);
|
|
str_redup(&conf.username, settings.username);
|
|
|
- str_redup(&conf.uname, settings.uname);
|
|
|
|
|
str_redup(&conf.datadir, settings.datadir);
|
|
str_redup(&conf.datadir, settings.datadir);
|
|
|
if (settings.homedir[0])
|
|
if (settings.homedir[0])
|
|
|
str_redup(&conf.homedir, settings.homedir);
|
|
str_redup(&conf.homedir, settings.homedir);
|
|
@@ -1049,7 +990,6 @@ bin_to_conf(bool error)
|
|
|
str_redup(&conf.binname, settings.binname);
|
|
str_redup(&conf.binname, settings.binname);
|
|
|
conf.portmin = atol(settings.portmin);
|
|
conf.portmin = atol(settings.portmin);
|
|
|
conf.portmax = atol(settings.portmax);
|
|
conf.portmax = atol(settings.portmax);
|
|
|
- conf.autouname = atoi(settings.autouname);
|
|
|
|
|
conf.autocron = atoi(settings.autocron);
|
|
conf.autocron = atoi(settings.autocron);
|
|
|
conf.watcher = atoi(settings.watcher);
|
|
conf.watcher = atoi(settings.watcher);
|
|
|
|
|
|