Skip to content

Commit 309f823

Browse files
committed
Handle autofs entries in /etc/mtab
Some file systems can be mounted using autofs, which should be considered during analysis of /etc/mtab.F or more details, please see the comment introduced in this patch.
1 parent f47e702 commit 309f823

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/OVAL/probes/fsdev.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,20 @@ is_local_fs(struct mntent *ment)
125125
#if 1
126126
char *s;
127127

128+
/*
129+
* When type of the filesystem is autofs, it means the mtab entry
130+
* describes the autofs configuration, which means ment->mnt_fsname
131+
* is a path to the relevant autofs map, eg. /etc/auto.misc. In this
132+
* situation, the following code which analyses ment->mnt_type would
133+
* not work. When the filesystem handled by autofs is mounted, there
134+
* is another different entry in mtab which contains the real block
135+
* special device or remote filesystem in ment->mnt_fsname, and that
136+
* will be parsed in a different call of this function.
137+
*/
138+
if (!strcmp(ment->mnt_type, "autofs")) {
139+
return 0;
140+
}
141+
128142
s = ment->mnt_fsname;
129143
/* If the fsname begins with "//", it is probably CIFS. */
130144
if (s[0] == '/' && s[1] == '/')

0 commit comments

Comments
 (0)