/* Need to be runas user while stat'ing things in the parser. */
set_perms(PERM_RUNAS);
error = yyparse();
-
if (error || parse_error) {
set_perms(PERM_ROOT);
return(VALIDATE_ERROR);
set_perms(PERM_ROOT);
return(VALIDATE_OK |
(no_passwd == TRUE ? FLAG_NOPASS : 0) |
- (no_execve == TRUE ? FLAG_NOEXEC : 0));
+ (no_execve == TRUE ? FLAG_NOEXEC : 0) |
+ (trace_cmnd == TRUE ? FLAG_TRACE : 0));
} else if ((runas_matches == TRUE && cmnd_matches == FALSE) ||
(runas_matches == FALSE && cmnd_matches == TRUE)) {
/*
set_perms(PERM_ROOT);
return(VALIDATE_NOT_OK |
(no_passwd == TRUE ? FLAG_NOPASS : 0) |
- (no_execve == TRUE ? FLAG_NOEXEC : 0));
+ (no_execve == TRUE ? FLAG_NOEXEC : 0) |
+ (trace_cmnd == TRUE ? FLAG_TRACE : 0));
}
}
top--;
match[top].runas = UNSPEC; \
match[top].nopass = def_authenticate ? UNSPEC : TRUE; \
match[top].noexec = def_noexec ? TRUE : UNSPEC; \
+ match[top].trace = def_trace ? TRUE : UNSPEC; \
top++; \
} while (0)
match[top].runas = match[top-1].runas; \
match[top].nopass = match[top-1].nopass; \
match[top].noexec = match[top-1].noexec; \
+ match[top].trace = match[top-1].trace; \
top++; \
} while (0)
%token <tok> PASSWD /* passwd req for command (default) */
%token <tok> NOEXEC /* preload dummy execve() for cmnd */
%token <tok> EXEC /* don't preload dummy execve() */
+%token <tok> TRACE /* trace children of cmnd */
+%token <tok> NOTRACE /* disable tracing of children */
%token <tok> ALL /* ALL keyword */
%token <tok> COMMENT /* comment and/or carriage return */
%token <tok> HOSTALIAS /* Host_Alias keyword */
runas_matches = UNSPEC;
no_passwd = def_authenticate ? UNSPEC : TRUE;
no_execve = def_noexec ? TRUE : UNSPEC;
+ trace_cmnd = def_trace ? TRUE : UNSPEC;
}
;
;
cmndtag : /* empty */ {
- /* Inherit {NOPASSWD,PASSWD,NOEXEC,EXEC} status. */
+ /* Inherit tags. */
if (printmatches == TRUE && host_matches == TRUE &&
user_matches == TRUE) {
if (no_passwd == TRUE)
cm_list[cm_list_len].noexecve = TRUE;
else
cm_list[cm_list_len].noexecve = FALSE;
+ if (trace_cmnd == TRUE)
+ cm_list[cm_list_len].trace = TRUE;
+ else
+ cm_list[cm_list_len].trace = FALSE;
}
}
| cmndtag NOPASSWD {
user_matches == TRUE)
cm_list[cm_list_len].noexecve = FALSE;
}
+ | cmndtag TRACE {
+ trace_cmnd = TRUE;
+ if (printmatches == TRUE && host_matches == TRUE &&
+ user_matches == TRUE)
+ cm_list[cm_list_len].trace = TRUE;
+ }
+ | cmndtag NOTRACE {
+ trace_cmnd = FALSE;
+ if (printmatches == TRUE && host_matches == TRUE &&
+ user_matches == TRUE)
+ cm_list[cm_list_len].trace = FALSE;
+ }
;
cmnd : ALL {
else if (cm_list[count].noexecve == FALSE && def_noexec)
(void) fputs("EXEC: ", stdout);
+ /* Is tracing enabled? */
+ if (cm_list[count].trace == TRUE && !def_trace)
+ (void) fputs("TRACE: ", stdout);
+ else if (cm_list[count].trace == FALSE && def_trace)
+ (void) fputs("NOTRACE: ", stdout);
+
/* Is a password required? */
if (cm_list[count].nopasswd == TRUE && def_authenticate)
(void) fputs("NOPASSWD: ", stdout);
cm_list[cm_list_len].runas = cm_list[cm_list_len].cmnd = NULL;
cm_list[cm_list_len].nopasswd = FALSE;
cm_list[cm_list_len].noexecve = FALSE;
+ cm_list[cm_list_len].trace = FALSE;
}
/*