Mercurial > pidgin
comparison libpurple/cipher.c @ 17082:7ade887fd3f6
Replace strcasecmp() calls with glib equivalents.
author | Richard Laager <rlaager@wiktel.com> |
---|---|
date | Mon, 14 May 2007 23:35:50 +0000 |
parents | ba8de77ec9b8 |
children | 8a7238fb7905 103a37dd9398 |
comparison
equal
deleted
inserted
replaced
17081:f6dd1f7689ee | 17082:7ade887fd3f6 |
---|---|
1998 g_return_val_if_fail(nonce != NULL, NULL); | 1998 g_return_val_if_fail(nonce != NULL, NULL); |
1999 | 1999 |
2000 /* Check for a supported algorithm. */ | 2000 /* Check for a supported algorithm. */ |
2001 g_return_val_if_fail(algorithm == NULL || | 2001 g_return_val_if_fail(algorithm == NULL || |
2002 *algorithm == '\0' || | 2002 *algorithm == '\0' || |
2003 strcasecmp(algorithm, "MD5") || | 2003 g_ascii_strcasecmp(algorithm, "MD5") || |
2004 strcasecmp(algorithm, "MD5-sess"), NULL); | 2004 g_ascii_strcasecmp(algorithm, "MD5-sess"), NULL); |
2005 | 2005 |
2006 cipher = purple_ciphers_find_cipher("md5"); | 2006 cipher = purple_ciphers_find_cipher("md5"); |
2007 g_return_val_if_fail(cipher != NULL, NULL); | 2007 g_return_val_if_fail(cipher != NULL, NULL); |
2008 | 2008 |
2009 context = purple_cipher_context_new(cipher, NULL); | 2009 context = purple_cipher_context_new(cipher, NULL); |
2012 purple_cipher_context_append(context, (guchar *)":", 1); | 2012 purple_cipher_context_append(context, (guchar *)":", 1); |
2013 purple_cipher_context_append(context, (guchar *)realm, strlen(realm)); | 2013 purple_cipher_context_append(context, (guchar *)realm, strlen(realm)); |
2014 purple_cipher_context_append(context, (guchar *)":", 1); | 2014 purple_cipher_context_append(context, (guchar *)":", 1); |
2015 purple_cipher_context_append(context, (guchar *)password, strlen(password)); | 2015 purple_cipher_context_append(context, (guchar *)password, strlen(password)); |
2016 | 2016 |
2017 if (algorithm != NULL && !strcasecmp(algorithm, "MD5-sess")) | 2017 if (algorithm != NULL && !g_ascii_strcasecmp(algorithm, "MD5-sess")) |
2018 { | 2018 { |
2019 guchar digest[16]; | 2019 guchar digest[16]; |
2020 | 2020 |
2021 if (client_nonce == NULL) | 2021 if (client_nonce == NULL) |
2022 { | 2022 { |
2063 g_return_val_if_fail(session_key != NULL, NULL); | 2063 g_return_val_if_fail(session_key != NULL, NULL); |
2064 | 2064 |
2065 /* Check for a supported algorithm. */ | 2065 /* Check for a supported algorithm. */ |
2066 g_return_val_if_fail(algorithm == NULL || | 2066 g_return_val_if_fail(algorithm == NULL || |
2067 *algorithm == '\0' || | 2067 *algorithm == '\0' || |
2068 strcasecmp(algorithm, "MD5") || | 2068 g_ascii_strcasecmp(algorithm, "MD5") || |
2069 strcasecmp(algorithm, "MD5-sess"), NULL); | 2069 g_ascii_strcasecmp(algorithm, "MD5-sess"), NULL); |
2070 | 2070 |
2071 /* Check for a supported "quality of protection". */ | 2071 /* Check for a supported "quality of protection". */ |
2072 g_return_val_if_fail(qop == NULL || | 2072 g_return_val_if_fail(qop == NULL || |
2073 *qop == '\0' || | 2073 *qop == '\0' || |
2074 strcasecmp(qop, "auth") || | 2074 g_ascii_strcasecmp(qop, "auth") || |
2075 strcasecmp(qop, "auth-int"), NULL); | 2075 g_ascii_strcasecmp(qop, "auth-int"), NULL); |
2076 | 2076 |
2077 cipher = purple_ciphers_find_cipher("md5"); | 2077 cipher = purple_ciphers_find_cipher("md5"); |
2078 g_return_val_if_fail(cipher != NULL, NULL); | 2078 g_return_val_if_fail(cipher != NULL, NULL); |
2079 | 2079 |
2080 context = purple_cipher_context_new(cipher, NULL); | 2080 context = purple_cipher_context_new(cipher, NULL); |
2081 | 2081 |
2082 purple_cipher_context_append(context, (guchar *)method, strlen(method)); | 2082 purple_cipher_context_append(context, (guchar *)method, strlen(method)); |
2083 purple_cipher_context_append(context, (guchar *)":", 1); | 2083 purple_cipher_context_append(context, (guchar *)":", 1); |
2084 purple_cipher_context_append(context, (guchar *)digest_uri, strlen(digest_uri)); | 2084 purple_cipher_context_append(context, (guchar *)digest_uri, strlen(digest_uri)); |
2085 | 2085 |
2086 if (qop != NULL && !strcasecmp(qop, "auth-int")) | 2086 if (qop != NULL && !g_ascii_strcasecmp(qop, "auth-int")) |
2087 { | 2087 { |
2088 PurpleCipherContext *context2; | 2088 PurpleCipherContext *context2; |
2089 gchar entity_hash[33]; | 2089 gchar entity_hash[33]; |
2090 | 2090 |
2091 if (entity == NULL) | 2091 if (entity == NULL) |