Extend new syncuser handling for +/- entries
Since these lines are being omitted in the final sync'd passwd/group file, a new message indicates that the line is being skipped; but it is no longer denoted as a parse error. Signed-off-by: Jonathon Anderson <janderson@ciq.com>
This commit is contained in:
@@ -54,7 +54,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
||||
|
||||
### Changed
|
||||
|
||||
- Ignore +:::: lines in passwd/group during syncuser. #1286
|
||||
- Explicitly ignore compat-style NIS lines in passwd/group during syncuser. #1286
|
||||
|
||||
## v4.5.4, 2024-06-12
|
||||
|
||||
|
||||
@@ -177,7 +177,8 @@ func (db syncDB) read(fileName string, fromContainer bool) error {
|
||||
continue
|
||||
}
|
||||
// ignore ldap/nis/sssd line
|
||||
if fields[0] == "+" {
|
||||
if strings.HasPrefix(fields[0], "+") || strings.HasPrefix(fields[0], "-") {
|
||||
wwlog.Verbose("Ignoring line %s (unhandled compat-style NIS reference)", line)
|
||||
continue
|
||||
}
|
||||
id, err := strconv.Atoi(fields[2])
|
||||
|
||||
@@ -275,11 +275,13 @@ func Test_network_passwd(t *testing.T) {
|
||||
buf := new(bytes.Buffer)
|
||||
wwlog.SetLogWriter(buf)
|
||||
hostInput := `testuser1:x:1001:1001::/home/testuser:/bin/bash
|
||||
+::::::`
|
||||
+::::::
|
||||
-::::::`
|
||||
hostFileName := writeTempFile(t, hostInput)
|
||||
defer os.Remove(hostFileName)
|
||||
db := make(syncDB)
|
||||
err := db.readFromHost(hostFileName)
|
||||
assert.NotContains(t, buf.String(), "parse error")
|
||||
assert.Contains(t, buf.String(), "Ignoring line")
|
||||
assert.NoError(t, err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user