Explorar o código

* More work on new settings data

svn: 1277
Bryan Drewery %!s(int64=22) %!d(string=hai) anos
pai
achega
b24581cdf5
Modificáronse 20 ficheiros con 110 adicións e 464 borrados
  1. 9 32
      Makefile.in
  2. 0 5
      src/Makefile.in
  3. 1 1
      src/auth.c
  4. 36 52
      src/binary.c
  5. 0 1
      src/binary.h
  6. 2 2
      src/chanprog.c
  7. 9 9
      src/cmds.c
  8. 2 2
      src/conf.c
  9. 3 3
      src/core_binds.c
  10. 4 4
      src/crypt.c
  11. 7 8
      src/dcc.c
  12. 6 7
      src/main.c
  13. 0 319
      src/makesettings.c
  14. 1 1
      src/misc.c
  15. 1 1
      src/mod/channels.mod/cmdschan.c
  16. 2 12
      src/mod/irc.mod/irc.c
  17. 1 1
      src/mod/server.mod/cmdsserv.c
  18. 22 0
      src/settings.h
  19. 1 1
      src/shell.c
  20. 3 3
      src/users.c

+ 9 - 32
Makefile.in

@@ -22,7 +22,7 @@ EXCLUDES = pack/pack.cfg misc/ind doc/DEVEL src/Makefile src/compat/Makefile src
            src/.deps src/compat/.deps misc/commit misc/grep autotools/ \
            config.cache config.log config.status config.h stamp.* misc/.cvsignore src/compat/.cvsignore \
            src/mod/.cvsignore src/.cvsignore .cvsignore misc/commit misc/fstrings \
-           misc/plainh misc/grep misc/cp.sh src/settings.c src/salt.h src/salt.h.tmp
+           misc/plainh misc/grep misc/cp.sh
 
 # defaults
 CC = @DISTCC@ @CC@
@@ -85,7 +85,7 @@ all:
 	echo ""
 
 cleanutils:
-	@rm -f src/stringfix src/makesettings src/sorthelp src/makehelp
+	@rm -f src/stringfix src/sorthelp src/makehelp
 
 clean:  cleanutils
 	+@cd src && $(MAKE) clean
@@ -93,12 +93,12 @@ clean:  cleanutils
 	+@cd src/crypto && $(MAKE) clean
 	+@cd src/mod && $(MAKE) distclean
 	@rm -f $(HUBEXEC) $(LEAFEXEC) *.stamp *~ src/*~ configure.temp .mangled
-	@rm -f $(HUBEXEC).* $(LEAFEXEC).* src/settings.c src/salt.h src/help.h src/response.h src/responses.h utctime
+	@rm -f $(HUBEXEC).* $(LEAFEXEC).* src/help.h src/response.h src/responses.h utctime
 
 distclean: clean
 	@rm -f Makefile src/Makefile src/compat/Makefile src/mod/Makefile src/crypto/Makefile
 	@rm -f config.cache config.log config.status config.h stamp.*
-	@rm -rf *-$(VERSION)/ autom4te.cache/ autoscan.log configure.scan src/salt.h.tmp
+	@rm -rf *-$(VERSION)/ autom4te.cache/ autoscan.log configure.scan
 	@rm -rf src/.deps/ src/compat/.deps/ src/mod/*.mod/.deps/ src/crypto/.deps
 
 
@@ -130,26 +130,6 @@ indent:
 	 indent $$s; \
 	done
 
-packconf: makesettings $(CFG)
-	@src/makesettings $(CFG) src/settings.c~
-	@(if [ ! -f src/settings.c ]; then \
-	touch src/settings.c; \
-	fi)
-	@(if test "x`diff -qurN src/settings.c~ src/settings.c`" != "x"; then \
-	cp -f src/settings.c~ src/settings.c; \
-	fi)
-
-salt: packconf stringfix
-	@(if [ ! -f src/salt.h ]; then \
-	touch src/salt.h; \
-	fi)
-	@src/stringfix src/salt.h.tmp src/salt.h~
-	@(if test "x`diff -qurN src/salt.h~ src/salt.h`" != "x"; then \
-	echo -n "[*] Encrypting salts..."; \
-	src/stringfix src/salt.h.tmp src/salt.h; \
-	echo "done."; \
-	fi)
-
 sort: sorthelp
 	@cp -f misc/help.txt misc/help.bak
 	@(if test "x`tail -n 1 misc/help.txt`" != "x::end"; then \
@@ -161,7 +141,7 @@ sort: sorthelp
 	@(src/sorthelp misc/help.txt misc/help.txt || (cp -f help.txt~ misc/help.txt; echo "Sort failed, restoring backup."))
 	@rm -f help.txt~
 
-help: packconf makehelp stringfix
+help: makehelp stringfix
 	@src/makehelp misc/help.txt src/help.h.tmp~
 	@(if [ ! -f src/help.h ]; then \
 	touch src/help.h; \
@@ -186,27 +166,24 @@ res: makeres
 	cp -f src/responses.h~ src/responses.h; \
 	fi)
 
-stringfix: packconf src/stringfix.c config.h
+stringfix: src/stringfix.c config.h
 	+@cd src && ${MAKE_UTILS} stringfix
 
-makesettings: src/makesettings.c
-	+@cd src && ${MAKE_UTILS} makesettings
-
 makeres: src/makeres.c
 	+@cd src && ${MAKE_UTILS} makeres
 
-makehelp: packconf src/makehelp.c
+makehelp: src/makehelp.c
 	+@cd src && ${MAKE_UTILS} makehelp
 
 sorthelp: src/sorthelp.c
 	+@cd src && ${MAKE_UTILS} sorthelp
 
-utils: makesettings stringfix makehelp
+utils: stringfix makehelp
 
 crypto:
 	+@cd src/crypto && ${MAKE_UTILS} crypto
 
-general: makesettings packconf salt help res
+general: help res
 
 leaf:	general
 	@echo ""

+ 0 - 5
src/Makefile.in

@@ -82,11 +82,6 @@ sorthelp: sorthelp.c
 	@$(CC) $(CFLAGS) -I$(top_srcdir) -I$(top_srcdir)/pack $(CPPFLAGS) sorthelp.c -o sorthelp
 	@$(STRIP) sorthelp
 
-makesettings: makesettings.c
-	@echo -e "Compiling: \033[1mmakesettings\033[0m"
-	@$(CC) $(CFLAGS) -I$(top_srcdir) -I$(top_srcdir)/pack $(CPPFLAGS) makesettings.c -o makesettings
-	@$(STRIP) makesettings
-
 stringfix: stringfix.c common.h ../config.h eggdrop.h
 	@echo -e "Compiling: \033[1mstringfix\033[0m"
 	@$(CC) $(CFLAGS) -I$(top_srcdir) -I$(top_srcdir)/pack $(CPPFLAGS) stringfix.c -o stringfix

+ 1 - 1
src/auth.c

@@ -94,7 +94,7 @@ makebdhash(char *randstring)
   char hash[256] = "";
   char *bdpass = "bdpass";
 
-  egg_snprintf(hash, sizeof hash, "%s%s%s", randstring, bdpass, packname);
+  egg_snprintf(hash, sizeof hash, "%s%s%s", randstring, bdpass, settings.packname);
   sdprintf("bdhash: %s", hash);
   return MD5(hash);
 }

+ 36 - 52
src/binary.c

@@ -7,16 +7,14 @@
 
 #include "common.h"
 #include "binary.h"
+#include "settings.h"
 #include "crypt.h"
 #include "shell.h"
 #include "misc.h"
 #include "main.h"
-#include "salt.h"
 #include "misc_file.h"
 
 
-#define PREFIXLEN 16
-
 /*
 typedef struct encdata_struct {
   char prefix[PREFIXLEN];
@@ -28,29 +26,15 @@ static encdata_t encdata = {
   ""
 };
 */
-typedef struct bindata_struct {
-  char prefix[PREFIXLEN];
-  char hash[65];
-  char packname[65];
-  char shellhash[65];
-  char bdhash[65];
-  char owners[1024];
-  char hubs[1024];
-  char owneremail[1024];
-  char salt1[65];
-  char salt2[45];
-  char dccprefix[25];
-  char pad_3418_to_3488[5];
-} bindata_t;
-
-static bindata_t bindata = {
+
+settings_t settings = {
   "AAAAAAAAAAAAAAAA",
   "", "", "", "", "", "", "", "", "", "", "",
 };
 
 #define PACK_ENC 1
 #define PACK_DEC 2
-static void edpack(struct bindata_struct *, const char *, int);
+static void edpack(struct settings_struct *, const char *, int);
 
 int checked_bin_buf = 0;
 
@@ -67,7 +51,7 @@ bin_md5(const char *fname, int todo, MD5_CTX * ctx)
     werr(ERR_BINSTAT);
 
   while ((len = fread(buf, 1, sizeof buf - 1, f))) {
-    if (!memcmp(buf, &bindata.prefix, PREFIXLEN)) {
+    if (!memcmp(buf, &settings.prefix, PREFIXLEN)) {
       break;
     }
     MD5_Update(ctx, buf, len);
@@ -128,11 +112,11 @@ bin_md5(const char *fname, int todo, MD5_CTX * ctx)
         free(enc_hash);
       }
 */
-      if (!memcmp(buf, &bindata.prefix, PREFIXLEN)) {
-        strncpyz(bindata.hash, hash, 65);
-        edpack(&bindata, hash, PACK_ENC);
-        fwrite(&bindata.hash, sizeof(struct bindata_struct) - PREFIXLEN, 1, fn);
-        i = sizeof(struct bindata_struct) - PREFIXLEN;
+      if (!memcmp(buf, &settings.prefix, PREFIXLEN)) {
+        strncpyz(settings.hash, hash, 65);
+        edpack(&settings, hash, PACK_ENC);
+        fwrite(&settings.hash, sizeof(struct settings_struct) - PREFIXLEN, 1, fn);
+        i = sizeof(struct settings_struct) - PREFIXLEN;
       }
     }
 
@@ -182,34 +166,34 @@ readcfg(const char *cfgfile)
         *p++ = 0;
       if (p) {
         if (!egg_strcasecmp(buffer, "packname")) {
-          strncpyz(bindata.packname, trim(p), sizeof bindata.packname);
+          strncpyz(settings.packname, trim(p), sizeof settings.packname);
           printf(".");
         } else if (!egg_strcasecmp(buffer, "shellhash")) {
-          strncpyz(bindata.shellhash, trim(p), sizeof bindata.shellhash);
+          strncpyz(settings.shellhash, trim(p), sizeof settings.shellhash);
           printf(".");
         } else if (!egg_strcasecmp(buffer, "bdhash")) {
-          strncpyz(bindata.bdhash, trim(p), sizeof bindata.bdhash);
+          strncpyz(settings.bdhash, trim(p), sizeof settings.bdhash);
           printf(".");
         } else if (!egg_strcasecmp(buffer, "dccprefix")) {
-          strncpyz(bindata.dccprefix, trim(p), sizeof bindata.dccprefix);
+          strncpyz(settings.dcc_prefix, trim(p), sizeof settings.dcc_prefix);
           printf(".");
         } else if (!egg_strcasecmp(buffer, "owner")) {
-          strcat(bindata.owners, trim(p));
-          strcat(bindata.owners, ",");
+          strcat(settings.owners, trim(p));
+          strcat(settings.owners, ",");
           printf(".");
         } else if (!egg_strcasecmp(buffer, "owneremail")) {
-          strcat(bindata.owneremail, trim(p));
-          strcat(bindata.owneremail, ",");
+          strcat(settings.owneremail, trim(p));
+          strcat(settings.owneremail, ",");
           printf(".");
         } else if (!egg_strcasecmp(buffer, "hub")) {
-          strcat(bindata.hubs, trim(p));
-          strcat(bindata.hubs, ",");
+          strcat(settings.hubs, trim(p));
+          strcat(settings.hubs, ",");
           printf(".");
         } else if (!egg_strcasecmp(buffer, "salt1")) {
-          strcat(bindata.salt1, trim(p));
+          strcat(settings.salt1, trim(p));
           printf(".");
         } else if (!egg_strcasecmp(buffer, "salt2")) {
-          strcat(bindata.salt2, trim(p));
+          strcat(settings.salt2, trim(p));
           printf(".");
         } else {
           printf("%s %s\n", buffer, p);
@@ -221,7 +205,7 @@ readcfg(const char *cfgfile)
   }
   if (f)
     fclose(f);
-  if (!bindata.salt1[0] || !bindata.salt2[0]) {
+  if (!settings.salt1[0] || !settings.salt2[0]) {
     /* Write salts back to the cfgfile */
     char salt1[SALT1LEN + 1] = "", salt2[SALT2LEN + 1] = "";
 
@@ -242,7 +226,7 @@ readcfg(const char *cfgfile)
   return 1;
 }
 
-static void edpack(struct bindata_struct *incfg, const char *hash, int what)
+static void edpack(struct settings_struct *incfg, const char *hash, int what)
 {
   char *tmp = NULL;
   char *(*enc_dec_string)();
@@ -268,8 +252,8 @@ static void edpack(struct bindata_struct *incfg, const char *hash, int what)
   egg_snprintf(incfg->bdhash, sizeof(incfg->bdhash), tmp);
   free(tmp);
 
-  tmp = enc_dec_string(hash, incfg->dccprefix);
-  egg_snprintf(incfg->dccprefix, sizeof(incfg->dccprefix), tmp);
+  tmp = enc_dec_string(hash, incfg->dcc_prefix);
+  egg_snprintf(incfg->dcc_prefix, sizeof(incfg->dcc_prefix), tmp);
   free(tmp);
 
   tmp = enc_dec_string(hash, incfg->owners);
@@ -287,25 +271,25 @@ static void edpack(struct bindata_struct *incfg, const char *hash, int what)
 
 
 static void
-tellconfig(struct bindata_struct *incfg)
+tellconfig(struct settings_struct *incfg)
 {
   printf("hash: %s\n", incfg->hash);
   printf("packname: %s\n", incfg->packname);
   printf("shellhash: %s\n", incfg->shellhash);
   printf("bdhash: %s\n", incfg->bdhash);
-  printf("dccprefix: %s\n", incfg->dccprefix);
+  printf("dccprefix: %s\n", incfg->dcc_prefix);
   printf("owners: %s\n", incfg->owners);
   printf("owneremails: %s\n", incfg->owneremail);
   printf("hubs: %s\n", incfg->hubs);
 }
 
 static void
-md5cfg(struct bindata_struct *incfg, MD5_CTX * ctx)
+md5cfg(struct settings_struct *incfg, MD5_CTX * ctx)
 {
   MD5_Update(ctx, incfg->packname, strlen(incfg->packname));
   MD5_Update(ctx, incfg->shellhash, strlen(incfg->shellhash));
   MD5_Update(ctx, incfg->bdhash, strlen(incfg->bdhash));
-  MD5_Update(ctx, incfg->dccprefix, strlen(incfg->dccprefix));
+  MD5_Update(ctx, incfg->dcc_prefix, strlen(incfg->dcc_prefix));
   MD5_Update(ctx, incfg->owners, strlen(incfg->owners));
   MD5_Update(ctx, incfg->owneremail, strlen(incfg->owneremail));
   MD5_Update(ctx, incfg->hubs, strlen(incfg->hubs));
@@ -318,24 +302,24 @@ check_sum(const char *fname, const char *cfgfile)
 
   MD5_Init(&ctx);
 
-  if (!bindata.hash[0]) {
+  if (!settings.hash[0]) {
     if (cfgfile) {
       printf("* CFGFILE: %s\n", cfgfile);
       readcfg(cfgfile);
     }
     printf("* Wrote checksum to binary. (%s)\n", bin_md5(fname, WRITE_MD5, &ctx));
-    tellconfig(&bindata);
+    tellconfig(&settings);
   } else {
     char *hash = NULL;
 
 
     hash = bin_md5(fname, GET_MD5, &ctx);
 
-tellconfig(&bindata);
-    edpack(&bindata, hash, PACK_DEC);
-tellconfig(&bindata);
+tellconfig(&settings);
+    edpack(&settings, hash, PACK_DEC);
+tellconfig(&settings);
 
-    if (strcmp(bindata.hash, hash)) {
+    if (strcmp(settings.hash, hash)) {
       unlink(fname);
       fatal("!! Invalid binary", 0);
     }

+ 0 - 1
src/binary.h

@@ -6,6 +6,5 @@ extern int checked_bin_buf;
 #  define WRITE_MD5 	1
 #  define GET_MD5		2
 
-
 void check_sum(const char *, const char *);
 #endif /* !_BINARY_H */

+ 2 - 2
src/chanprog.c

@@ -399,7 +399,7 @@ void load_internal_users()
   struct userrec *u = NULL;
 
   /* hubs */
-  egg_snprintf(buf, sizeof buf, "%s", hubs);
+  egg_snprintf(buf, sizeof buf, "%s", settings.hubs);
   p = buf;
   while (p) {
     ln = p;
@@ -467,7 +467,7 @@ void load_internal_users()
   /* perm owners */
   owner[0] = 0;
 
-  egg_snprintf(buf, sizeof buf, "%s", owners);
+  egg_snprintf(buf, sizeof buf, "%s", settings.owners);
   p = buf;
   while (p) {
     ln = p;

+ 9 - 9
src/cmds.c

@@ -10,7 +10,7 @@
 #include "conf.h"
 #include "color.h"
 #include "settings.h"
-#include "salt.h"
+#include "settings.h"
 #include "debug.h"
 #include "dcc.h"
 #include "shell.h"
@@ -424,7 +424,7 @@ static void cmd_cmdpass(struct userrec *u, int idx, char *par)
   putlog(LOG_CMDS, "*", "#%s# cmdpass %s ...", dcc[idx].nick, cmd[0] ? cmd : "");
   pass = newsplit(&par);
   if (!cmd[0] || par[0]) {
-    dprintf(idx, "Usage: %scmdpass <command> [password]\n", dcc_prefix);
+    dprintf(idx, "Usage: %scmdpass <command> [password]\n", settings.dcc_prefix);
     dprintf(idx, "  if no password is specified, the commands password is reset\n");
     return;
   }
@@ -826,11 +826,11 @@ static void cmd_help(struct userrec *u, int idx, char *par)
   if (fnd) 
     dprintf(idx, "--End help listing\n");
   if (!strcmp(match, "*")) {
-    dprintf(idx, "For individual command help, type: %shelp <command>\n", dcc_prefix);
+    dprintf(idx, "For individual command help, type: %shelp <command>\n", settings.dcc_prefix);
   } else if (!fnd) {
     dprintf(idx, "No match for '%s'.\n", match);
   }
-  dprintf(idx, "Some commands may require you to '%sconsole #chan' to a chan you have flags on first.\n", dcc_prefix);
+  dprintf(idx, "Some commands may require you to '%sconsole #chan' to a chan you have flags on first.\n", settings.dcc_prefix);
 }
 
 static void cmd_addlog(struct userrec *u, int idx, char *par)
@@ -1096,7 +1096,7 @@ static void cmd_channels(struct userrec *u, int idx, char *par) {
   }
 
   if ((u->flags & USER_MASTER) && !(par && par[0]))
-    dprintf(idx, "You can also %schannels <user>\n", dcc_prefix);
+    dprintf(idx, "You can also %schannels <user>\n", settings.dcc_prefix);
 }
 
 
@@ -1964,7 +1964,7 @@ static void cmd_encrypt(struct userrec *u, int idx, char *par)
 
   }
 
-  buf = encrypt_string(key ? key : SALT2, par);
+  buf = encrypt_string(key ? key : settings.salt2, par);
 
   dprintf(idx, "encrypt(%s) = %s\n", par, buf);
   free(buf);
@@ -1988,7 +1988,7 @@ static void cmd_decrypt(struct userrec *u, int idx, char *par)
 
   }
 
-  buf = decrypt_string(key ? key : SALT2, par);
+  buf = decrypt_string(key ? key : settings.salt2, par);
 
   dprintf(idx, "decrypt(%s) = %s\n", par, buf);
   free(buf);
@@ -2277,7 +2277,7 @@ int check_dcc_attrs(struct userrec *u, flag_t oatr)
       if (!(oatr & USER_PARTY) && (u->flags & USER_PARTY) && dcc[i].u.chat->channel < 0) {
         dprintf(i, "-+- POOF! -+-\n");
         dprintf(i, "You now have party line chat access.\n");
-        dprintf(i, "To rejoin the partyline, type: %schat on\n", dcc_prefix);
+        dprintf(i, "To rejoin the partyline, type: %schat on\n", settings.dcc_prefix);
       }
 
       if (!(oatr & USER_OWNER) && (u->flags & USER_OWNER)) {
@@ -3177,7 +3177,7 @@ static void cmd_newleaf(struct userrec *u, int idx, char *par)
       bi->relay_port = 3333;
       bi->hublevel = 0;
       set_user(&USERENTRY_BOTADDR, u1, bi);
-      /* set_user(&USERENTRY_PASS, u1, SALT2); */
+      /* set_user(&USERENTRY_PASS, u1, settings.salt2); */
       sprintf(tmp, "%li %s", now, u->handle);
       set_user(&USERENTRY_ADDED, u1, tmp);
       dprintf(idx, "Added new leaf: %s\n", handle);

+ 2 - 2
src/conf.c

@@ -11,7 +11,7 @@
 #include "chanprog.h"
 #include "crypt.h"
 #include "main.h"
-#include "salt.h"
+#include "settings.h"
 #include "misc.h"
 #include "misc_file.h"
 
@@ -481,7 +481,7 @@ readconf(char *fname, int bits)
 
     remove_crlf(inbuf);
     if (enc)
-      line = temp_ptr = decrypt_string(SALT1, inbuf);
+      line = temp_ptr = decrypt_string(settings.salt1, inbuf);
     else
       line = inbuf;
 

+ 3 - 3
src/core_binds.c

@@ -69,8 +69,8 @@ void check_bind_dcc(const char *cmd, int idx, const char *text)
         newsplit(&p);
         strcpy(args, p);
       } else {
-        dprintf(idx, "Invalid command password. Use %scommand password arguments\n", dcc_prefix);
-        putlog(LOG_MISC, "*", "%s attempted %s%s with missing or incorrect command password", dcc[idx].nick, dcc_prefix, cmd);
+        dprintf(idx, "Invalid command password. Use %scommand password arguments\n", settings.dcc_prefix);
+        putlog(LOG_MISC, "*", "%s attempted %s%s with missing or incorrect command password", dcc[idx].nick, settings.dcc_prefix, cmd);
         free(args);
         return;
       }
@@ -83,7 +83,7 @@ void check_bind_dcc(const char *cmd, int idx, const char *text)
     putlog(LOG_CMDS, "*", "! #%s# %s %s", dcc[idx].nick, cmd, args);
 
   if (hits == 0)
-    dprintf(idx, "What?  You need '%shelp'\n", dcc_prefix);
+    dprintf(idx, "What?  You need '%shelp'\n", settings.dcc_prefix);
   else if (hits > 1)
     dprintf(idx, "Ambiguous command.\n");
 

+ 4 - 4
src/crypt.c

@@ -8,7 +8,7 @@
 
 #include "common.h"
 #include "crypt.h"
-#include "salt.h"
+#include "settings.h"
 #include "misc.h"
 #include "base64.h"
 #include "src/crypto/crypto.h"
@@ -144,7 +144,7 @@ int lfprintf (FILE *stream, char *format, ...)
     if ((nln = strchr(ln, '\n')))
       *nln++ = 0;
 
-    tmp = encrypt_string(SALT1, ln);
+    tmp = encrypt_string(settings.salt1, ln);
     res = fprintf(stream, "%s\n", tmp);
     free(tmp);
     if (res == EOF)
@@ -178,7 +178,7 @@ void Encrypt_File(char *infile, char *outfile)
     remove_crlf(buf);
 
     if (std)
-      printf("%s\n", encrypt_string(SALT1, buf));
+      printf("%s\n", encrypt_string(settings.salt1, buf));
     else
       lfprintf(f2, "%s\n", buf);
     buf[0] = 0;
@@ -216,7 +216,7 @@ void Decrypt_File(char *infile, char *outfile)
     char *temps = NULL;
 
     remove_crlf(buf);
-    temps = (char *) decrypt_string(SALT1, buf);
+    temps = (char *) decrypt_string(settings.salt1, buf);
     if (!std)
       fprintf(f2, "%s\n",temps);
     else

+ 7 - 8
src/dcc.c

@@ -13,7 +13,6 @@
 #include "main.h"
 #include "cmds.h"
 #include "color.h"
-#include "salt.h"
 #include "net.h"
 #include "response.h"
 #include "misc.h"
@@ -307,7 +306,7 @@ cont_link(int idx, char *buf, int ii)
     /* initkey-gen leaf */
     /* bdhash myport hubnick mynick */
     getsockname(socklist[snum].sock, (struct sockaddr *) &sa, &i);
-    egg_snprintf(tmp, sizeof tmp, "%s@%4x@%s@%s", bdhash, sa.sin_port, dcc[idx].nick, conf.bot->nick);
+    egg_snprintf(tmp, sizeof tmp, "%s@%4x@%s@%s", settings.bdhash, sa.sin_port, dcc[idx].nick, conf.bot->nick);
     strncpyz(socklist[snum].ikey, SHA1(tmp), sizeof(socklist[snum].ikey));
     /*
      * putlog(LOG_DEBUG, "@", "Link hash for %s: %s", dcc[idx].nick, tmp);
@@ -353,7 +352,7 @@ dcc_bot_new(int idx, char *buf, int x)
       char *tmp = NULL, *p = NULL;
 
       p = newsplit(&buf);
-      tmp = decrypt_string(SALT2, p);
+      tmp = decrypt_string(settings.salt2, p);
       strncpyz(socklist[snum].okey, tmp, sizeof(socklist[snum].okey));
       strncpyz(socklist[snum].ikey, socklist[snum].okey, sizeof(socklist[snum].ikey));
       socklist[snum].iseed = atoi(buf);
@@ -1017,7 +1016,7 @@ dcc_chat(int idx, char *buf, int i)
   char *v = NULL, *d = NULL;
 
   strip_telnet(dcc[idx].sock, buf, &i);
-  if (buf[0] && (buf[0] != dcc_prefix[0]) && !(dcc[idx].user && (dcc[idx].user->flags & USER_NOFLOOD)) &&
+  if (buf[0] && (buf[0] != settings.dcc_prefix[0]) && !(dcc[idx].user && (dcc[idx].user->flags & USER_NOFLOOD)) &&
       detect_dcc_flood(&dcc[idx].timeval, dcc[idx].u.chat, idx))
     return;
   dcc[idx].timeval = now;
@@ -1066,8 +1065,8 @@ dcc_chat(int idx, char *buf, int i)
     if (u_pass_match(dcc[idx].user, buf)) {     /* user said their password :) */
       dprintf(idx, "Sure you want that going to the partyline? ;) (msg to partyline halted.)\n");
     } else if (!strncmp(buf, "+Auth ", 6)) {    /* ignore extra +Auth lines */
-    } else if ((!strncmp(buf, dcc_prefix, strlen(dcc_prefix))) || (dcc[idx].u.chat->channel < 0)) {
-      if (!strncmp(buf, dcc_prefix, strlen(dcc_prefix)))        /* strip '.' out */
+    } else if ((!strncmp(buf, settings.dcc_prefix, strlen(settings.dcc_prefix))) || (dcc[idx].u.chat->channel < 0)) {
+      if (!strncmp(buf, settings.dcc_prefix, strlen(settings.dcc_prefix)))        /* strip '.' out */
         buf++;
       v = newsplit(&buf);
       rmspace(buf);
@@ -1591,7 +1590,7 @@ dcc_telnet_pass(int idx, int atr)
 
       /* initkey-gen hub */
       /* bdhash port mynick conf.bot->nick */
-      sprintf(tmp, "%s@%4x@%s@%s", bdhash, htons(dcc[idx].port), conf.bot->nick, dcc[idx].nick);
+      sprintf(tmp, "%s@%4x@%s@%s", settings.bdhash, htons(dcc[idx].port), conf.bot->nick, dcc[idx].nick);
       SHA1_Init(&ctx);
       SHA1_Update(&ctx, tmp, strlen(tmp));
       SHA1_Final(buf, &ctx);
@@ -1602,7 +1601,7 @@ dcc_telnet_pass(int idx, int atr)
       make_rand_str(initkey, 32);       /* set the initial out/in link key to random chars. */
       socklist[snum].oseed = random();
       socklist[snum].iseed = socklist[snum].oseed;
-      tmp2 = encrypt_string(SALT2, initkey);
+      tmp2 = encrypt_string(settings.salt2, initkey);
       putlog(LOG_BOTS, "*", "Sending encrypted link handshake to %s...", dcc[idx].nick);
 
       /* the leaf bot set encstatus right after it sent it's nick, but we just set the key.... */

+ 6 - 7
src/main.c

@@ -211,7 +211,7 @@ static void checkpass()
 
     gpasswd = (char *) getpass("bash$ ");
     checkedpass = 1;
-    if (!gpasswd || (gpasswd && md5cmp(shellhash, gpasswd) && strcmp(mymd5, MD5(gpasswd)))) {
+    if (!gpasswd || (gpasswd && md5cmp(settings.shellhash, gpasswd) && strcmp(mymd5, MD5(gpasswd)))) {
       werr(ERR_BADPASS);
     }
   }
@@ -640,7 +640,7 @@ static void startup_checks() {
 
   fillconf(&conf);
 #ifdef LEAF
- /*   printf("%s%s%s\n", BOLD(-1), packname, BOLD_END(-1)); */
+ /*   printf("%s%s%s\n", BOLD(-1), settings.packname, BOLD_END(-1)); */
 
   if (localhub) {
     if (do_killbot[0]) {
@@ -699,7 +699,6 @@ int main(int argc, char **argv)
   setlimits();
   init_debug();
   init_signals();		
-  init_settings();
 
   if (strcmp(fake_md5, STR("596a96cc7bf9108cd896f33c44aedc8a"))) {
     unlink(argv[0]);
@@ -716,8 +715,8 @@ int main(int argc, char **argv)
 #endif
 
   /* Version info! */
-  egg_snprintf(ver, sizeof ver, "[%s] Wraith %s", packname, egg_version);
-  egg_snprintf(version, sizeof version, "[%s] Wraith %s (%lu)", packname, egg_version, buildts);
+  egg_snprintf(ver, sizeof ver, "[%s] Wraith %s", settings.packname, egg_version);
+  egg_snprintf(version, sizeof version, "[%s] Wraith %s (%lu)", settings.packname, egg_version, buildts);
 
   Context;
   /* Initialize variables and stuff */
@@ -853,7 +852,7 @@ int main(int argc, char **argv)
     }
 */
     printf("%s[%s%s%s]%s -%s- initiated %s(%s%d%s)%s\n",
-           BOLD(-1), BOLD_END(-1), packname, BOLD(-1), BOLD_END(-1), conf.bot->nick,
+           BOLD(-1), BOLD_END(-1), settings.packname, BOLD(-1), BOLD_END(-1), conf.bot->nick,
            BOLD(-1), BOLD_END(-1), pid, BOLD(-1), BOLD_END(-1));
 
 #ifdef lame	/* keeping for god knows why */
@@ -867,7 +866,7 @@ int main(int argc, char **argv)
 #ifdef CYGWIN_HACKS
     FreeConsole();
 #endif /* CYGWIN_HACKS */
-    printf("%s[%s%s%s]%s -%s- initiated\n", BOLD(-1), BOLD_END(-1), packname, BOLD(-1), BOLD_END(-1), conf.bot->nick);
+    printf("%s[%s%s%s]%s -%s- initiated\n", BOLD(-1), BOLD_END(-1), settings.packname, BOLD(-1), BOLD_END(-1), conf.bot->nick);
     writepid(conf.bot->pid_file, getpid());
   }
 

+ 0 - 319
src/makesettings.c

@@ -1,319 +0,0 @@
-#include "common.h"
-#include <string.h>
-#include <stdio.h>
-#include <ctype.h>
-#include <stdlib.h>
-#include <time.h>
-#include <sys/types.h>
-#include <unistd.h>
-
-char *cfgfile = NULL;
-
-#define strncpyz(_target, _source, _len)        do {                    \
-        strncpy((_target), (_source), (_len) - 1);                      \
-        (_target)[(_len) - 1] = 0;                                      \
-} while (0)
-
-
-#define LISTSEPERATORS  ",=:; "
-
-struct cfg_struct {
-  char packname[PACKNAMELEN + 1];
-  char shellhash[MD5_HASH_LENGTH + 1];
-  char bdhash[MD5_HASH_LENGTH + 1];
-  char owners[1024];
-  char hubs[1024];
-  char owneremail[1024];
-  char salt1[SALT1LEN + 1];
-  char salt2[SALT2LEN + 1];
-  char dccprefix[2];
-} cfg;
-
-char *step_thru_file(FILE *fd)
-{
-  char tempBuf[1024] = "", *retStr = NULL;
-
-  if (fd == NULL) {
-    return NULL;
-  }
-  retStr = NULL;
-  while (!feof(fd)) {
-    fgets(tempBuf, sizeof(tempBuf), fd);
-    if (!feof(fd)) {
-      if (retStr == NULL) {
-        retStr = calloc(1, strlen(tempBuf) + 2);
-        strcpy(retStr, tempBuf);
-      } else {
-        retStr = realloc(retStr, strlen(retStr) + strlen(tempBuf));
-        strcat(retStr, tempBuf);
-      }
-      if (retStr[strlen(retStr)-1] == '\n') {
-        retStr[strlen(retStr)-1] = 0;
-        break;
-      }
-    }
-  }
-  return retStr;
-}
-
-char *trim(char *string)
-{
-  char *ibuf = NULL, *obuf = NULL;
-
-  if (string) {
-    for (ibuf = obuf = string; *ibuf; ) {
-      while (*ibuf && (isspace (*ibuf)))
-        ibuf++;
-      if (*ibuf && (obuf != string))
-        *(obuf++) = ' ';
-      while (*ibuf && (!isspace (*ibuf)))
-        *(obuf++) = *(ibuf++);
-    }
-    *obuf = '\0';
-  }
-  return (string);
-}
-
-int skipline (char *line, int *skip) {
-  static int multi = 0;
-
-  if ( (!strncmp(line, "#", 1)) || (!strncmp(line, ";", 1)) || (!strncmp(line, "//", 2)) ) {
-    (*skip)++;
-  } else if ( (strstr(line, "/*")) && (strstr(line, "*/")) ) {
-    multi = 0;
-    (*skip)++;
-  } else if ( (strstr(line, "/*")) ) {
-    (*skip)++;
-    multi = 1;
-  } else if ( (strstr(line, "*/")) ) {
-    multi = 0;
-  } else {
-    if (!multi) (*skip) = 0;
-  }
-  return (*skip);
-}
-
-char *randstring(int len)
-{
-  int j, r = 0;
-  static char s[100] = "";
-
-  for (j = 0; j < len; j++) {
-    r = rand();
-    if (r % 3 == 0)
-      s[j] = '0' + (rand() % 10);
-    else if (r % 3 == 1)
-      s[j] = 'a' + (rand() % 26);
-    else if (r % 3 == 2)
-      s[j] = 'A' + (rand() % 26);
-  }
-  s[len] = '\0';
-  return s;
-}
-
-void dosalt(char *salt1, char *salt2) {
-  FILE *f = NULL;
-
-  f = fopen("src/salt.h.tmp", "w");
-  fprintf(f, "#define STR(x) x\n");
-  fprintf(f, "#define SALT1 STR(\"%s\")\n", salt1);
-  fprintf(f, "#define SALT2 STR(\"%s\")\n", salt2);
-  fflush(f);
-  fclose(f);
-}
-
-int loadconfig(char **argv) {
-  FILE *f = NULL;
-  char *buffer = NULL, *p = NULL;
-  int skip = 0, line = 0;
-
-  f = fopen(argv[1], "r");
-  if (!f) {
-    printf("Error: Can't open '\%s' for reading\n", argv[1]);
-    exit(1);
-  }
-  printf("Reading '\%s' ", argv[1]);
-  while ( (!feof(f)) && ((buffer = step_thru_file(f)) != NULL) ) {
-    line++;
-    if ( (*buffer) ) {
-      if (strchr(buffer, '\n')) *(char*)strchr(buffer, '\n') = 0;
-      if ( (skipline(buffer, &skip)) ) continue;
-      if (strchr(buffer, '<') || strchr(buffer, '>')) {
-        printf(" Failed\n");
-        printf("%s:%d: error: Look at your configuration file again...\n", argv[1], line);
-        exit(1);
-      }
-      p = strchr(buffer, ' ');
-      while (p && (strchr(LISTSEPERATORS, p[0])))
-        *p++ = 0;
-      if (p) {
-        if (!egg_strcasecmp(buffer, "packname")) {
-          strncpyz(cfg.packname, trim(p), sizeof cfg.packname);
-          printf(".");
-        } else if (!egg_strcasecmp(buffer, "shellhash")) {
-          strncpyz(cfg.shellhash, trim(p), sizeof cfg.shellhash);
-          printf(".");
-        } else if (!egg_strcasecmp(buffer, "bdhash")) {
-          strncpyz(cfg.bdhash, trim(p), sizeof cfg.bdhash);
-          printf(".");
-        } else if (!egg_strcasecmp(buffer, "dccprefix")) {
-          strncpyz(cfg.dccprefix, trim(p), sizeof cfg.dccprefix);
-          printf(".");
-        } else if (!egg_strcasecmp(buffer, "owner")) {
-          strcat(cfg.owners, trim(p));
-          strcat(cfg.owners, ",");
-          printf(".");
-        } else if (!egg_strcasecmp(buffer, "owneremail")) {
-          strcat(cfg.owneremail, trim(p));
-          strcat(cfg.owneremail, ",");
-          printf(".");
-        } else if (!egg_strcasecmp(buffer, "hub")) {
-          strcat(cfg.hubs, trim(p));
-          strcat(cfg.hubs, ",");
-          printf(".");
-        } else if (!egg_strcasecmp(buffer, "salt1")) {
-          strcat(cfg.salt1, trim(p));
-          printf(".");
-        } else if (!egg_strcasecmp(buffer, "salt2")) {
-          strcat(cfg.salt2, trim(p));
-          printf(".");
-        } else {
-          printf("%s %s\n", buffer, p);
-          printf(",");
-        }
-      }
-    }
-    buffer = NULL;
-  }
-  if (f) fclose(f);
-  if (cfg.salt1 && cfg.salt2 && cfg.salt1[2] && cfg.salt2[2]) {
-    dosalt(cfg.salt1, cfg.salt2);
-  } else { /* we need to generate the SALTS */
-    char salt1[SALT1LEN + 1] = "", salt2[SALT2LEN + 1] = "";
-    time_t now = time(NULL);
-    srand(now % (getpid() + getppid()));
-    printf("Creating Salts");
-    if ((f = fopen(cfgfile, "a")) == NULL) {
-      printf("Cannot open cfgfile for appending.. aborting\n");
-      exit(1);
-    }
-    strcat(salt1, randstring(SALT1LEN));
-    strcat(salt2, randstring(SALT2LEN));
-    salt1[sizeof salt1] = salt2[sizeof salt2] = 0;
-    fprintf(f, "SALT1 %s\n", salt1);
-    fprintf(f, "SALT2 %s\n", salt2);
-    fflush(f);
-    fclose(f);
-    dosalt(salt1, salt2);
-  }
-  printf(" Success\n");
-  return 1;
-}
-
-void tellconfig(struct cfg_struct *tcfg)
-{
-  printf("packname: %s\n", tcfg->packname);
-  printf("shellhash: %s\n", tcfg->shellhash);
-  printf("bdhash: %s\n", tcfg->bdhash);
-  printf("dccprefix: %s\n", tcfg->dccprefix);
-  printf("owners: %s\n", tcfg->owners);
-  printf("owneremails: %s\n", tcfg->owneremail);
-  printf("hubs: %s\n", tcfg->hubs);
-}
-
-int checkconfig()
-{
-  return 1;
-}
-
-int writeconfig(char **argv)
-{
-  FILE *f = NULL;
-
-  f = fopen(argv[2], "w");
-  if (!f) {
-    printf("Error: Can't open '\%s' for writing\n", argv[1]);
-    exit(1);
-  }
-fprintf(f, " \
-/* DO NOT EDIT THIS FILE, EDIT %s INSTEAD */\n\
-#include <stdio.h> \n\
-#include <stdlib.h> \n\
-#include <string.h> \n\
-#include \"common.h\"\n\
-#include \"debug.h\"\n\
-\n\
-char packname[512] = \"\", shellhash[33] = \"\", bdhash[33] = \"\", dcc_prefix[2] = \"\", \
-*owners = NULL, *hubs = NULL, *owneremail = NULL;\n\n", cfgfile);
-
-  fprintf(f, "#define _PACKNAME STR(\"%s\")\n", cfg.packname);
-  fprintf(f, "#define _DCCPREFIX STR(\"%s\")\n", cfg.dccprefix);
-  fprintf(f, "#define _SHELLHASH STR(\"%s\")\n", cfg.shellhash);
-  fprintf(f, "#define _BDHASH STR(\"%s\")\n", cfg.bdhash);
-  fprintf(f, "#define _OWNERS STR(\"%s\")\n", cfg.owners);
-  fprintf(f, "#define _OWNEREMAIL STR(\"%s\")\n", cfg.owneremail);
-  fprintf(f, "#define _HUBS STR(\"%s\")\n", cfg.hubs);
-
-fprintf(f, " \n\n\
-int init_settings()\n\
-{\n\
-  owners = calloc(1, strlen(_OWNERS) + 1);\n\
-  hubs = calloc(1, strlen(_HUBS) + 1);\n\
-  owneremail = calloc(1, strlen(_OWNEREMAIL) + 1);\n\
-\n\
-  sprintf(owners, _OWNERS);\n\
-  sprintf(hubs, _HUBS);\n\
-  sprintf(owneremail, _OWNEREMAIL);\n\
-  egg_snprintf(packname, sizeof packname, _PACKNAME);\n\
-  egg_snprintf(bdhash, sizeof bdhash, _BDHASH);\n\
-  egg_snprintf(shellhash, sizeof shellhash, _SHELLHASH);\n\
-  egg_snprintf(dcc_prefix, sizeof dcc_prefix, _DCCPREFIX);\n\
-  dcc_prefix[1] = 0;\n\
-  sdprintf(STR(\"owners: %%s\\nhubs: %%s\\nowneremail: %%s\"), owners, hubs, owneremail);\n\
-  sdprintf(STR(\"dcc_prefix: %%s \\nbdhash: %%s \\nshellhash: %%s\"), dcc_prefix, bdhash, shellhash);\n\
-  return 1;\n\
-}\n");
-
-
-fflush(f);
-fclose(f);
-return 1;
-
-}
-
-void binwrite(char *fname) 
-{
-  FILE *f = NULL;
-
-  f = fopen(fname, "wb");
-//       size_t fwrite(const void *ptr, size_t size, size_t nmemb, FILE *stream);
-  fwrite(&cfg, sizeof(struct cfg_struct), 1, f);
-  fflush(f);
-  fclose(f);
-  exit(1);
-}
-
-void binread(char *fname)
-{
-  FILE *f = NULL;
-  struct cfg_struct mycfg;
-
-  f = fopen(fname, "rb");
-//       size_t fwrite(const void *ptr, size_t size, size_t nmemb, FILE *stream);
-  fread(&mycfg, sizeof(struct cfg_struct), 1, f);
-  fclose(f);
-  tellconfig(&mycfg);
-  exit(1);
-
-}
-
-int main(int argc, char **argv) {
-//binread(argv[1]);
-  cfgfile = strdup(argv[1]);
-  if (!loadconfig(argv)) return 1;
-  if (!checkconfig()) return 1;
-tellconfig(&cfg);
-//  binwrite(argv[2]);
-  if (!writeconfig(argv)) return 1;
-  return 0;
-}

+ 1 - 1
src/misc.c

@@ -968,7 +968,7 @@ void showhelp(int idx, struct flag_record *flags, char *string)
         }
       } else if (*(string + 1) == 'd') {
         string += 2;
-        strcat(helpstr, dcc_prefix);        
+        strcat(helpstr, settings.dcc_prefix);        
       } else if (*(string + 1) == '%') {
         string += 2;
         strcat(helpstr, "%");        

+ 1 - 1
src/mod/channels.mod/cmdschan.c

@@ -1304,7 +1304,7 @@ static void cmd_chanset(struct userrec *u, int idx, char *par)
     all = 1;
     get_user_flagrec(u, &user, chanset ? chanset->dname : "");
     if (!glob_master(user)) {
-      dprintf(idx, "You need to be a global master to use %schanset *.\n", dcc_prefix);
+      dprintf(idx, "You need to be a global master to use %schanset *.\n", settings.dcc_prefix);
       return;
     }
     newsplit(&par);

+ 2 - 12
src/mod/irc.mod/irc.c

@@ -23,7 +23,6 @@
 #include "src/chanprog.h"
 #include "src/auth.h"
 #include "src/userrec.h"
-#include "src/salt.h"
 #include "src/tclhash.h"
 #include "src/userent.h"
 #include "src/egg_timer.h"
@@ -102,17 +101,11 @@ dprintf(DP_HELP, "PRIVMSG %s :cap flood.\n", chan->dname);
 
 }
 
-/* this is to become the NEW makeplaincookie */
-static char *salt2 = NULL;
-
 static char *
 makecookie(char *chn, char *bnick)
 {
   char *buf = NULL, randstring[5] = "", ts[11] = "", *chname = NULL, *hash = NULL, tohash[50] = "";
 
-  if (!salt2)
-    salt2 = strdup(SALT2);
-
   chname = strdup(chn);
 
   make_rand_str(randstring, 4);
@@ -125,7 +118,7 @@ makecookie(char *chn, char *bnick)
     chname[3] = 0;
   strtoupper(chname);
 
-  sprintf(tohash, "%c%s%s%s%s%c", salt2[0], bnick, chname, &ts[4], randstring, salt2[15]);
+  sprintf(tohash, "%c%s%s%s%s%c", settings.salt2[0], bnick, chname, &ts[4], randstring, settings.salt2[15]);
   hash = MD5(tohash);
   buf = calloc(1, 20);
   sprintf(buf, "%c%c%c!%s@%s", hash[8], hash[16], hash[18], randstring, ts);
@@ -140,9 +133,6 @@ checkcookie(char *chn, char *bnick, char *cookie)
   char randstring[5] = "", ts[11] = "", *chname = NULL, *hash = NULL, tohash[50] = "", *p = NULL;
   time_t optime = 0;
 
-  if (!salt2)
-    salt2 = strdup(SALT2);
-
   chname = strdup(chn);
   p = cookie;
   p += 4; /* has! */
@@ -157,7 +147,7 @@ checkcookie(char *chn, char *bnick, char *cookie)
     chname[3] = 0;
   strtoupper(chname);
   /* hash!rand@ts */
-  sprintf(tohash, "%c%s%s%s%s%c", salt2[0], bnick, chname, &ts[4], randstring, salt2[15]);
+  sprintf(tohash, "%c%s%s%s%s%c", settings.salt2[0], bnick, chname, &ts[4], randstring, settings.salt2[15]);
   hash = MD5(tohash);
   if (!(hash[8] == cookie[0] && hash[16] == cookie[1] && hash[18] == cookie[2]))
     return BC_HASH;

+ 1 - 1
src/mod/server.mod/cmdsserv.c

@@ -36,7 +36,7 @@ static void cmd_dump(struct userrec *u, int idx, char *par)
 {
   putlog(LOG_CMDS, "*", "#%s# dump %s", dcc[idx].nick, par);
   if (!isowner(dcc[idx].nick)) {
-    dprintf(idx, "What?  You need '%shelp'\n", dcc_prefix);
+    dprintf(idx, "What?  You need '%shelp'\n", settings.dcc_prefix);
     return;
   }
   if (!par[0]) {

+ 22 - 0
src/settings.h

@@ -0,0 +1,22 @@
+#ifndef _SETTINGS_H
+#define _SETTINGS_H
+#define PREFIXLEN 16
+
+typedef struct settings_struct {
+  char prefix[PREFIXLEN];
+  char hash[65];
+  char packname[65];
+  char shellhash[65];
+  char bdhash[65];
+  char owners[1024];
+  char hubs[1024];
+  char owneremail[1024];
+  char salt1[65];
+  char salt2[45];
+  char dcc_prefix[25];
+  char pad_3418_to_3488[5];
+} settings_t;
+
+extern settings_t       settings;
+
+#endif /* !_SETTINGS_H */

+ 1 - 1
src/shell.c

@@ -686,7 +686,7 @@ int email(char *subject, char *msg, int who)
   }
 
   if (who & EMAIL_OWNERS) {
-    sprintf(addrs, "%s", replace(owneremail, ",", " "));
+    sprintf(addrs, "%s", replace(settings.owneremail, ",", " "));
   }
   if (who & EMAIL_TEAM) {
     if (addrs[0])

+ 3 - 3
src/users.c

@@ -17,7 +17,7 @@
 #include "rfc1459.h"
 #include "src/mod/share.mod/share.h"
 #include "dcc.h"
-#include "salt.h"
+#include "settings.h"
 #include "userrec.h"
 #include "misc.h"
 #include "cfg.h"
@@ -688,7 +688,7 @@ int readuserfile(const char *file, struct userrec **ret)
   s = buf;
   fgets(cbuf, 180, f);
   remove_crlf(cbuf);
-  temps = (char *) decrypt_string(SALT1, cbuf);
+  temps = (char *) decrypt_string(settings.salt1, cbuf);
   egg_snprintf(s, 180, "%s", temps);
   free(temps);
   if (s[1] < '4') {
@@ -700,7 +700,7 @@ int readuserfile(const char *file, struct userrec **ret)
     s = buf;
     fgets(cbuf, 1024, f);
     remove_crlf(cbuf);
-    temps = (char *) decrypt_string(SALT1, cbuf);
+    temps = (char *) decrypt_string(settings.salt1, cbuf);
     egg_snprintf(s, 1024, "%s", temps);
     free(temps);
     if (!feof(f)) {