Skip to content

Commit

Permalink
Import 2.7.10.
Browse files Browse the repository at this point in the history
  • Loading branch information
felipec committed Oct 13, 2012
1 parent bd5dd5a commit a31c55c
Show file tree
Hide file tree
Showing 258 changed files with 2,766 additions and 1,983 deletions.
36 changes: 19 additions & 17 deletions certificate.c
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ purple_certificate_check_signature_chain_with_failing(GList *chain,
uid = purple_certificate_get_unique_id(issuer);

ret = purple_certificate_get_times(issuer, &activation, &expiration);
if (!ret || now < activation || now > expiration) {
if (!ret || now < activation || now > expiration) {
if (!ret)
purple_debug_error("certificate",
"...Failed to get validity times for certificate %s\n"
Expand Down Expand Up @@ -413,7 +413,7 @@ byte_arrays_equal(const GByteArray *array1, const GByteArray *array2)
return (array1->len == array2->len) &&
(0 == memcmp(array1->data, array2->data, array1->len));
}

GByteArray *
purple_certificate_get_fingerprint_sha1(PurpleCertificate *crt)
{
Expand Down Expand Up @@ -1602,7 +1602,7 @@ x509_tls_cached_unknown_peer(PurpleCertificateVerificationRequest *vrq,
GSList *ca_crts, *cur;
GByteArray *last_fpr, *ca_fpr;
gboolean valid = FALSE;
gchar *ca_id;
gchar *ca_id, *ca2_id;

peer_crt = (PurpleCertificate *) chain->data;

Expand All @@ -1619,7 +1619,6 @@ x509_tls_cached_unknown_peer(PurpleCertificateVerificationRequest *vrq,
return;
} /* if (self signed) */

/* Next, attempt to verify the last certificate against a CA */
ca = purple_certificate_find_pool(x509_tls_cached.scheme_name, "ca");

/* Next, check that the certificate chain is valid */
Expand Down Expand Up @@ -1669,6 +1668,9 @@ x509_tls_cached_unknown_peer(PurpleCertificateVerificationRequest *vrq,
return;
} /* if (signature chain not good) */

/* Next, attempt to verify the last certificate is signed by a trusted
* CA, or is a trusted CA (based on fingerprint).
*/
/* If, for whatever reason, there is no Certificate Authority pool
loaded, we'll verify the subject name and then warn about thsi. */
if ( !ca ) {
Expand All @@ -1684,27 +1686,31 @@ x509_tls_cached_unknown_peer(PurpleCertificateVerificationRequest *vrq,

end_crt = g_list_last(chain)->data;

/* Attempt to look up the last certificate's issuer */
ca_id = purple_certificate_get_issuer_unique_id(end_crt);
/* Attempt to look up the last certificate, and the last certificate's
* issuer.
*/
ca_id = purple_certificate_get_issuer_unique_id(end_crt);
ca2_id = purple_certificate_get_unique_id(end_crt);
purple_debug_info("certificate/x509/tls_cached",
"Checking for a CA with DN=%s\n",
ca_id);
ca_crts = x509_ca_get_certs(ca_id);
purple_debug_info("certificate/x509/tls_cached",
"Also checking for a CA with DN=%s\n",
ca2_id);
ca_crts = g_slist_concat(x509_ca_get_certs(ca_id), x509_ca_get_certs(ca2_id));
g_free(ca_id);
g_free(ca2_id);
if ( NULL == ca_crts ) {
flags |= PURPLE_CERTIFICATE_CA_UNKNOWN;

purple_debug_warning("certificate/x509/tls_cached",
"Certificate Authority with DN='%s' not "
"found. I'll prompt the user, I guess.\n",
ca_id);
g_free(ca_id);
"No Certificate Authorities with either DN found "
"found. I'll prompt the user, I guess.\n");

x509_tls_cached_check_subject_name(vrq, flags);
return;
}

g_free(ca_id);

/*
* Check the fingerprints; if they match, then this certificate *is* one
* of the designated "trusted roots", and we don't need to verify the
Expand All @@ -1714,10 +1720,6 @@ x509_tls_cached_unknown_peer(PurpleCertificateVerificationRequest *vrq,
*
* If the fingerprints don't match, we'll fall back to checking the
* signature.
*
* GnuTLS doesn't seem to include the final root in the verification
* list, so this check will never succeed. NSS *does* include it in
* the list, so here we are.
*/
last_fpr = purple_certificate_get_fingerprint_sha1(end_crt);
for (cur = ca_crts; cur; cur = cur->next) {
Expand Down
12 changes: 6 additions & 6 deletions cipher.c
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ md5_uninit(PurpleCipherContext *context) {
purple_cipher_context_reset(context, NULL);

md5_context = purple_cipher_context_get_data(context);
memset(md5_context, 0, sizeof(md5_context));
memset(md5_context, 0, sizeof(*md5_context));

g_free(md5_context);
md5_context = NULL;
Expand Down Expand Up @@ -705,7 +705,7 @@ md4_uninit(PurpleCipherContext *context) {
purple_cipher_context_reset(context, NULL);

md4_context = purple_cipher_context_get_data(context);
memset(md4_context, 0, sizeof(md4_context));
memset(md4_context, 0, sizeof(*md4_context));

g_free(md4_context);
md4_context = NULL;
Expand Down Expand Up @@ -1356,7 +1356,7 @@ des_uninit(PurpleCipherContext *context) {
struct _des_ctx *des_context;

des_context = purple_cipher_context_get_data(context);
memset(des_context, 0, sizeof(des_context));
memset(des_context, 0, sizeof(*des_context));

g_free(des_context);
des_context = NULL;
Expand Down Expand Up @@ -1706,7 +1706,7 @@ des3_uninit(PurpleCipherContext *context)
struct _des3_ctx *des3_context;

des3_context = purple_cipher_context_get_data(context);
memset(des3_context, 0, sizeof(des3_context));
memset(des3_context, 0, sizeof(*des3_context));

g_free(des3_context);
des3_context = NULL;
Expand Down Expand Up @@ -2382,7 +2382,7 @@ rc4_uninit(PurpleCipherContext *context) {
struct RC4Context *rc4_ctx;

rc4_ctx = purple_cipher_context_get_data(context);
memset(rc4_ctx, 0, sizeof(rc4_ctx));
memset(rc4_ctx, 0, sizeof(*rc4_ctx));

g_free(rc4_ctx);
rc4_ctx = NULL;
Expand Down Expand Up @@ -2828,7 +2828,7 @@ purple_cipher_context_destroy(PurpleCipherContext *context) {
if(cipher->ops && cipher->ops->uninit)
cipher->ops->uninit(context);

memset(context, 0, sizeof(context));
memset(context, 0, sizeof(*context));
g_free(context);
context = NULL;
}
Expand Down
16 changes: 7 additions & 9 deletions conversation.c
Original file line number Diff line number Diff line change
Expand Up @@ -999,12 +999,6 @@ purple_conversation_write(PurpleConversation *conv, const char *who,
}
}

if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM) {
if ((flags & PURPLE_MESSAGE_RECV) == PURPLE_MESSAGE_RECV) {
purple_conv_im_set_typing_state(PURPLE_CONV_IM(conv), PURPLE_NOT_TYPING);
}
}

if (ops && ops->write_conv)
ops->write_conv(conv, who, alias, displayed, flags, mtime);

Expand Down Expand Up @@ -1229,6 +1223,10 @@ purple_conv_im_write(PurpleConvIm *im, const char *who, const char *message,
c->ui_ops->write_im(c, who, message, flags, mtime);
else
purple_conversation_write(c, who, message, flags, mtime);

if ((flags & PURPLE_MESSAGE_RECV) == PURPLE_MESSAGE_RECV) {
purple_conv_im_set_typing_state(im, PURPLE_NOT_TYPING);
}
}

gboolean purple_conv_present_error(const char *who, PurpleAccount *account, const char *what)
Expand Down Expand Up @@ -2298,7 +2296,7 @@ purple_conversations_init(void)
purple_value_new(PURPLE_TYPE_SUBTYPE,
PURPLE_SUBTYPE_CONVERSATION),
purple_value_new(PURPLE_TYPE_UINT));

purple_signal_register(handle, "sent-attention",
purple_marshal_VOID__POINTER_POINTER_POINTER_UINT,
NULL, 4,
Expand All @@ -2308,7 +2306,7 @@ purple_conversations_init(void)
purple_value_new(PURPLE_TYPE_SUBTYPE,
PURPLE_SUBTYPE_CONVERSATION),
purple_value_new(PURPLE_TYPE_UINT));

purple_signal_register(handle, "got-attention",
purple_marshal_VOID__POINTER_POINTER_POINTER_UINT,
NULL, 4,
Expand All @@ -2318,7 +2316,7 @@ purple_conversations_init(void)
purple_value_new(PURPLE_TYPE_SUBTYPE,
PURPLE_SUBTYPE_CONVERSATION),
purple_value_new(PURPLE_TYPE_UINT));

purple_signal_register(handle, "sending-im-msg",
purple_marshal_VOID__POINTER_POINTER_POINTER,
NULL, 3,
Expand Down
2 changes: 1 addition & 1 deletion core.h
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ gboolean purple_core_ensure_single_instance(void);
* <dd>the type of UI. Possible values include 'pc', 'console', 'phone',
* 'handheld', 'web', and 'bot'. These values are compared
* programmatically and should not be localized.</dd>
*
*
* </dl>
*
* @return A GHashTable with strings for keys and values. This
Expand Down
2 changes: 1 addition & 1 deletion dbus-analyze-functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import sys

# types translated into "int"
simpletypes = ["int", "gint", "guint", "gboolean", "gpointer", "size_t", "gssize", "time_t"]
simpletypes = ["int", "gint", "guint", "gboolean", "size_t", "gssize", "time_t"]

# List "excluded" contains functions that shouldn't be exported via
# DBus. If you remove a function from this list, please make sure
Expand Down
6 changes: 3 additions & 3 deletions dbus-analyze-signals.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
continue

signal = nameregex.sub(lambda x:x.group()[1].upper(), '-'+signal)
print "\"<signal name='%s'>\\n\""%signal
print "\" <signal name='%s'>\\n\""%signal

args = marshal.split('_')
# ['purple', 'marshal', <return type>, '', args...]
Expand All @@ -52,9 +52,9 @@
type = 't'
elif arg == "BOOLEAN":
type = 'b'
print "\"<arg type='%s'/>\\n\""%type
print "\" <arg type='%s'/>\\n\""%type

print "\"</signal>\\n\""
print "\" </signal>\\n\""

print ";"

18 changes: 9 additions & 9 deletions dbus-server.c
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,9 @@ static DBusMessage *purple_dbus_introspect(DBusMessage *message)

g_string_append(str, "<!DOCTYPE node PUBLIC '-//freedesktop//DTD D-BUS Object Introspection 1.0//EN' 'http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd'>\n");
g_string_append_printf(str, "<node name='%s'>\n", DBUS_PATH_PURPLE);
g_string_append_printf(str, "<interface name='%s'>\n", DBUS_INTERFACE_PURPLE);
g_string_append(str, " <interface name='org.freedesktop.DBus.Introspectable'>\n <method name='Introspect'>\n <arg name='data' direction='out' type='s'/>\n </method>\n </interface>\n\n");

g_string_append_printf(str, " <interface name='%s'>\n", DBUS_INTERFACE_PURPLE);

bindings_list = NULL;
purple_signal_emit(purple_dbus_get_handle(), "dbus-introspect", &bindings_list);
Expand All @@ -517,7 +519,7 @@ static DBusMessage *purple_dbus_introspect(DBusMessage *message)
{
const char *text;

g_string_append_printf(str, "<method name='%s'>\n", bindings[i].name);
g_string_append_printf(str, " <method name='%s'>\n", bindings[i].name);

text = bindings[i].parameters;
while (*text)
Expand All @@ -529,10 +531,10 @@ static DBusMessage *purple_dbus_introspect(DBusMessage *message)
name = dbus_gettext(&text);

g_string_append_printf(str,
"<arg name='%s' type='%s' direction='%s'/>\n",
" <arg name='%s' type='%s' direction='%s'/>\n",
name, type, direction);
}
g_string_append(str, "</method>\n");
g_string_append(str, " </method>\n");
}
}

Expand All @@ -549,7 +551,7 @@ static DBusMessage *purple_dbus_introspect(DBusMessage *message)
}
g_string_append(str, signals);

g_string_append(str, "</interface>\n</node>\n");
g_string_append(str, " </interface>\n</node>\n");

reply = dbus_message_new_method_return(message);
dbus_message_append_args(reply, DBUS_TYPE_STRING, &(str->str),
Expand All @@ -568,10 +570,8 @@ purple_dbus_dispatch(DBusConnection *connection,
"dbus-method-called", connection, message))
return DBUS_HANDLER_RESULT_HANDLED;

if (dbus_message_get_type(message) == DBUS_MESSAGE_TYPE_METHOD_CALL &&
dbus_message_has_path(message, DBUS_PATH_PURPLE) &&
dbus_message_has_interface(message, DBUS_INTERFACE_INTROSPECTABLE) &&
dbus_message_has_member(message, "Introspect"))
if (dbus_message_is_method_call(message, DBUS_INTERFACE_INTROSPECTABLE, "Introspect") &&
dbus_message_has_path(message, DBUS_PATH_PURPLE))
{
DBusMessage *reply;
reply = purple_dbus_introspect(message);
Expand Down
6 changes: 3 additions & 3 deletions example/nullclient.c
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ static guint glib_input_add(gint fd, PurpleInputCondition condition, PurpleInput
return closure->result;
}

static PurpleEventLoopUiOps glib_eventloops =
static PurpleEventLoopUiOps glib_eventloops =
{
g_timeout_add,
g_source_remove,
Expand Down Expand Up @@ -134,7 +134,7 @@ null_write_conv(PurpleConversation *conv, const char *who, const char *alias,
name, message);
}

static PurpleConversationUiOps null_conv_uiops =
static PurpleConversationUiOps null_conv_uiops =
{
NULL, /* create_conversation */
NULL, /* destroy_conversation */
Expand Down Expand Up @@ -167,7 +167,7 @@ null_ui_init(void)
purple_conversations_set_ui_ops(&null_conv_uiops);
}

static PurpleCoreUiOps null_core_uiops =
static PurpleCoreUiOps null_core_uiops =
{
NULL,
NULL,
Expand Down
10 changes: 5 additions & 5 deletions ft.c
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ purple_xfer_set_status(PurpleXfer *xfer, PurpleXferStatusType status)
}
}

static void
static void
purple_xfer_conversation_write_internal(PurpleXfer *xfer,
const char *message, gboolean is_error, gboolean print_thumbnail)
{
Expand Down Expand Up @@ -302,12 +302,12 @@ purple_xfer_conversation_write_internal(PurpleXfer *xfer,

if (print_thumbnail && thumbnail_data) {
gchar *message_with_img;
gpointer data = g_memdup(thumbnail_data, size);
gpointer data = g_memdup(thumbnail_data, size);
int id = purple_imgstore_add_with_id(data, size, NULL);

message_with_img =
message_with_img =
g_strdup_printf("<img id='%d'> %s", id, escaped);
purple_conversation_write(conv, NULL, message_with_img, flags,
purple_conversation_write(conv, NULL, message_with_img, flags,
time(NULL));
purple_imgstore_unref_by_id(id);
g_free(message_with_img);
Expand Down Expand Up @@ -530,7 +530,7 @@ purple_xfer_ask_recv(PurpleXfer *xfer)
xfer, G_CALLBACK(purple_xfer_choose_file),
G_CALLBACK(cancel_recv_cb));
}

g_free(buf);
} else
purple_xfer_choose_file(xfer);
Expand Down
4 changes: 2 additions & 2 deletions ft.h
Original file line number Diff line number Diff line change
Expand Up @@ -712,8 +712,8 @@ gconstpointer purple_xfer_get_thumbnail(const PurpleXfer *xfer, gsize *len);
* @since 2.7.0
*/
const gchar *purple_xfer_get_thumbnail_mimetype(const PurpleXfer *xfer);


/**
* Sets the thumbnail data for a transfer
*
Expand Down
Loading

0 comments on commit a31c55c

Please sign in to comment.