Move audit control to option parsing. This fixes non-alpha build
error and cleans up an unruly 'if' statement.
Having audit control in option parsing may also draw awareness to
the audit system when adding new functions, which could easily be
overlooked otherwise.
Signed-off-by: J William Piggott <elseifthen@gmx.com>
case 'a':
ctl.adjust = 1;
ctl.show = 0;
case 'a':
ctl.adjust = 1;
ctl.show = 0;
break;
case 'r':
ctl.show = 1;
break;
case 'r':
ctl.show = 1;
case 's':
ctl.hctosys = 1;
ctl.show = 0;
case 's':
ctl.hctosys = 1;
ctl.show = 0;
break;
case 'u':
ctl.utc = 1;
break;
case 'u':
ctl.utc = 1;
case 'w':
ctl.systohc = 1;
ctl.show = 0;
case 'w':
ctl.systohc = 1;
ctl.show = 0;
break;
case OPT_SET:
ctl.set = 1;
ctl.show = 0;
break;
case OPT_SET:
ctl.set = 1;
ctl.show = 0;
break;
#if defined(__linux__) && defined(__alpha__)
case OPT_GETEPOCH:
break;
#if defined(__linux__) && defined(__alpha__)
case OPT_GETEPOCH:
case OPT_SETEPOCH:
ctl.setepoch = 1;
ctl.show = 0;
case OPT_SETEPOCH:
ctl.setepoch = 1;
ctl.show = 0;
break;
case OPT_EPOCH:
ctl.epoch_option = /* --epoch */
break;
case OPT_EPOCH:
ctl.epoch_option = /* --epoch */
argc -= optind;
argv += optind;
argc -= optind;
argv += optind;
-#ifdef HAVE_LIBAUDIT
- if (!ctl.testing) {
- if (ctl.adjust || ctl.hctosys || ctl.systohc || ctl.set
-# if defined(__linux__) && defined(__alpha__)
- || ctl.setepoch
-# endif
- )
- ctl.hwaudit_on = 1;
- }
-#endif
if (argc > 0) {
warnx(_("%d too many arguments given"), argc);
errtryhelp(EXIT_FAILURE);
if (argc > 0) {
warnx(_("%d too many arguments given"), argc);
errtryhelp(EXIT_FAILURE);
, int status)
{
#ifdef HAVE_LIBAUDIT
, int status)
{
#ifdef HAVE_LIBAUDIT
+ if (ctl->hwaudit_on && !ctl->testing) {
audit_log_user_message(hwaudit_fd, AUDIT_USYS_CONFIG,
"op=change-system-time", NULL, NULL, NULL,
status ? 0 : 1);
audit_log_user_message(hwaudit_fd, AUDIT_USYS_CONFIG,
"op=change-system-time", NULL, NULL, NULL,
status ? 0 : 1);
#endif
unsigned int debug;
unsigned int
#endif
unsigned int debug;
unsigned int
adjust:1,
show:1,
hctosys:1,
adjust:1,
show:1,
hctosys:1,