|
Lines 62-69
Link Here
|
| 62 |
#if defined(HAVE_GETAUDIT_ADDR) |
62 |
#if defined(HAVE_GETAUDIT_ADDR) |
| 63 |
#define AuditInfoStruct auditinfo_addr |
63 |
#define AuditInfoStruct auditinfo_addr |
| 64 |
#define AuditInfoTermID au_tid_addr_t |
64 |
#define AuditInfoTermID au_tid_addr_t |
| 65 |
#define GetAuditFunc(a,b) getaudit_addr((a),(b)) |
|
|
| 66 |
#define GetAuditFuncText "getaudit_addr" |
| 67 |
#define SetAuditFunc(a,b) setaudit_addr((a),(b)) |
65 |
#define SetAuditFunc(a,b) setaudit_addr((a),(b)) |
| 68 |
#define SetAuditFuncText "setaudit_addr" |
66 |
#define SetAuditFuncText "setaudit_addr" |
| 69 |
#define AUToSubjectFunc au_to_subject_ex |
67 |
#define AUToSubjectFunc au_to_subject_ex |
|
Lines 71-88
Link Here
|
| 71 |
#else |
69 |
#else |
| 72 |
#define AuditInfoStruct auditinfo |
70 |
#define AuditInfoStruct auditinfo |
| 73 |
#define AuditInfoTermID au_tid_t |
71 |
#define AuditInfoTermID au_tid_t |
| 74 |
#define GetAuditFunc(a,b) getaudit(a) |
|
|
| 75 |
#define GetAuditFuncText "getaudit" |
| 76 |
#define SetAuditFunc(a,b) setaudit(a) |
72 |
#define SetAuditFunc(a,b) setaudit(a) |
| 77 |
#define SetAuditFuncText "setaudit" |
73 |
#define SetAuditFuncText "setaudit" |
| 78 |
#define AUToSubjectFunc au_to_subject |
74 |
#define AUToSubjectFunc au_to_subject |
| 79 |
#define AUToReturnFunc(a,b) au_to_return((a), (u_int)(b)) |
75 |
#define AUToReturnFunc(a,b) au_to_return((a), (u_int)(b)) |
| 80 |
#endif |
76 |
#endif |
| 81 |
|
77 |
|
|
|
78 |
#ifndef cannot_audit |
| 82 |
extern int cannot_audit(int); |
79 |
extern int cannot_audit(int); |
|
|
80 |
#endif |
| 83 |
extern void aug_init(void); |
81 |
extern void aug_init(void); |
| 84 |
extern dev_t aug_get_port(void); |
|
|
| 85 |
extern int aug_get_machine(char *, u_int32_t *, u_int32_t *); |
| 86 |
extern void aug_save_auid(au_id_t); |
82 |
extern void aug_save_auid(au_id_t); |
| 87 |
extern void aug_save_uid(uid_t); |
83 |
extern void aug_save_uid(uid_t); |
| 88 |
extern void aug_save_euid(uid_t); |
84 |
extern void aug_save_euid(uid_t); |
|
Lines 117-122
extern Authctxt *the_authctxt;
Link Here
|
| 117 |
static AuditInfoTermID ssh_bsm_tid; |
113 |
static AuditInfoTermID ssh_bsm_tid; |
| 118 |
|
114 |
|
| 119 |
/* Below is the low-level BSM interface code */ |
115 |
/* Below is the low-level BSM interface code */ |
|
|
116 |
|
| 117 |
/* |
| 118 |
* aug_get_machine is only required on IPv6 capable machines, we use a |
| 119 |
* different mechanism in audit_connection_from() for IPv4-only machines. |
| 120 |
* getaudit_addr() is only present on IPv6 capable machines. |
| 121 |
*/ |
| 122 |
#if defined(HAVE_AUG_GET_MACHINE) || !defined(HAVE_GETAUDIT_ADDR) |
| 123 |
extern int aug_get_machine(char *, u_int32_t *, u_int32_t *); |
| 124 |
#else |
| 125 |
static int |
| 126 |
aug_get_machine(char *host, u_int32_t *addr, u_int32_t *type) |
| 127 |
{ |
| 128 |
struct addrinfo *ai; |
| 129 |
struct sockaddr_in *in4; |
| 130 |
struct sockaddr_in6 *in6; |
| 131 |
int ret = 0, r; |
| 132 |
|
| 133 |
if ((r = getaddrinfo(host, NULL, NULL, &ai)) != 0) { |
| 134 |
error("BSM audit: getaddrinfo failed for %.100s: %.100s", host, |
| 135 |
r == EAI_SYSTEM ? strerror(errno) : gai_strerror(r)); |
| 136 |
return -1; |
| 137 |
} |
| 138 |
|
| 139 |
switch (ai->ai_family) { |
| 140 |
case AF_INET: |
| 141 |
in4 = (struct sockaddr_in *)ai->ai_addr; |
| 142 |
*type = AU_IPv4; |
| 143 |
memcpy(addr, &in4->sin_addr, sizeof(struct in_addr)); |
| 144 |
break; |
| 145 |
#ifdef AU_IPv6 |
| 146 |
case AF_INET6: |
| 147 |
in6 = (struct sockaddr_in6 *)ai->ai_addr; |
| 148 |
*type = AU_IPv6; |
| 149 |
memcpy(addr, &in6->sin6_addr, sizeof(struct in6_addr)); |
| 150 |
break; |
| 151 |
#endif |
| 152 |
default: |
| 153 |
error("BSM audit: unknown address family for %.100s: %d", |
| 154 |
host, ai->ai_family); |
| 155 |
ret = -1; |
| 156 |
} |
| 157 |
freeaddrinfo(ai); |
| 158 |
return ret; |
| 159 |
} |
| 160 |
#endif |
| 120 |
|
161 |
|
| 121 |
/* |
162 |
/* |
| 122 |
* Check if the specified event is selected (enabled) for auditing. |
163 |
* Check if the specified event is selected (enabled) for auditing. |