Mercurial > pidgin
comparison libpurple/protocols/zephyr/ZMkAuth.c @ 31086:a8cc50c2279f
Remove trailing whitespace
author | Richard Laager <rlaager@wiktel.com> |
---|---|
date | Tue, 04 Jan 2011 06:55:30 +0000 |
parents | 5fe8042783c1 |
children |
comparison
equal
deleted
inserted
replaced
31085:44f53d3fc54f | 31086:a8cc50c2279f |
---|---|
3 * | 3 * |
4 * Created by: Robert French | 4 * Created by: Robert French |
5 * | 5 * |
6 * Copyright (c) 1987 by the Massachusetts Institute of Technology. | 6 * Copyright (c) 1987 by the Massachusetts Institute of Technology. |
7 * For copying and distribution information, see the file | 7 * For copying and distribution information, see the file |
8 * "mit-copyright.h". | 8 * "mit-copyright.h". |
9 */ | 9 */ |
10 | 10 |
11 #include "internal.h" | 11 #include "internal.h" |
12 | 12 |
13 #ifndef ERROR_TABLE_BASE_krb | 13 #ifndef ERROR_TABLE_BASE_krb |
48 CREDENTIALS cred; | 48 CREDENTIALS cred; |
49 extern unsigned long des_quad_cksum(); | 49 extern unsigned long des_quad_cksum(); |
50 | 50 |
51 now = time(0); | 51 now = time(0); |
52 if (last_authent_time == 0 || (now - last_authent_time > 120)) { | 52 if (last_authent_time == 0 || (now - last_authent_time > 120)) { |
53 result = krb_mk_req(&authent, SERVER_SERVICE, | 53 result = krb_mk_req(&authent, SERVER_SERVICE, |
54 SERVER_INSTANCE, __Zephyr_realm, 0); | 54 SERVER_INSTANCE, __Zephyr_realm, 0); |
55 if (result != MK_AP_OK) { | 55 if (result != MK_AP_OK) { |
56 last_authent_time = 0; | 56 last_authent_time = 0; |
57 return (result+ERROR_TABLE_BASE_krb); | 57 return (result+ERROR_TABLE_BASE_krb); |
58 } | 58 } |
66 notice->z_authent_len = authent.length; | 66 notice->z_authent_len = authent.length; |
67 notice->z_ascii_authent = (char *)malloc((unsigned)authent.length*3); | 67 notice->z_ascii_authent = (char *)malloc((unsigned)authent.length*3); |
68 /* zero length authent is an error, so malloc(0) is not a problem */ | 68 /* zero length authent is an error, so malloc(0) is not a problem */ |
69 if (!notice->z_ascii_authent) | 69 if (!notice->z_ascii_authent) |
70 return (ENOMEM); | 70 return (ENOMEM); |
71 if ((result = ZMakeAscii(notice->z_ascii_authent, | 71 if ((result = ZMakeAscii(notice->z_ascii_authent, |
72 authent.length*3, | 72 authent.length*3, |
73 authent.dat, | 73 authent.dat, |
74 authent.length)) != ZERR_NONE) { | 74 authent.length)) != ZERR_NONE) { |
75 free(notice->z_ascii_authent); | 75 free(notice->z_ascii_authent); |
76 return (result); | 76 return (result); |
77 } | 77 } |
78 result = Z_FormatRawHeader(notice, buffer, buffer_len, len, &cstart, | 78 result = Z_FormatRawHeader(notice, buffer, buffer_len, len, &cstart, |
81 notice->z_authent_len = 0; | 81 notice->z_authent_len = 0; |
82 if (result) | 82 if (result) |
83 return(result); | 83 return(result); |
84 | 84 |
85 /* Compute a checksum over the header and message. */ | 85 /* Compute a checksum over the header and message. */ |
86 if ((result = krb_get_cred(SERVER_SERVICE, SERVER_INSTANCE, | 86 if ((result = krb_get_cred(SERVER_SERVICE, SERVER_INSTANCE, |
87 __Zephyr_realm, &cred)) != 0) | 87 __Zephyr_realm, &cred)) != 0) |
88 return result; | 88 return result; |
89 checksum = des_quad_cksum(buffer, NULL, cstart - buffer, 0, (C_Block *)cred.session); | 89 checksum = des_quad_cksum(buffer, NULL, cstart - buffer, 0, (C_Block *)cred.session); |
90 checksum ^= des_quad_cksum(cend, NULL, buffer + *len - cend, 0, | 90 checksum ^= des_quad_cksum(cend, NULL, buffer + *len - cend, 0, |
91 (C_Block *)cred.session); | 91 (C_Block *)cred.session); |