Beispiel #1
0
gboolean Ssi_cb(gpointer sodata, PurpleSslConnection * gsc, gint con)
{
    gchar *head;
    struct fetion_account_data *sip;
    sip = sodata;
    purple_debug_info("Fetion:", "Ssi_cb\n");
    if (sip->mobileno != NULL) {
        head =
            g_strdup_printf
            ("GET /ssiportal/SSIAppSignIn.aspx?mobileno=%s&pwd=%s  HTTP/1.1\r\n"
             "User-Agent: IIC2.0/pc 3.3.0370\r\n" "Host: %s\r\n"
             "Connection: Keep-Alive\r\n\r\n", sip->mobileno,
             sip->password, sip->SsicServer);
    } else {
        head =
            g_strdup_printf
            ("GET /ssiportal/SSIAppSignIn.aspx?sid=%s&pwd=%s  HTTP/1.1\r\n"
             "User-Agent: IIC2.0/pc 3.3.0370\r\n" "Host: %s\r\n"
             "Connection: Keep-Alive\r\n\r\n", sip->username,
             sip->password, sip->SsicServer);
    }
    purple_ssl_write(gsc, head, strlen(head));

    purple_ssl_input_add(gsc, (PurpleSslInputFunction) read_cookie, sip);
    return TRUE;
}
Beispiel #2
0
gboolean Ssi_cb(gpointer sodata, PurpleSslConnection * gsc, gint con)
{
	gchar *head;
	struct fetion_account_data *sip;

	// Modified from codes of open-fetion
	char noUri[128];
	char verifyUri[256];
	char *password;
	int passwordType;
	
	sip = sodata;
	purple_debug_info("Fetion:", "Ssi_cb\n");
	/*purple_debug_info("Fetion:", "Initialize ssi authentication action\n");*/
	password = hash_password_v4(NULL , sip->password);
	/*password = hash_password_v4(sip->userId , sip->password);*/
	memset(noUri, 0, sizeof(noUri));
	if(sip->mobileno != NULL)
		sprintf(noUri , "mobileno=%s" , sip->mobileno);
	else
		sprintf(noUri , "sid=%s" , sip->username);
	memset(verifyUri, 0, sizeof(verifyUri));
	/*if(user->verification != NULL && user->verification->code != NULL)*/
	/*{*/
		/*sprintf(verifyUri , "&pid=%s&pic=%s&algorithm=%s"*/
						  /*, user->verification->guid*/
						  /*, user->verification->code*/
						  /*, user->verification->algorithm);*/
	/*}*/
	/*passwordType = (strlen(sip->userId) == 0 ? 1 : 2);*/
	passwordType = 1;

	head = g_strdup_printf( "GET /ssiportal/SSIAppSignInV4.aspx?%s"
				    "&domains=fetion.com.cn%s&v4digest-type=%d&v4digest=%s\r\n"
				    "User-Agent: IIC2.0/pc "PROTO_VERSION"\r\n"
					"Host: %s\r\n"
				    "Cache-Control: private\r\n"
				    "Connection: Keep-Alive\r\n\r\n",
				    noUri , verifyUri , passwordType , password , "uid.fetion.com.cn");

	/*if (sip->mobileno != NULL) {*/
		/*head =*/
			/*g_strdup_printf*/
			/*("GET /ssiportal/SSIAppSignIn.aspx?mobileno=%s&pwd=%s  HTTP/1.1\r\n"*/
			 /*"User-Agent: IIC2.0/pc 3.3.0370\r\n" "Host: %s\r\n"*/
			 /*"Connection: Keep-Alive\r\n\r\n", sip->mobileno,*/
			 /*sip->password, sip->SsicServer);*/
	/*} else {*/
		/*head =*/
			/*g_strdup_printf*/
			/*("GET /ssiportal/SSIAppSignIn.aspx?sid=%s&pwd=%s  HTTP/1.1\r\n"*/
			 /*"User-Agent: IIC2.0/pc 3.3.0370\r\n" "Host: %s\r\n"*/
			 /*"Connection: Keep-Alive\r\n\r\n", sip->username,*/
			 /*sip->password, sip->SsicServer);*/
	/*}*/
	purple_ssl_write(gsc, head, strlen(head));

	purple_ssl_input_add(gsc, (PurpleSslInputFunction) read_cookie, sip);
	return TRUE;
}
Beispiel #3
0
static void
ssl_connection_established_cb(gpointer data, PurpleSslConnection *psc,
                              PurpleInputCondition cond)
{
	PurpleHTTPConnection *conn = data;

	purple_ssl_input_add(psc, http_connection_read_cb_ssl, conn);
	connection_common_established_cb(conn);
}
Beispiel #4
0
static void irc_login_cb_ssl(gpointer data, PurpleSslConnection *gsc,
	PurpleInputCondition cond)
{
	PurpleConnection *gc = data;

	if (do_login(gc)) {
		purple_ssl_input_add(gsc, irc_input_cb_ssl, gc);
	}
}
static void om_post_or_get_ssl_connect_cb(gpointer data,
		PurpleSslConnection *ssl, PurpleInputCondition cond)
{
	OmegleConnection *omconn;
	ssize_t len;

	omconn = data;

	purple_debug_info("omegle", "post_or_get_ssl_connect_cb\n");

	/* TODO: Check the return value of write() */
	len = purple_ssl_write(omconn->ssl_conn,
			omconn->request->str, omconn->request->len);
	purple_ssl_input_add(omconn->ssl_conn,
			om_post_or_get_ssl_readdata_cb, omconn);
}
static void sevencup_post_or_get_ssl_connect_cb(gpointer data,
		PurpleSslConnection *ssl, PurpleInputCondition cond)
{
	SevenCupConnection *scon;
	gssize len;

	scon = data;

	purple_debug_info("7cups", "post_or_get_ssl_connect_cb\n");

	/* TODO: Check the return value of write() */
	len = purple_ssl_write(scon->ssl_conn,
			scon->request->str, scon->request->len);
	purple_ssl_input_add(scon->ssl_conn,
			sevencup_post_or_get_ssl_readdata_cb, scon);
}
static void skypeweb_post_or_get_ssl_connect_cb(gpointer data,
		PurpleSslConnection *ssl, PurpleInputCondition cond)
{
	SkypeWebConnection *skypewebcon;
	gssize len;

	skypewebcon = data;

	purple_debug_info("skypeweb", "post_or_get_ssl_connect_cb\n");

	/* TODO: Check the return value of write() */
	len = purple_ssl_write(skypewebcon->ssl_conn,
			skypewebcon->request->str, skypewebcon->request->len);
	purple_ssl_input_add(skypewebcon->ssl_conn,
			skypeweb_post_or_get_ssl_readdata_cb, skypewebcon);
}
Beispiel #8
0
static void fb_post_or_get_ssl_connect_cb(gpointer data,
		PurpleSslConnection *ssl, PurpleInputCondition cond)
{
	FacebookConnection *fbconn;
	ssize_t len;

	fbconn = data;

	purple_debug_info("facebook", "post_or_get_ssl_connect_cb\n");

	/* TODO: Check the return value of write() */
	len = purple_ssl_write(fbconn->ssl_conn,
			fbconn->request->str, fbconn->request->len);
	purple_ssl_input_add(fbconn->ssl_conn,
			fb_post_or_get_ssl_readdata_cb, fbconn);
}
static void
pb_socket_connected(gpointer userdata, PurpleSslConnection *conn, PurpleInputCondition cond)
{
	PushBulletAccount *pba = userdata;
	gchar *websocket_header;
	const gchar *websocket_key = "15XF+ptKDhYVERXoGcdHTA=="; //TODO don't be lazy
	
	purple_ssl_input_add(pba->websocket, pb_socket_got_data, pba);
	
	websocket_header = g_strdup_printf("GET /subscribe/%s HTTP/1.1\r\n"
							"Host: stream.pushbullet.com\r\n"
							"Connection: Upgrade\r\n"
							"Pragma: no-cache\r\n"
							"Cache-Control: no-cache\r\n"
							"Upgrade: websocket\r\n"
							"Sec-WebSocket-Version: 13\r\n"
							"Sec-WebSocket-Key: %s\r\n"
							//"Sec-WebSocket-Extensions: permessage-deflate; client_max_window_bits\r\n"
							"\r\n", pba->access_token, websocket_key);
	
	purple_ssl_write(pba->websocket, websocket_header, strlen(websocket_header));
	
	g_free(websocket_header);
}
Beispiel #10
0
static void
campfire_ssl_connect(CampfireConn * campfire,
		     G_GNUC_UNUSED PurpleInputCondition cond,
		     gboolean from_connection_callback)
{
	GList *first = NULL;
	CampfireSslTransaction *xaction = NULL;

	purple_debug_info("campfire", "%s\n", __FUNCTION__);
	if (!campfire) {
		return;
	} else {
		first = g_list_first(campfire->queue);
	}

	if (!first) {
		return;
	} else {
		xaction = first->data;
	}

	if (!xaction) {
		return;
	}

	if (!campfire->gsc) {
		purple_debug_info("campfire", "new ssl connection\n");
		campfire->gsc = purple_ssl_connect(campfire->account,
						   campfire->hostname,
						   443, (PurpleSslInputFunction)
						   (campfire_ssl_connect_cb),
						   campfire_ssl_failure,
						   campfire);
		purple_debug_info("campfire",
				  "new ssl connection kicked off.\n");
	} else {
		purple_debug_info("campfire", "previous ssl connection\n");
		/* we want to write our http request to the ssl connection
		 * WHENEVER this is called from the callback (meaning we've
		 * JUST NOW established the connection). OR when the first
		 * transaction is added to the queue on an OPEN ssl connection
		 */
		if (from_connection_callback
		    || g_list_length(campfire->queue) == 1) {
			/* campfire_ssl_handler is the ONLY input handler we
			 * EVER use So... if there is already an input handler
			 * present (inpa > 0), then we DON"T want to add another
			 * input handler.  Quite a few hours spent chasing bugs
			 * when multiple input handlers were added!
			 */
			if (campfire->gsc->inpa == 0) {
				purple_debug_info("campfire", "adding input\n");
				purple_ssl_input_add(campfire->gsc,
						     (PurpleSslInputFunction)
						     (campfire_ssl_handler),
						     campfire);
			}
			purple_debug_info("campfire",
					  "writing first request on ssl connection\n");
			purple_ssl_write(campfire->gsc,
					 xaction->http_request->str,
					 xaction->http_request->len);
		}
	}
	return;
}