Fri, 11 Dec 2020 04:12:45 -0600
Convert zephyr to gio
Remove `SO_BSDCOMPAT` which has been obsolete for 15+ years.
Remove unused `from` parameter in ZCheckAuthorization.
Make `zuid_addr` into its plain integral type, not `struct in_addr`.
Make `__HM_addr` into a `GSocketAddress`.
Use `GSocketAddress` for `Z_InputQ->from`.
Make `__My_addr` a `guint32` instead of `struct in_addr`.
Change `__Zephyr_port` into a `gint`.
Convert zephyr to `GSocket`.
Remove `hostaddr` argument to `ZhmStat`, as it's always `NULL`.
Use gio to determine self-address.
Use gio to print out bad packet information.
Cleanup remaining indents.
Testing Done:
compile only
Reviewed at https://reviews.imfreedom.org/r/261/
| 2086 | 1 | /* This file is part of the Project Athena Zephyr Notification System. |
| 2 | * It contains source for the ZCheckAuthentication function. | |
| 3 | * | |
| 4 | * Created by: Robert French | |
| 5 | * | |
| 6 | * Copyright (c) 1987,1991 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 | ||
|
8791
655f64e6d1e2
[gaim-migrate @ 9553]
Christian Hammond <chipx86@chipx86.com>
parents:
8354
diff
changeset
|
11 | #include "internal.h" |
| 2086 | 12 | |
| 13 | /* Check authentication of the notice. | |
| 14 | If it looks authentic but fails the Kerberos check, return -1. | |
| 15 | If it looks authentic and passes the Kerberos check, return 1. | |
| 16 | If it doesn't look authentic, return 0 | |
| 17 | ||
| 18 | When not using Kerberos, return true if the notice claims to be authentic. | |
| 19 | */ | |
|
40166
811f82db29dd
zephyr: Modernize K&R function prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31294
diff
changeset
|
20 | Code_t |
|
40643
1c9bdf8d3e85
Convert zephyr to gio
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40624
diff
changeset
|
21 | ZCheckAuthentication(ZNotice_t *notice) |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
15435
diff
changeset
|
22 | { |
| 2086 | 23 | #ifdef ZEPHYR_USES_KERBEROS |
| 24 | int result; | |
| 25 | ZChecksum_t our_checksum; | |
| 26 | CREDENTIALS cred; | |
| 27 | ||
| 28 | /* If the value is already known, return it. */ | |
| 29 | if (notice->z_checked_auth != ZAUTH_UNSET) | |
| 30 | return (notice->z_checked_auth); | |
| 31 | ||
| 32 | if (!notice->z_auth) | |
| 33 | return (ZAUTH_NO); | |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
15435
diff
changeset
|
34 | |
|
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
15435
diff
changeset
|
35 | if ((result = krb_get_cred(SERVER_SERVICE, SERVER_INSTANCE, |
| 2086 | 36 | __Zephyr_realm, &cred)) != 0) |
| 37 | return (ZAUTH_NO); | |
| 38 | ||
| 39 | #ifdef NOENCRYPTION | |
| 40 | our_checksum = 0; | |
| 41 | #else | |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
15435
diff
changeset
|
42 | our_checksum = des_quad_cksum(notice->z_packet, NULL, |
| 2086 | 43 | notice->z_default_format+ |
| 44 | strlen(notice->z_default_format)+1- | |
| 8354 | 45 | notice->z_packet, 0, (C_Block *)cred.session); |
| 2086 | 46 | #endif |
| 47 | /* if mismatched checksum, then the packet was corrupted */ | |
| 48 | return ((our_checksum == notice->z_checksum) ? ZAUTH_YES : ZAUTH_FAILED); | |
| 49 | ||
| 50 | #else | |
| 51 | return (notice->z_auth ? ZAUTH_YES : ZAUTH_NO); | |
| 52 | #endif | |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
15435
diff
changeset
|
53 | } |