cpw.ljfisher.ssl_client_auth: 21fbc941: Added certificate_id field to PurpleAcco...

lucas.fisher at gmail.com lucas.fisher at gmail.com
Sat Apr 16 19:35:55 EDT 2011


----------------------------------------------------------------------
Revision: 21fbc941e1237b596a47c6d8692907073ae5ea55
Parent:   20a0deb10ba361332544898d3f178f9cfd77518b
Author:   lucas.fisher at gmail.com
Date:     04/16/11 16:15:28
Branch:   im.pidgin.cpw.ljfisher.ssl_client_auth
URL: http://d.pidgin.im/viewmtn/revision/info/21fbc941e1237b596a47c6d8692907073ae5ea55

Changelog: 

Added certificate_id field to PurpleAccount and appropriate getters/setters for specifying the cert to use for client-side SSL/TLS auth.

Changes against parent 20a0deb10ba361332544898d3f178f9cfd77518b

  patched  libpurple/account.c
  patched  libpurple/account.h

-------------- next part --------------
============================================================
--- libpurple/account.c	444095e1f94ee7b6669e00a53beefdc7daf2eb16
+++ libpurple/account.c	72fcf4641395d400d22857465e7d3b6866b9a2fa
@@ -382,6 +382,12 @@ account_to_xmlnode(PurpleAccount *accoun
 		xmlnode_insert_data(child, tmp, -1);
 	}
 
+	if ((tmp = purple_account_get_certificate_id(account)) != NULL)
+	{
+		child = xmlnode_new_child(node, "certificateid");
+		xmlnode_insert_data(child, tmp, -1);
+	}
+
 	if ((tmp = purple_account_get_alias(account)) != NULL)
 	{
 		child = xmlnode_new_child(node, "alias");
@@ -884,6 +890,15 @@ parse_account(xmlnode *node)
 		g_free(data);
 	}
 
+	/* Read the certificate id */
+	child = xmlnode_get_child(node, "certificateid");
+	purple_debug_info("account", "crt id field from accounts.xml: %p\n", child);
+	if ((child != NULL) && ((data = xmlnode_get_data(child)) != NULL))
+	{
+		purple_account_set_certificate_id(ret, data);
+		g_free(data);
+	}
+
 	/* Read the alias */
 	child = xmlnode_get_child(node, "alias");
 	if ((child != NULL) && ((data = xmlnode_get_data(child)) != NULL))
@@ -1649,7 +1664,20 @@ purple_account_set_password(PurpleAccoun
 	schedule_accounts_save();
 }
 
+
 void
+purple_account_set_certificate_id(PurpleAccount *account, const char *id)
+{
+	purple_debug_info("account", "Set certificate_id = %s\n", id);
+	g_return_if_fail(account != NULL);
+
+	g_free(account->certificate_id);
+	account->certificate_id = g_strdup(id);
+
+	schedule_accounts_save();
+}
+
+void
 purple_account_set_alias(PurpleAccount *account, const char *alias)
 {
 	g_return_if_fail(account != NULL);
@@ -2162,6 +2190,14 @@ const char *
 }
 
 const char *
+purple_account_get_certificate_id(const PurpleAccount *account)
+{
+	g_return_val_if_fail(account != NULL, NULL);
+
+	return account->certificate_id;
+}
+
+const char *
 purple_account_get_alias(const PurpleAccount *account)
 {
 	g_return_val_if_fail(account != NULL, NULL);
============================================================
--- libpurple/account.h	0408092f37ba3b8a88d9f0643914f719cef34492
+++ libpurple/account.h	fdef986f309e02b3a8e599d97cacd581e659c4d6
@@ -129,6 +129,7 @@ struct _PurpleAccount
 	char *alias;                /**< How you appear to yourself.            */
 	char *password;             /**< The account password.                  */
 	char *user_info;            /**< User information.                      */
+	char *certificate_id;       /**< User certificate id.                   */
 
 	char *buddy_icon_path;      /**< The buddy icon's non-cached path.      */
 
@@ -353,6 +354,14 @@ void purple_account_set_password(PurpleA
 void purple_account_set_password(PurpleAccount *account, const char *password);
 
 /**
+ * Sets id of the certificate to use for authentication with this account.
+ *
+ * @param account The account.
+ * @param id The user's certificate id.
+ */
+void purple_account_set_certificate_id(PurpleAccount *account, const char* id);
+
+/**
  * Sets the account's alias.
  *
  * @param account The account.
@@ -655,6 +664,15 @@ const char *purple_account_get_password(
 const char *purple_account_get_password(const PurpleAccount *account);
 
 /**
+ * Returns the id of the certificate to use for client-side PKI authentcation.
+ *
+ * @param account The account.
+ *
+ * @return The certificate id.
+ */
+const char *purple_account_get_certificate_id(const PurpleAccount *account);
+
+/**
  * Returns the account's alias.
  *
  * @param account The account.


More information about the Commits mailing list