java.lang.Object
com.aoindustries.aoserv.daemon.posix.PasswdFile
Manages access to the
/etc/passwd
file.- Author:
- AO Industries, Inc.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final class
Represents one line of the/etc/passwd
file on a POSIX server. -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic byte[]
buildPasswdFile
(Map<User.Name, PasswdFile.Entry> expectedEntries, int uidMin, int uidMax) Builds a new version of the passwd file with necessary adjustments made.static Map<User.Name,
PasswdFile.Entry> Reads the full contents of/etc/passwd
.static void
writePasswdFile
(byte[] newContents, Set<PosixFile> restorecon) Must holdpasswdLock
.
-
Field Details
-
passwdLock
Locks the passwd file for updates.
-
-
Method Details
-
readPasswdFile
Reads the full contents of/etc/passwd
.Must hold
passwdLock
.- Throws:
IOException
-
writePasswdFile
public static void writePasswdFile(byte[] newContents, Set<PosixFile> restorecon) throws IOException Must holdpasswdLock
.- Throws:
IOException
-
buildPasswdFile
public static byte[] buildPasswdFile(Map<User.Name, PasswdFile.Entry> expectedEntries, int uidMin, int uidMax) throws IOExceptionBuilds a new version of the passwd file with necessary adjustments made.Must hold
passwdLock
.- Throws:
IOException
-