Index: ircd-ratbox/modules/core/m_server.c
===================================================================
--- ircd-ratbox.orig/modules/core/m_server.c	2014-01-25 18:20:21.068960078 +0100
+++ ircd-ratbox/modules/core/m_server.c	2014-01-25 18:48:44.838116244 +0100
@@ -668,6 +668,7 @@
 	struct server_conf *tmp_p;
 	rb_dlink_node *ptr;
 	int error = NO_NLINE;
+	char *crypt_passwd = NULL;
 
 	s_assert(NULL != client_p);
 	if(client_p == NULL)
@@ -699,8 +700,10 @@
 
 			if(ServerConfEncrypted(tmp_p))
 			{
-				if(!strcmp(tmp_p->passwd, rb_crypt(client_p->localClient->passwd,
-								   tmp_p->passwd)))
+				crypt_passwd = rb_crypt(client_p->localClient->passwd,
+							tmp_p->passwd);
+
+				if(crypt_passwd && !strcmp(tmp_p->passwd, crypt_passwd))
 				{
 					server_p = tmp_p;
 					break;
Index: ircd-ratbox/modules/m_oper.c
===================================================================
--- ircd-ratbox.orig/modules/m_oper.c	2014-01-25 18:20:21.068960078 +0100
+++ ircd-ratbox/modules/m_oper.c	2014-01-25 18:38:36.580585507 +0100
@@ -224,7 +224,7 @@
 	else
 		encr = password;
 
-	if(strcmp(encr, oper_p->passwd) == 0)
+	if(encr && strcmp(encr, oper_p->passwd) == 0)
 		return YES;
 	else
 		return NO;
Index: ircd-ratbox/src/s_user.c
===================================================================
--- ircd-ratbox.orig/src/s_user.c	2014-01-25 18:20:21.072960063 +0100
+++ ircd-ratbox/src/s_user.c	2014-01-25 18:38:36.580585507 +0100
@@ -389,7 +389,7 @@
 		else
 			encr = source_p->localClient->passwd;
 
-		if(strcmp(encr, aconf->passwd))
+		if(encr && strcmp(encr, aconf->passwd))
 		{
 			ServerStats.is_ref++;
 			sendto_one(source_p, form_str(ERR_PASSWDMISMATCH), me.name, source_p->name);
Index: ircd-ratbox/tools/mkpasswd.c
===================================================================
--- ircd-ratbox.orig/tools/mkpasswd.c	2011-09-27 19:28:17.567545931 +0200
+++ ircd-ratbox/tools/mkpasswd.c	2014-01-25 18:47:39.086382640 +0100
@@ -98,6 +98,7 @@
 main(int argc, char *argv[])
 {
 	char *plaintext = NULL;
+	char *crypt_passwd = NULL;
 	int c;
 	char *saltpara = NULL;
 	char *salt;
@@ -249,7 +250,14 @@
 		plaintext = getpass("plaintext: ");
 	}
 
-	printf("%s\n", rb_crypt(plaintext, salt));
+	crypt_passwd = rb_crypt(plaintext, salt);
+	if(!crypt_passwd)
+	{
+		fprintf(stderr, "Error while encryting password\n");
+		return 1;
+	}
+
+	printf("%s\n", crypt_passwd);
 	return 0;
 }
 
