|
Lines 45-50
Link Here
|
| 45 |
#include <string.h> |
45 |
#include <string.h> |
| 46 |
#include <unistd.h> |
46 |
#include <unistd.h> |
| 47 |
|
47 |
|
|
|
48 |
#ifdef BROKEN_BSM_API |
| 49 |
#include <libscf.h> |
| 50 |
#endif |
| 51 |
|
| 48 |
#include "ssh.h" |
52 |
#include "ssh.h" |
| 49 |
#include "log.h" |
53 |
#include "log.h" |
| 50 |
#include "key.h" |
54 |
#include "key.h" |
|
Lines 114-119
Link Here
|
| 114 |
extern Authctxt *the_authctxt; |
118 |
extern Authctxt *the_authctxt; |
| 115 |
static AuditInfoTermID ssh_bsm_tid; |
119 |
static AuditInfoTermID ssh_bsm_tid; |
| 116 |
|
120 |
|
|
|
121 |
#ifdef BROKEN_BSM_API |
| 122 |
/* For some reason this constant is no longer defined |
| 123 |
in Solaris 11. */ |
| 124 |
#define BSM_TEXTBUFSZ 256 |
| 125 |
#endif |
| 126 |
|
| 117 |
/* Below is the low-level BSM interface code */ |
127 |
/* Below is the low-level BSM interface code */ |
| 118 |
|
128 |
|
| 119 |
/* |
129 |
/* |
|
Lines 161-166
Link Here
|
| 161 |
} |
171 |
} |
| 162 |
#endif |
172 |
#endif |
| 163 |
|
173 |
|
|
|
174 |
#ifdef BROKEN_BSM_API |
| 175 |
/* |
| 176 |
In Solaris 11 the audit daemon has been moved to SMF. In the process |
| 177 |
they simply dropped getacna() from the API, since it read from a now |
| 178 |
non-existent config file. This function re-implements getacna() to |
| 179 |
read from the SMF repository instead. |
| 180 |
*/ |
| 181 |
int |
| 182 |
getacna(char *auditstring, int len) |
| 183 |
{ |
| 184 |
scf_handle_t *handle = NULL; |
| 185 |
scf_property_t *property = NULL; |
| 186 |
scf_value_t *value = NULL; |
| 187 |
int ret = 0; |
| 188 |
|
| 189 |
handle = scf_handle_create(SCF_VERSION); |
| 190 |
if (handle == NULL) |
| 191 |
return -2; /* The man page for getacna on Solaris 10 states |
| 192 |
we should return -2 in case of error and set |
| 193 |
errno to indicate the error. We don't bother |
| 194 |
with errno here, though, since the only use |
| 195 |
of this function below doesn't check for errors |
| 196 |
anyway. |
| 197 |
*/ |
| 198 |
|
| 199 |
ret = scf_handle_bind(handle); |
| 200 |
if (ret == -1) |
| 201 |
return -2; |
| 202 |
|
| 203 |
property = scf_property_create(handle); |
| 204 |
if (property == NULL) |
| 205 |
return -2; |
| 206 |
|
| 207 |
ret = scf_handle_decode_fmri(handle, |
| 208 |
"svc:/system/auditd:default/:properties/preselection/naflags", |
| 209 |
NULL, NULL, NULL, NULL, property, 0); |
| 210 |
if (ret == -1) |
| 211 |
return -2; |
| 212 |
|
| 213 |
value = scf_value_create(handle); |
| 214 |
if (value == NULL) |
| 215 |
return -2; |
| 216 |
|
| 217 |
ret = scf_property_get_value(property, value); |
| 218 |
if (ret == -1) |
| 219 |
return -2; |
| 220 |
|
| 221 |
ret = scf_value_get_astring(value, auditstring, len); |
| 222 |
if (ret == -1) |
| 223 |
return -2; |
| 224 |
|
| 225 |
scf_value_destroy(value); |
| 226 |
scf_property_destroy(property); |
| 227 |
scf_handle_destroy(handle); |
| 228 |
|
| 229 |
return 0; |
| 230 |
} |
| 231 |
#endif |
| 232 |
|
| 164 |
/* |
233 |
/* |
| 165 |
* Check if the specified event is selected (enabled) for auditing. |
234 |
* Check if the specified event is selected (enabled) for auditing. |
| 166 |
* Returns 1 if the event is selected, 0 if not and -1 on failure. |
235 |
* Returns 1 if the event is selected, 0 if not and -1 on failure. |
|
Lines 213-219
Link Here
|
| 213 |
(void) au_write(ad, au_to_text(string)); |
282 |
(void) au_write(ad, au_to_text(string)); |
| 214 |
(void) au_write(ad, AUToReturnFunc(typ, rc)); |
283 |
(void) au_write(ad, AUToReturnFunc(typ, rc)); |
| 215 |
|
284 |
|
|
|
285 |
#ifdef BROKEN_BSM_API |
| 286 |
/* The last argument is the event modifier flags. For |
| 287 |
some seemingly undocumented reason it was added in |
| 288 |
Solaris 11. */ |
| 289 |
rc = au_close(ad, AU_TO_WRITE, event_no, 0); |
| 290 |
#else |
| 216 |
rc = au_close(ad, AU_TO_WRITE, event_no); |
291 |
rc = au_close(ad, AU_TO_WRITE, event_no); |
|
|
292 |
#endif |
| 293 |
|
| 217 |
if (rc < 0) |
294 |
if (rc < 0) |
| 218 |
error("BSM audit: %s failed to write \"%s\" record: %s", |
295 |
error("BSM audit: %s failed to write \"%s\" record: %s", |
| 219 |
__func__, string, strerror(errno)); |
296 |
__func__, string, strerror(errno)); |