[asterisk-commits] branch mogorman/asterisk-xmpp r24744 - /team/mogorman/asterisk-xmpp/res/

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Thu May 4 13:27:56 MST 2006


Author: mogorman
Date: Thu May  4 15:27:55 2006
New Revision: 24744

URL: http://svn.digium.com/view/asterisk?rev=24744&view=rev
Log:
ugh another library function that doesnt do what it should.....

Modified:
    team/mogorman/asterisk-xmpp/res/res_jabber.c

Modified: team/mogorman/asterisk-xmpp/res/res_jabber.c
URL: http://svn.digium.com/view/asterisk/team/mogorman/asterisk-xmpp/res/res_jabber.c?rev=24744&r1=24743&r2=24744&view=diff
==============================================================================
--- team/mogorman/asterisk-xmpp/res/res_jabber.c (original)
+++ team/mogorman/asterisk-xmpp/res/res_jabber.c Thu May  4 15:27:55 2006
@@ -197,6 +197,29 @@
 	return (1 << x);
 }
 
+iks * jabber_make_auth (iksid *id, const char *pass, const char *sid)
+{
+	iks *x, *y;
+	int i;
+	x = iks_new ("iq");
+	iks_insert_attrib (x, "type", "set");
+	y = iks_insert (x, "query");
+	iks_insert_attrib (y, "xmlns", IKS_NS_AUTH);
+	iks_insert_cdata (iks_insert (y, "username"), id->user, 0);
+	iks_insert_cdata (iks_insert (y, "resource"), id->resource, 0);
+	if(sid) {
+		char buf[41];
+		char sidpass[100];
+		snprintf(sidpass,sizeof(sidpass),"%s%s",sid,pass);
+		ast_sha1_hash(buf, sidpass);
+		ast_verbose("\n");
+		iks_insert_cdata (iks_insert (y, "digest"), buf, 0);
+	} else {
+		iks_insert_cdata (iks_insert (y, "password"), pass, 0);
+	}
+	return x;
+}
+
 /*!
  * \brief Dial plan function status(). puts the status of watched user 
    into a channel variable.
@@ -344,7 +367,7 @@
 	struct aji_client *client;
 	ikspak *pak = NULL;
 	iks *auth = NULL;
-	
+
 	pak = iks_packet(node);
 	
 	client = (struct aji_client *) udata;
@@ -361,10 +384,10 @@
 				}
 				if(!client->usesasl) {
 					iks_filter_add_rule (client->f, aji_client_connect, client, IKS_RULE_TYPE, IKS_PAK_IQ, IKS_RULE_SUBTYPE, IKS_TYPE_RESULT,IKS_RULE_ID,client->mid, IKS_RULE_DONE);
-	
-					auth = iks_make_auth(client->jid,client->password,iks_find_attrib(node,"id"));
+					auth = jabber_make_auth(client->jid,client->password,iks_find_attrib(node,"id"));
 					if(auth) {
 						iks_insert_attrib(auth,"id",client->mid);
+						iks_insert_attrib(auth,"to",client->server);
 						ast_aji_increment_mid(client->mid);
 						iks_send(client->p,auth);
 						iks_delete(auth);
@@ -1475,7 +1498,7 @@
 			client->jid =(iks_find_cdata(pak->query,"jid"))?iks_id_new(client->stack,iks_find_cdata(pak->query,"jid")):client->jid;
 			iks_filter_remove_hook(client->f,aji_client_connect);
 		}
-	
+
 		if(client->state == AJI_CONNECTING) {
 			iks_filter_add_rule(client->f, aji_filter_roster, client, IKS_RULE_TYPE, IKS_PAK_IQ, IKS_RULE_SUBTYPE, IKS_TYPE_RESULT, IKS_RULE_ID, "roster", IKS_RULE_DONE);
 			client->state=AJI_CONNECTED;



More information about the asterisk-commits mailing list