|
@@ -216,6 +216,7 @@ void init_conf() {
|
|
|
conffile.uname = NULL;
|
|
conffile.uname = NULL;
|
|
|
conffile.username = NULL;
|
|
conffile.username = NULL;
|
|
|
conffile.homedir = NULL;
|
|
conffile.homedir = NULL;
|
|
|
|
|
+ conffile.md5 = NULL;
|
|
|
}
|
|
}
|
|
|
/*
|
|
/*
|
|
|
* Return the PID of a bot if it is running, otherwise return 0
|
|
* Return the PID of a bot if it is running, otherwise return 0
|
|
@@ -304,6 +305,7 @@ void showconf() {
|
|
|
conf_bot *bot = NULL;
|
|
conf_bot *bot = NULL;
|
|
|
|
|
|
|
|
sdprintf("---------------------------CONF START---------------------------");
|
|
sdprintf("---------------------------CONF START---------------------------");
|
|
|
|
|
+ sdprintf("md5 : %s", conffile.md5);
|
|
|
sdprintf("uid : %d", conffile.uid);
|
|
sdprintf("uid : %d", conffile.uid);
|
|
|
sdprintf("uname : %s", conffile.uname);
|
|
sdprintf("uname : %s", conffile.uname);
|
|
|
sdprintf("username : %s", conffile.username);
|
|
sdprintf("username : %s", conffile.username);
|
|
@@ -341,6 +343,7 @@ void free_conf() {
|
|
|
/* must also free() anything malloc`d in conf_addbot() */
|
|
/* must also free() anything malloc`d in conf_addbot() */
|
|
|
free(bot);
|
|
free(bot);
|
|
|
}
|
|
}
|
|
|
|
|
+ free(conffile.md5);
|
|
|
free(conffile.uname);
|
|
free(conffile.uname);
|
|
|
free(conffile.username);
|
|
free(conffile.username);
|
|
|
free(conffile.homedir);
|
|
free(conffile.homedir);
|
|
@@ -349,6 +352,15 @@ void free_conf() {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
int parseconf() {
|
|
int parseconf() {
|
|
|
|
|
+ char *md5 = MD5FILE(binname);
|
|
|
|
|
+
|
|
|
|
|
+ if (!conffile.md5) {
|
|
|
|
|
+ conffile.md5 = strdup(md5);
|
|
|
|
|
+ }
|
|
|
|
|
+ /* fuck it
|
|
|
|
|
+ else if (conffile.md5 && strcmp(conffile.md5, md5))
|
|
|
|
|
+ fatal("Nice try :)", 0);
|
|
|
|
|
+ */
|
|
|
if (!conffile.bots->nick && !conffile.bots->next) /* no bots ! */
|
|
if (!conffile.bots->nick && !conffile.bots->next) /* no bots ! */
|
|
|
werr(ERR_NOBOTS);
|
|
werr(ERR_NOBOTS);
|
|
|
|
|
|
|
@@ -464,6 +476,9 @@ int readconf(char *cfile)
|
|
|
} else if (!strcmp(option, "binname")) { /* filename of the binary? */
|
|
} else if (!strcmp(option, "binname")) { /* filename of the binary? */
|
|
|
str_redup(&conffile.binname, line);
|
|
str_redup(&conffile.binname, line);
|
|
|
|
|
|
|
|
|
|
+ } else if (!strcmp(option, "binmd5")) { /* binary hash */
|
|
|
|
|
+ str_redup(&conffile.md5, line);
|
|
|
|
|
+
|
|
|
} else if (!strcmp(option, "portmin")) {
|
|
} else if (!strcmp(option, "portmin")) {
|
|
|
if (egg_isdigit(line[0]))
|
|
if (egg_isdigit(line[0]))
|
|
|
conffile.portmin = atoi(line);
|
|
conffile.portmin = atoi(line);
|
|
@@ -551,7 +566,6 @@ int writeconf(char *filename, FILE *stream, int bits) {
|
|
|
if ((bits & CONF_COMMENT) && conffile.uid != myuid)
|
|
if ((bits & CONF_COMMENT) && conffile.uid != myuid)
|
|
|
my_write(f, "#! uid %d\n\n", myuid);
|
|
my_write(f, "#! uid %d\n\n", myuid);
|
|
|
|
|
|
|
|
-
|
|
|
|
|
if (!conffile.uname || (conffile.uname && conffile.autouname && strcmp(conffile.uname, my_uname()))) {
|
|
if (!conffile.uname || (conffile.uname && conffile.autouname && strcmp(conffile.uname, my_uname()))) {
|
|
|
comment("# Automatic");
|
|
comment("# Automatic");
|
|
|
my_write(f, "! uname %s\n", my_uname());
|
|
my_write(f, "! uname %s\n", my_uname());
|
|
@@ -581,6 +595,9 @@ int writeconf(char *filename, FILE *stream, int bits) {
|
|
|
comment("# binname is relative to binpath, if you change this, you'll need to manually remove the old one from crontab.");
|
|
comment("# binname is relative to binpath, if you change this, you'll need to manually remove the old one from crontab.");
|
|
|
my_write(f, "! binname %s\n", conffile.binname);
|
|
my_write(f, "! binname %s\n", conffile.binname);
|
|
|
|
|
|
|
|
|
|
+ comment("# DO NOT TOUCH THIS.");
|
|
|
|
|
+ my_write(f, "! binmd5 %s\n", conffile.md5);
|
|
|
|
|
+
|
|
|
comment("");
|
|
comment("");
|
|
|
|
|
|
|
|
comment("# portmin/max are for incoming connections (DCC) [0 for any]");
|
|
comment("# portmin/max are for incoming connections (DCC) [0 for any]");
|