Fri, 21 May 2004 14:33:32 +0000
[gaim-migrate @ 9774]
" This patch renames the existing received-*-msg signals
to receiving-*msg to fit the naming of other signals
where a pointer to the message is passed (writing,
sending, displaying)
It adds new received-*-msg signals which are emitted
after the receiving signals, in line with the other
conversation signals (wrote, sent, displayed)
This is necessary to allow plugins which depend on the
final received message to work alongside plugins which
may modify the message.
One known example of this is festival-gaim alongside
gaim-encryption - festival-gaim would try to "speak"
the encrypted text:
http://sf.net/tracker/?func=detail&aid=943216&group_id=89763&atid=591320
I've tested this with gaim-encryption and festival-gaim
(locally modified so gaim-encryption uses the receiving
signal and festival uses the received signal)
All in-tree users of received-*-msg are updated to use
receiving-*-msg if they do modify the message, the
conversation-signals documentation is updated, the
signals-test.c & signal-test.tcl plugins are also updated." --Stu Tomlinson
committer: Luke Schierer <lschiere@pidgin.im>
| 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 | * $Source$ | |
|
8791
655f64e6d1e2
[gaim-migrate @ 9553]
Christian Hammond <chipx86@chipx86.com>
parents:
8354
diff
changeset
|
7 | * $Author: chipx86 $ |
| 2086 | 8 | * |
| 9 | * Copyright (c) 1987,1991 by the Massachusetts Institute of Technology. | |
| 10 | * For copying and distribution information, see the file | |
| 11 | * "mit-copyright.h". | |
| 12 | */ | |
| 13 | /* $Header$ */ | |
| 14 | ||
| 15 | #ifndef lint | |
| 16 | static char rcsid_ZCheckAuthentication_c[] = | |
| 17 | "$Zephyr: /mit/zephyr/src/lib/RCS/ZCheckAuthentication.c,v 1.14 89/03/24 14:17:38 jtkohl Exp Locker: raeburn $"; | |
| 18 | #endif | |
| 19 | ||
|
8791
655f64e6d1e2
[gaim-migrate @ 9553]
Christian Hammond <chipx86@chipx86.com>
parents:
8354
diff
changeset
|
20 | #include "internal.h" |
| 2086 | 21 | |
| 22 | /* Check authentication of the notice. | |
| 23 | If it looks authentic but fails the Kerberos check, return -1. | |
| 24 | If it looks authentic and passes the Kerberos check, return 1. | |
| 25 | If it doesn't look authentic, return 0 | |
| 26 | ||
| 27 | When not using Kerberos, return true if the notice claims to be authentic. | |
| 28 | Only used by clients; the server uses its own routine. | |
| 29 | */ | |
| 30 | Code_t ZCheckAuthentication(notice, from) | |
| 31 | ZNotice_t *notice; | |
| 32 | struct sockaddr_in *from; | |
| 33 | { | |
| 34 | #ifdef ZEPHYR_USES_KERBEROS | |
| 35 | int result; | |
| 36 | ZChecksum_t our_checksum; | |
| 37 | CREDENTIALS cred; | |
| 38 | ||
| 39 | /* If the value is already known, return it. */ | |
| 40 | if (notice->z_checked_auth != ZAUTH_UNSET) | |
| 41 | return (notice->z_checked_auth); | |
| 42 | ||
| 43 | if (!notice->z_auth) | |
| 44 | return (ZAUTH_NO); | |
| 45 | ||
| 46 | if ((result = krb_get_cred(SERVER_SERVICE, SERVER_INSTANCE, | |
| 47 | __Zephyr_realm, &cred)) != 0) | |
| 48 | return (ZAUTH_NO); | |
| 49 | ||
| 50 | #ifdef NOENCRYPTION | |
| 51 | our_checksum = 0; | |
| 52 | #else | |
| 53 | our_checksum = des_quad_cksum(notice->z_packet, NULL, | |
| 54 | notice->z_default_format+ | |
| 55 | strlen(notice->z_default_format)+1- | |
| 8354 | 56 | notice->z_packet, 0, (C_Block *)cred.session); |
| 2086 | 57 | #endif |
| 58 | /* if mismatched checksum, then the packet was corrupted */ | |
| 59 | return ((our_checksum == notice->z_checksum) ? ZAUTH_YES : ZAUTH_FAILED); | |
| 60 | ||
| 61 | #else | |
| 62 | return (notice->z_auth ? ZAUTH_YES : ZAUTH_NO); | |
| 63 | #endif | |
| 64 | } |