instance.subject.egid = std::stoul(value);
} else if (name == "pid") {
instance.subject.pid = std::stoul(value);
+ } else if (name == "ppid") {
+ instance.subject.ppid = std::stoul(value);
} else if (name == "exe") {
instance.subject.name = value;
} else if (name == "subj") {
std::string label;
std::string name;
pid_t pid = UINT_MAX;
+ pid_t ppid = UINT_MAX;
} subject;
struct {
return AUDIT_TRAIL_ERROR_NONE;
}
+int audit_system_log_get_subject_ppid(audit_system_log_h handle, pid_t *ppid)
+{
+ RET_ON_FAILURE(handle, AUDIT_TRAIL_ERROR_INVALID_PARAMETER);
+ RET_ON_FAILURE(ppid, AUDIT_TRAIL_ERROR_INVALID_PARAMETER);
+
+ const auto &log = GetSystemLog(handle).log;
+ *ppid = log.subject.ppid;
+
+ return AUDIT_TRAIL_ERROR_NONE;
+}
+
int audit_system_log_get_subject_smack_label(audit_system_log_h handle,
char **label)
{
*/
AUDIT_TRAIL_API int audit_system_log_get_subject_pid(audit_system_log_h handle, pid_t *pid);
+/**
+ * @brief Get the subject parent process ID from the system audit log
+ * @details This API can be used to get the subject parent process ID in
+ * each system audit logs.
+ * @since_tizen 5.0
+ * @param[in] handle The system audit log handle
+ * @param[out] ppid The subject parent process ID
+ * @return #AUDIT_TRAIL_ERROR_NONE on success, otherwise a negative value
+ * @retval #AUDIT_TRAIL_ERROR_NONE Successful
+ * @retval #AUDIT_TRAIL_ERROR_TIMED_OUT Time out
+ * @retval #AUDIT_TRAIL_ERROR_INVALID_PARAMETER Invalid parameter
+ */
+AUDIT_TRAIL_API int audit_system_log_get_subject_ppid(audit_system_log_h handle, pid_t *ppid);
+
/**
* @brief Get the subject smack label from the system audit log
* @details This API can be used to get the subject smack label in
log.time.time, log.time.millisec,
log.subject.uid, log.subject.euid,
log.subject.gid, log.subject.egid,
- log.subject.label, log.subject.name, log.subject.pid,
+ log.subject.label, log.subject.name,
+ log.subject.pid, log.subject.ppid,
log.object.type, log.object.uid, log.object.gid,
log.object.mode, log.object.label,
log.object.name, log.object.socketAddr,
char *sub_name, *sub_label;
uid_t sub_uid, sub_euid;
gid_t sub_gid, sub_egid;
- pid_t sub_pid;
+ pid_t sub_pid, sub_ppid;
audit_system_log_get_subject_name(log, &sub_name);
str << "name=" << sub_name;
audit_system_log_get_subject_pid(log, &sub_pid);
str << ",pid=" << sub_pid;
+ audit_system_log_get_subject_ppid(log, &sub_ppid);
+ str << ",ppid=" << sub_ppid;
+
::free(sub_name);
::free(sub_label);
}