Răsfoiți Sursa

* Lame authkey !

svn: 1122
Bryan Drewery 22 ani în urmă
părinte
comite
3bff35ad3c
3 a modificat fișierele cu 7 adăugiri și 17 ștergeri
  1. 3 5
      src/auth.c
  2. 2 1
      src/auth.h
  3. 2 11
      src/cfg.c

+ 3 - 5
src/auth.c

@@ -36,10 +36,6 @@ static int max_auth = 50;
 struct auth_t *auth = NULL;
 #endif /* S_AUTHCMDS */
 
-#if defined(S_AUTHHASH) || defined(S_DCCAUTH)
-char authkey[121] = "";         /* This is one of the keys used in the auth hash */
-#endif /* S_AUTHHASH || S_DCCAUTH */
-
 #ifdef S_AUTHCMDS
 void
 init_auth_max()
@@ -89,7 +85,9 @@ makehash(struct userrec *u, char *randstring)
     secpass = strdup(get_user(&USERENTRY_SECPASS, u));
     secpass[strlen(secpass)] = 0;
   }
-  egg_snprintf(hash, sizeof hash, "%s%s%s", randstring, (secpass && secpass[0]) ? secpass : "", (authkey && authkey[0]) ? authkey : "");
+  egg_snprintf(hash, sizeof hash, "%s%s%s", randstring, (secpass && secpass[0]) ? secpass : "", authkey);
+
+  sdprintf("hash: %s", hash);
   if (secpass)
     free(secpass);
 

+ 2 - 1
src/auth.h

@@ -36,7 +36,8 @@ extern struct auth_t *auth;
 #  endif
        /* S_AUTHCMDS */
 #  if defined(S_AUTHHASH) || defined(S_DCCAUTH)
-extern char authkey[121];
+#include "cfg.h"
+#define authkey CFG_AUTHKEY.ldata ? CFG_AUTHKEY.ldata : CFG_AUTHKEY.gdata ? CFG_AUTHKEY.gdata : ""
 #  endif
        /* S_AUTHHASH || S_DCCAUTH */
 

+ 2 - 11
src/cfg.c

@@ -95,19 +95,10 @@ static void authkey_describe(struct cfg_entry *entry, int idx) {
 }
 #endif /* HUB */
 
-#ifdef LEAF
-static void authkey_changed(struct cfg_entry *entry, char *olddata, int *valid) {
-  if (entry->ldata)
-    strncpyz(authkey, (char *) entry->ldata, sizeof authkey);
-  else if (entry->gdata)
-    strncpyz(authkey, (char *) entry->gdata, sizeof authkey);
-}
-#endif /* LEAF */
-
 struct cfg_entry CFG_AUTHKEY = {
-	"authkey", CFGF_LOCAL | CFGF_GLOBAL, NULL, NULL, 
+	"authkey", CFGF_LOCAL | CFGF_GLOBAL, NULL, NULL,
 #ifdef LEAF
-	authkey_changed, authkey_changed
+	NULL, NULL
 #else
 	NULL, NULL, authkey_describe
 #endif /* LEAF */