/* Corresponds to 'security_id' in `struct wim_dentry_on_disk': The
* index of this inode's security descriptor in the WIM image's table of
- * security descriptors, or -1. Note: when a WIM image is loaded,
- * wimlib sets out-of-bounds indices and values less than -1 in this
- * field to -1. So the extraction code need not do an upper bound check
- * after checking for -1 (or equivalently < 0). */
+ * security descriptors, or -1 if this inode does not have a security
+ * descriptor. */
s32 i_security_id;
/* Unknown field that we only read into memory so we can re-write it
return inode->i_children != NULL;
}
+/* Does the inode have a security descriptor? */
+static inline bool
+inode_has_security_descriptor(const struct wim_inode *inode)
+{
+ return inode->i_security_id >= 0;
+}
+
extern struct wim_inode_stream *
inode_get_stream(const struct wim_inode *inode, int stream_type,
const utf16lechar *stream_name);
else
features->other_reparse_points++;
}
- if (inode->i_security_id != -1)
+ if (inode_has_security_descriptor(inode))
features->security_descriptors++;
if (inode_has_unix_data(inode))
features->unix_data++;
for (struct wim_dentry *d = dentry; !dentry_is_root(d); d = d->d_parent)
wdentry->depth++;
- if (inode->i_security_id >= 0) {
+ if (inode_has_security_descriptor(inode)) {
struct wim_security_data *sd;
sd = wim_get_current_security_data(wim);
}
/* Security descriptor */
- if ((inode->i_security_id >= 0)
+ if (inode_has_security_descriptor(inode)
&& !(extract_flags & WIMLIB_EXTRACT_FLAG_NO_ACLS))
{
const void *desc;
NTSTATUS status;
/* Set security descriptor if present and not in NO_ACLS mode */
- if (inode->i_security_id >= 0 &&
+ if (inode_has_security_descriptor(inode) &&
!(ctx->common.extract_flags & WIMLIB_EXTRACT_FLAG_NO_ACLS))
{
const struct wim_security_data *sd;