[ekg2-commit] ekg2: digest.c (HEAD) jabber.h (HEAD) jabber_handlers.c (HEAD) [darkjames]

CVS commit cvs w toxygen.net
Czw, 3 Maj 2007, 00:00:30 CEST


Module name:	ekg2
Changes by:	darkjames	2007-05-03 00:00:28

Modified files:
	digest.c jabber.h jabber_handlers.c

Log message:
if you're using only tlen proto, you won't connect to tlen servers.
than do /session -a test w test.pl ...
1st patch to fix it.

Index: digest.c
===================================================================
RCS file: /home/cvs/ekg2/plugins/jabber/digest.c,v
diff -d -u -r1.19 -r1.20
--- digest.c	12 Apr 2007 13:52:13 -0000	1.19
+++ digest.c	2 May 2007 22:00:28 -0000	1.20
@@ -476,7 +476,7 @@
  * @return <b>static</b> buffer, with 40 digit SHA1 hash + NUL char
  */
 
-char *jabber_digest(const char *sid, const char *password) {
+char *jabber_digest(const char *sid, const char *password, void *charset) {
 	EKG2_SHA1_CTX ctx;
 	unsigned char digest[20];
 	static char result[41];
@@ -485,11 +485,11 @@
 
 	SHA1Init(&ctx);
 
-	tmp = ekg_convert_string_p(sid, jconv_out);
+	tmp = ekg_convert_string_p(sid, charset);
 	SHA1Update(&ctx, (tmp ? tmp : sid), xstrlen(tmp ? tmp : sid));
 	xfree(tmp);
 
-	tmp = ekg_convert_string_p(password, jconv_out);
+	tmp = ekg_convert_string_p(password, charset);
 	SHA1Update(&ctx, (tmp ? tmp : password), xstrlen(tmp ? tmp : sid));
 	xfree(tmp);
 

Index: jabber.h
===================================================================
RCS file: /home/cvs/ekg2/plugins/jabber/jabber.h,v
diff -d -u -r1.68 -r1.69
--- jabber.h	12 Apr 2007 13:33:49 -0000	1.68
+++ jabber.h	2 May 2007 22:00:28 -0000	1.69
@@ -163,7 +163,7 @@
 void jabber_handle(void *data, xmlnode_t *n);
 
 /* digest.c hashowanie.. */
-char *jabber_digest(const char *sid, const char *password);
+char *jabber_digest(const char *sid, const char *password, void *charset);
 char *jabber_dcc_digest(char *sid, char *initiator, char *target);
 char *jabber_challange_digest(const char *sid, const char *password, const char *nonce, const char *cnonce, const char *xmpp_temp, const char *realm);
 void jabber_iq_auth_send(session_t *s, const char *username, const char *passwd, const char *stream_id);

Index: jabber_handlers.c
===================================================================
RCS file: /home/cvs/ekg2/plugins/jabber/jabber_handlers.c,v
diff -d -u -r1.100 -r1.101
--- jabber_handlers.c	23 Apr 2007 20:10:24 -0000	1.100
+++ jabber_handlers.c	2 May 2007 22:00:28 -0000	1.101
@@ -128,12 +128,15 @@
  */
 
 void jabber_iq_auth_send(session_t *s, const char *username, const char *passwd, const char *stream_id) {
+	extern void *jconv_out; /* misc.c */
+	extern void *tconv_out; /* misc.c */
+
 	jabber_private_t *j = s->priv;
 
 	const char *passwd2 = NULL;			/* if set than jabber_digest() should be done on it. else plaintext_passwd 
 							   Variable to keep password from @a password, or generated hash of password with magic constant [tlen] */
 
-	char *resource = jabber_escape(j->resource);	/* escaped resource name */
+	char *resource = tlenjabber_escape(j->resource);/* escaped resource name */
 	char *epasswd = NULL;				/* temporary password [escaped, or hash], if needed for xfree() */
 	char *authpass;					/* <digest>digest</digest> or <password>plaintext_password</password> */
 
@@ -157,7 +160,7 @@
 
 
 	authpass = (passwd2) ?
-		saprintf("<digest>%s</digest>", jabber_digest(stream_id, passwd2)) :	/* hash */
+		saprintf("<digest>%s</digest>", jabber_digest(stream_id, passwd2, j->istlen ? tconv_out : jconv_out)) :	/* hash */
 		saprintf("<password>%s</password>", epasswd);				/* plaintext */
 		
 	watch_write(j->send_watch, 


Więcej informacji o liście dyskusyjnej ekg2-commit