Mercurial > pidgin.yaz
annotate src/protocols/zephyr/ZGetSender.c @ 11526:744b70723801
[gaim-migrate @ 13774]
Removing a problematic correction.
committer: Tailor Script <tailor@pidgin.im>
author | Richard Laager <rlaager@wiktel.com> |
---|---|
date | Mon, 12 Sep 2005 14:45:49 +0000 |
parents | 64895571248f |
children | 1b7c037aa77f |
rev | line source |
---|---|
2086 | 1 /* This file is part of the Project Athena Zephyr Notification System. |
2 * It contains source for the ZGetSender.c 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 | |
8 * "mit-copyright.h". | |
9 */ | |
10 | |
8792
43d6c08d7e96
[gaim-migrate @ 9554]
Christian Hammond <chipx86@chipx86.com>
parents:
2086
diff
changeset
|
11 #include "internal.h" |
2086 | 12 |
10867 | 13 #ifndef WIN32 |
2086 | 14 #include <pwd.h> |
10867 | 15 #endif |
2086 | 16 |
17 char *ZGetSender() | |
18 { | |
19 struct passwd *pw; | |
20 #ifdef ZEPHYR_USES_KERBEROS | |
21 char pname[ANAME_SZ], pinst[INST_SZ], prealm[REALM_SZ]; | |
22 static char sender[ANAME_SZ+INST_SZ+REALM_SZ+3] = ""; | |
10867 | 23 long int kerror; |
2086 | 24 #else |
25 static char sender[128] = ""; | |
26 #endif | |
27 | |
10867 | 28 #ifdef WIN32 |
29 unsigned long sender_size = 127; | |
30 #endif | |
31 | |
2086 | 32 /* Return it if already cached */ |
10038 | 33 |
34 /* if (*sender) | |
2086 | 35 return (sender); |
10038 | 36 */ |
2086 | 37 |
38 #ifdef ZEPHYR_USES_KERBEROS | |
10867 | 39 if ((kerror = krb_get_tf_fullname((char *)TKT_FILE, pname, pinst, prealm)) == KSUCCESS) |
2086 | 40 { |
41 (void) sprintf(sender, "%s%s%s@%s", pname, (pinst[0]?".":""), | |
42 pinst, prealm); | |
43 return (sender); | |
10867 | 44 } else { |
45 sprintf(sender,"%s@%s",(username?username:"unknown"),__Zephyr_realm); | |
46 return (sender); | |
2086 | 47 } |
48 #endif | |
49 | |
50 /* XXX a uid_t is a u_short (now), but getpwuid | |
51 * wants an int. AARGH! */ | |
10867 | 52 #ifdef WIN32 |
53 GetUserName(sender, &sender_size); | |
54 #else | |
2086 | 55 pw = getpwuid((int) getuid()); |
56 if (!pw) | |
57 return ("unknown"); | |
58 (void) sprintf(sender, "%s@%s", pw->pw_name, __Zephyr_realm); | |
10867 | 59 #endif |
2086 | 60 return (sender); |
61 } |