diff options
| -rw-r--r-- | Makefile | 4 | ||||
| -rwxr-xr-x | configure | 2 | ||||
| -rw-r--r-- | crypting.c | 133 | ||||
| -rw-r--r-- | crypting.h | 29 | ||||
| -rw-r--r-- | irc.c | 1 | ||||
| -rw-r--r-- | root_commands.c | 1 | ||||
| -rw-r--r-- | storage.c | 2 | ||||
| -rw-r--r-- | storage_text.c | 157 | ||||
| -rw-r--r-- | win32.c | 1 | 
9 files changed, 3 insertions, 327 deletions
| @@ -9,8 +9,8 @@  -include Makefile.settings  # Program variables -objects = account.o bitlbee.o chat.o crypting.o dcc.o help.o ipc.o irc.o irc_commands.o nick.o query.o root_commands.o set.o storage.o $(STORAGE_OBJS) user.o -headers = account.h bitlbee.h commands.h conf.h config.h crypting.h help.h ipc.h irc.h log.h nick.h query.h set.h sock.h storage.h user.h lib/events.h lib/ftutil.h lib/http_client.h lib/ini.h lib/md5.h lib/misc.h lib/proxy.h lib/sha1.h lib/ssl_client.h lib/url.h protocols/ft.h protocols/nogaim.h +objects = account.o bitlbee.o chat.o dcc.o help.o ipc.o irc.o irc_commands.o nick.o query.o root_commands.o set.o storage.o $(STORAGE_OBJS) user.o +headers = account.h bitlbee.h commands.h conf.h config.h help.h ipc.h irc.h log.h nick.h query.h set.h sock.h storage.h user.h lib/events.h lib/ftutil.h lib/http_client.h lib/ini.h lib/md5.h lib/misc.h lib/proxy.h lib/sha1.h lib/ssl_client.h lib/url.h protocols/ft.h protocols/nogaim.h  subdirs = lib protocols  ifeq ($(TARGET),i586-mingw32msvc) @@ -395,7 +395,7 @@ if detect_resolv_dynamic || detect_resolv_static; then  	echo '#define HAVE_RESOLV_A' >> config.h  fi -STORAGES="text xml" +STORAGES="xml"  if [ "$ldap" = "auto" ]; then  	detect_ldap diff --git a/crypting.c b/crypting.c deleted file mode 100644 index 0a5c937e..00000000 --- a/crypting.c +++ /dev/null @@ -1,133 +0,0 @@ -  /********************************************************************\ -  * BitlBee -- An IRC to other IM-networks gateway                     * -  *                                                                    * -  * Copyright 2002-2004 Sjoerd Hemminga and others                     * -  \********************************************************************/ - -/* A little bit of encryption for the users' passwords                  */ - -/* -  This program is free software; you can redistribute it and/or modify -  it under the terms of the GNU General Public License as published by -  the Free Software Foundation; either version 2 of the License, or -  (at your option) any later version. - -  This program is distributed in the hope that it will be useful, -  but WITHOUT ANY WARRANTY; without even the implied warranty of -  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the -  GNU General Public License for more details. - -  You should have received a copy of the GNU General Public License with -  the Debian GNU/Linux distribution in /usr/share/common-licenses/GPL; -  if not, write to the Free Software Foundation, Inc., 59 Temple Place, -  Suite 330, Boston, MA  02111-1307  USA -*/ - -/* [WvG] This file can also be compiled into a stand-alone program -   which can encode/decode BitlBee account files. The main() will be -   included if CRYPTING_MAIN is defined. Or just do "make decode" and -   the programs will be built. */ - -#include <bitlbee.h> -#include "md5.h" -#include "crypting.h" - -/*\ - * [SH] Do _not_ call this if it's not entirely sure that it will not cause - * harm to another users file, since this does not check the password for - * correctness. -\*/ - -int checkpass (const char *pass, const char *md5sum) -{ -	md5_state_t md5state; -	md5_byte_t digest[16]; -	int i, j; -	char digits[3]; -	 -	md5_init (&md5state); -	md5_append (&md5state, (unsigned char *)pass, strlen (pass)); -	md5_finish (&md5state, digest); -	 -	for (i = 0, j = 0; i < 16; i++, j += 2) { -		/* Check password for correctness */ -		g_snprintf (digits, sizeof (digits), "%02x\n", digest[i]); -		 -		if (digits[0] != md5sum[j]) return (-1); -		if (digits[1] != md5sum[j + 1]) return (-1); -	} - -	return( 0 ); -} - - -char *hashpass (const char *password) -{ -	md5_state_t md5state; -	md5_byte_t digest[16]; -	int i; -	char digits[3]; -	char *rv; -	 -	if (password == NULL) return (NULL); -	 -	rv = g_new0 (char, 33); -	 -	md5_init (&md5state); -	md5_append (&md5state, (const unsigned char *)password, strlen (password)); -	md5_finish (&md5state, digest); -	 -	for (i = 0; i < 16; i++) { -		/* Build a hash of the pass */ -		g_snprintf (digits, sizeof (digits), "%02x", digest[i]); -		strcat (rv, digits); -	} -	 -	return (rv); -} - -char *obfucrypt (char *line, const char *password)  -{ -	int i, j; -	char *rv; -	 -	if (password == NULL) return (NULL); -	 -	rv = g_new0 (char, strlen (line) + 1); -	 -	i = j = 0; -	while (*line) { -		/* Encrypt/obfuscate the line, using the password */ -		if (*(signed char*)line < 0) *line = - (*line); -		 -		rv[j] = *line + password[i]; /* Overflow intended */ -		 -		line++; -		if (!password[++i]) i = 0; -		j++; -	} -	 -	return (rv); -} - -char *deobfucrypt (char *line, const char *password)  -{ -	int i, j; -	char *rv; -	 -	if (password == NULL) return (NULL); -	 -	rv = g_new0 (char, strlen (line) + 1); -	 -	i = j = 0; -	while (*line) { -		/* Decrypt/deobfuscate the line, using the pass */ -		rv[j] = *line - password[i]; /* Overflow intended */ -		 -		line++; -		if (!password[++i]) i = 0; -		j++; -	} -	 -	return (rv); -} diff --git a/crypting.h b/crypting.h deleted file mode 100644 index e13b0433..00000000 --- a/crypting.h +++ /dev/null @@ -1,29 +0,0 @@ -  /********************************************************************\ -  * BitlBee -- An IRC to other IM-networks gateway                     * -  *                                                                    * -  * Copyright 2002-2004 Sjoerd Hemminga and others                     * -  \********************************************************************/ - -/* A little bit of encryption for the users' passwords                  */ - -/* -  This program is free software; you can redistribute it and/or modify -  it under the terms of the GNU General Public License as published by -  the Free Software Foundation; either version 2 of the License, or -  (at your option) any later version. - -  This program is distributed in the hope that it will be useful, -  but WITHOUT ANY WARRANTY; without even the implied warranty of -  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the -  GNU General Public License for more details. - -  You should have received a copy of the GNU General Public License with -  the Debian GNU/Linux distribution in /usr/share/common-licenses/GPL; -  if not, write to the Free Software Foundation, Inc., 59 Temple Place, -  Suite 330, Boston, MA  02111-1307  USA -*/ - -int checkpass (const char *password, const char *md5sum); -G_GNUC_MALLOC char *hashpass (const char *password); -G_GNUC_MALLOC char *obfucrypt (char *line, const char *password); -G_GNUC_MALLOC char *deobfucrypt (char *line, const char *password); @@ -26,7 +26,6 @@  #define BITLBEE_CORE  #include "bitlbee.h"  #include "sock.h" -#include "crypting.h"  #include "ipc.h"  #include "dcc.h" diff --git a/root_commands.c b/root_commands.c index e42268b5..d3b0c7d3 100644 --- a/root_commands.c +++ b/root_commands.c @@ -25,7 +25,6 @@  #define BITLBEE_CORE  #include "commands.h" -#include "crypting.h"  #include "bitlbee.h"  #include "help.h"  #include "chat.h" @@ -27,7 +27,6 @@  #define BITLBEE_CORE  #include "bitlbee.h" -#include "crypting.h"  extern storage_t storage_text;  extern storage_t storage_xml; @@ -65,7 +64,6 @@ GList *storage_init(const char *primary, char **migrate)  	int i;  	storage_t *storage; -	register_storage_backend(&storage_text);  	register_storage_backend(&storage_xml);  	storage = storage_init_single(primary); diff --git a/storage_text.c b/storage_text.c deleted file mode 100644 index 8ce4edcf..00000000 --- a/storage_text.c +++ /dev/null @@ -1,157 +0,0 @@ -  /********************************************************************\ -  * BitlBee -- An IRC to other IM-networks gateway                     * -  *                                                                    * -  * Copyright 2002-2004 Wilmer van der Gaast and others                * -  \********************************************************************/ - -/* Storage backend that uses the same file format as <=1.0 */ - -/* -  This program is free software; you can redistribute it and/or modify -  it under the terms of the GNU General Public License as published by -  the Free Software Foundation; either version 2 of the License, or -  (at your option) any later version. - -  This program is distributed in the hope that it will be useful, -  but WITHOUT ANY WARRANTY; without even the implied warranty of -  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the -  GNU General Public License for more details. - -  You should have received a copy of the GNU General Public License with -  the Debian GNU/Linux distribution in /usr/share/common-licenses/GPL; -  if not, write to the Free Software Foundation, Inc., 59 Temple Place, -  Suite 330, Boston, MA  02111-1307  USA -*/ - -#define BITLBEE_CORE -#include "bitlbee.h" -#include "crypting.h" -#ifdef _WIN32 -# define umask _umask -# define mode_t int -#endif - -#ifndef F_OK -#define F_OK 0 -#endif - -static void text_init (void) -{ -	/* Don't complain about the configuration directory anymore, leave it -	   up to the XML storage module, which uses the same directory for it -	   anyway. Nobody should be using just the text plugin anymore since -	   it's read only! */ -} - -static storage_status_t text_load( irc_t *irc, const char* password ) -{ -	char s[512]; -	char *line; -	int proto; -	char nick[MAX_NICK_LENGTH+1]; -	FILE *fp; -	user_t *ru = user_find( irc, ROOT_NICK ); -	account_t *acc, *acc_lookup[9]; -	 -	g_snprintf( s, 511, "%s%s%s", global.conf->configdir, irc->nick, ".accounts" ); -   	fp = fopen( s, "r" ); -   	if( !fp ) return STORAGE_NO_SUCH_USER; -	 -	fscanf( fp, "%32[^\n]s", s ); - -	if( checkpass( password, s ) != 0 ) -	{ -		fclose( fp ); -		return STORAGE_INVALID_PASSWORD; -	} -	 -	while( fscanf( fp, "%511[^\n]s", s ) > 0 ) -	{ -		fgetc( fp ); -		line = deobfucrypt( s, password ); -		if (line == NULL) return STORAGE_OTHER_ERROR; -		root_command_string( irc, ru, line, 0 ); -		g_free( line ); -	} -	fclose( fp ); -	 -	/* Build a list with the first listed account of every protocol -	   number. So if the user had nicks defined for a second account on -	   the same IM network, those nicks will be added to the wrong -	   account, and the user should rename those buddies again. But at -	   least from now on things will be saved properly. */ -	memset( acc_lookup, 0, sizeof( acc_lookup ) ); -	for( acc = irc->accounts; acc; acc = acc->next ) -	{ -		if( acc_lookup[0] == NULL && strcmp( acc->prpl->name, "oscar" ) == 0 ) -			acc_lookup[0] = acc_lookup[1] = acc_lookup[3] = acc; -		else if( acc_lookup[2] == NULL && strcmp( acc->prpl->name, "yahoo" ) == 0 ) -			acc_lookup[2] = acc; -		else if( acc_lookup[4] == NULL && strcmp( acc->prpl->name, "msn" ) == 0 ) -			acc_lookup[4] = acc; -		else if( acc_lookup[8] == NULL && strcmp( acc->prpl->name, "jabber" ) == 0 ) -			acc_lookup[8] = acc; -	} -	 -	g_snprintf( s, 511, "%s%s%s", global.conf->configdir, irc->nick, ".nicks" ); -	fp = fopen( s, "r" ); -	if( !fp ) return STORAGE_NO_SUCH_USER; -	while( fscanf( fp, "%s %d %s", s, &proto, nick ) > 0 ) -	{ -		if( proto < 0 || proto > 8 || ( acc = acc_lookup[proto] ) == NULL ) -			continue; -		 -		http_decode( s ); -		nick_set( acc, s, nick ); -	} -	fclose( fp ); -	 -	return STORAGE_OK; -} - -static storage_status_t text_check_pass( const char *nick, const char *password ) -{ -	char s[512]; -	FILE *fp; -	 -	g_snprintf( s, 511, "%s%s%s", global.conf->configdir, nick, ".accounts" ); -	fp = fopen( s, "r" ); -	if (!fp) -		return STORAGE_NO_SUCH_USER; - -	fscanf( fp, "%32[^\n]s", s ); -	fclose( fp ); - -	if (checkpass( password, s) == -1) -		return STORAGE_INVALID_PASSWORD; - -	return STORAGE_OK; -} - -static storage_status_t text_remove( const char *nick, const char *password ) -{ -	char s[512]; -	storage_status_t status; - -	status = text_check_pass( nick, password ); -	if (status != STORAGE_OK) -		return status; - -	g_snprintf( s, 511, "%s%s%s", global.conf->configdir, nick, ".accounts" ); -	if (unlink( s ) == -1) -		return STORAGE_OTHER_ERROR; -	 -	g_snprintf( s, 511, "%s%s%s", global.conf->configdir, nick, ".nicks" ); -	if (unlink( s ) == -1) -		return STORAGE_OTHER_ERROR; - -	return STORAGE_OK; -} - -storage_t storage_text = { -	.name = "text", -	.init = text_init, -	.check_pass = text_check_pass, -	.remove = text_remove, -	.load = text_load -}; @@ -26,7 +26,6 @@  #define BITLBEE_CORE  #include "bitlbee.h"  #include "commands.h" -#include "crypting.h"  #include "protocols/nogaim.h"  #include "help.h"  #include <signal.h> | 
