Mon, 22 Aug 2022 21:40:04 -0500
Inline pidgin_make_scrollable
We need to change it for GTK4, and there are few enough that it can be inlined. Eventually, that code might be a `.ui` anyway.
Testing Done:
Compile only.
Reviewed at https://reviews.imfreedom.org/r/1615/
| 2086 | 1 | /* This file is part of the Project Athena Zephyr Notification System. |
| 2 | * It contains source for the ZMakeAuthentication function. | |
| 3 | * | |
| 4 | * Created by: Robert French | |
| 5 | * | |
| 6 | * Copyright (c) 1987 by the Massachusetts Institute of Technology. | |
| 7 | * For copying and distribution information, see the file | |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
15435
diff
changeset
|
8 | * "mit-copyright.h". |
| 2086 | 9 | */ |
| 10 | ||
|
8792
b0645c9dc276
[gaim-migrate @ 9554]
Christian Hammond <chipx86@chipx86.com>
parents:
8354
diff
changeset
|
11 | #include "internal.h" |
| 2086 | 12 | |
| 10867 | 13 | #ifndef ERROR_TABLE_BASE_krb |
| 14 | #define ERROR_TABLE_BASE_krb (39525376L) | |
| 2086 | 15 | #endif |
| 16 | ||
| 17 | #ifdef ZEPHYR_USES_KERBEROS | |
| 10867 | 18 | #ifdef WIN32 |
| 19 | ||
| 20 | #else | |
| 2086 | 21 | #include <krb_err.h> |
| 10867 | 22 | #endif |
| 2086 | 23 | static long last_authent_time = 0L; |
| 24 | static KTEXT_ST last_authent; | |
| 25 | #endif | |
| 26 | ||
|
40166
811f82db29dd
zephyr: Modernize K&R function prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38854
diff
changeset
|
27 | Code_t |
|
811f82db29dd
zephyr: Modernize K&R function prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38854
diff
changeset
|
28 | ZMakeAuthentication(register ZNotice_t *notice, char *buffer, int buffer_len, |
|
811f82db29dd
zephyr: Modernize K&R function prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38854
diff
changeset
|
29 | int *len) |
| 2086 | 30 | { |
| 31 | #ifdef ZEPHYR_USES_KERBEROS | |
| 32 | int result; | |
| 33 | time_t now; | |
| 34 | KTEXT_ST authent; | |
| 35 | char *cstart, *cend; | |
| 36 | ZChecksum_t checksum; | |
| 37 | CREDENTIALS cred; | |
| 38 | extern unsigned long des_quad_cksum(); | |
| 39 | ||
| 40 | now = time(0); | |
| 41 | if (last_authent_time == 0 || (now - last_authent_time > 120)) { | |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
15435
diff
changeset
|
42 | result = krb_mk_req(&authent, SERVER_SERVICE, |
| 2086 | 43 | SERVER_INSTANCE, __Zephyr_realm, 0); |
| 44 | if (result != MK_AP_OK) { | |
| 45 | last_authent_time = 0; | |
| 8217 | 46 | return (result+ERROR_TABLE_BASE_krb); |
| 2086 | 47 | } |
| 48 | last_authent_time = now; | |
| 49 | last_authent = authent; | |
| 50 | } | |
| 51 | else { | |
| 52 | authent = last_authent; | |
| 53 | } | |
| 54 | notice->z_auth = 1; | |
| 55 | notice->z_authent_len = authent.length; | |
| 56 | notice->z_ascii_authent = (char *)malloc((unsigned)authent.length*3); | |
| 57 | /* zero length authent is an error, so malloc(0) is not a problem */ | |
| 58 | if (!notice->z_ascii_authent) | |
| 59 | return (ENOMEM); | |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
15435
diff
changeset
|
60 | if ((result = ZMakeAscii(notice->z_ascii_authent, |
|
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
15435
diff
changeset
|
61 | authent.length*3, |
|
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
15435
diff
changeset
|
62 | authent.dat, |
| 2086 | 63 | authent.length)) != ZERR_NONE) { |
| 64 | free(notice->z_ascii_authent); | |
| 65 | return (result); | |
| 66 | } | |
| 67 | result = Z_FormatRawHeader(notice, buffer, buffer_len, len, &cstart, | |
| 68 | &cend); | |
| 69 | free(notice->z_ascii_authent); | |
| 70 | notice->z_authent_len = 0; | |
| 71 | if (result) | |
| 72 | return(result); | |
| 73 | ||
| 74 | /* Compute a checksum over the header and message. */ | |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
15435
diff
changeset
|
75 | if ((result = krb_get_cred(SERVER_SERVICE, SERVER_INSTANCE, |
| 2086 | 76 | __Zephyr_realm, &cred)) != 0) |
| 77 | return result; | |
| 8354 | 78 | checksum = des_quad_cksum(buffer, NULL, cstart - buffer, 0, (C_Block *)cred.session); |
| 2086 | 79 | checksum ^= des_quad_cksum(cend, NULL, buffer + *len - cend, 0, |
| 8354 | 80 | (C_Block *)cred.session); |
| 2086 | 81 | checksum ^= des_quad_cksum(notice->z_message, NULL, notice->z_message_len, |
| 8354 | 82 | 0, (C_Block *)cred.session); |
| 2086 | 83 | notice->z_checksum = checksum; |
| 84 | ZMakeAscii32(cstart, buffer + buffer_len - cstart, checksum); | |
| 85 | ||
| 86 | return (ZERR_NONE); | |
| 87 | #else | |
| 88 | notice->z_checksum = 0; | |
| 89 | notice->z_auth = 1; | |
| 90 | notice->z_authent_len = 0; | |
| 91 | notice->z_ascii_authent = ""; | |
| 92 | return (Z_FormatRawHeader(notice, buffer, buffer_len, len, NULL, NULL)); | |
| 93 | #endif | |
| 94 | } |