Explorar el Código

* Fixed auth hashes

svn: 353
Bryan Drewery hace 22 años
padre
commit
d73c8fa6d8
Se han modificado 3 ficheros con 8 adiciones y 7 borrados
  1. 1 1
      pack/conf.h
  2. 2 2
      src/auth.c
  3. 5 4
      src/eggdrop.h

+ 1 - 1
pack/conf.h

@@ -10,7 +10,7 @@
 
 /*      S_FEATURE	  RECOMMENDED	DESCRIPTION 					*/
 #define S_ANTITRACE	/*  yes		ptrace detection 				*/
-#undef S_AUTH		/*  yes		authorization system (HIGHLY RECOMMENDED)	*/
+#define S_AUTH		/*  yes		authorization system (HIGHLY RECOMMENDED)	*/
 #define S_AUTOAWAY	/*  yes		random autoaway/return on IRC 			*/
 #define S_AUTOLOCK      /*  yes         will lock channels upon certain coniditions     */
 #define S_DCCPASS	/*  yes		DCC command passwords 				*/

+ 2 - 2
src/auth.c

@@ -88,8 +88,8 @@ void init_auth()
 char *makehash(struct userrec *u, char *rand)
 {
   MD5_CTX ctx;
-  unsigned char md5out[34];
-  char md5string[34], hash[500], *ret = NULL;
+  unsigned char md5out[MD5_HASH_LENGTH + 1];
+  char md5string[MD5_HASH_LENGTH + 1], hash[500], *ret = NULL;
   sprintf(hash, "%s%s%s", rand, (char *) get_user(&USERENTRY_SECPASS, u), authkey ? authkey : "");
   MD5_Init(&ctx);
   MD5_Update(&ctx, hash, strlen(hash));

+ 5 - 4
src/eggdrop.h

@@ -311,9 +311,12 @@ struct dcc_table {
 
 struct userrec;
 
+#define SHA_HASH_LENGTH (SHA_DIGEST_LENGTH * 2)
+#define MD5_HASH_LENGTH (MD5_DIGEST_LENGTH * 2)
+
 struct auth_t {
   struct userrec *user;
-  char hash[33];                /* used for dcc authing */
+  char hash[MD5_HASH_LENGTH + 1];                /* used for dcc authing */
   char nick[NICKLEN];
   char host[UHOSTLEN];
   int authed;
@@ -335,7 +338,7 @@ struct dcc_t {
   char simulbot[NICKLEN];	/* used for hub->leaf cmd simulation, holds bot that results should be sent to */
   time_t simultime;		/* the time when the simul dcc is initiated, expires after a number of seconds */
   int simul;			/* this will hold the idx on the remote bot to return result. */
-  char hash[33];                /* used for dcc authing */
+  char hash[MD5_HASH_LENGTH + 1];                /* used for dcc authing */
   char nick[NICKLEN];
   char host[UHOSTLEN];
   struct dcc_table *type;
@@ -717,8 +720,6 @@ enum {
 /* This is used by the net module to keep track of sockets and what's
  * queued on them
  */
-#define SHA_HASH_LENGTH (SHA_DIGEST_LENGTH * 2)
-#define MD5_HASH_LENGTH (MD5_DIGEST_LENGTH * 2)
 typedef struct {
   int		 sock;
   short		 flags;