internal/app: check username validation

This stuff should be hardcoded in libc, but check it anyway.

Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
2025-10-03 16:42:42 +09:00
parent d16da6da8c
commit dd0bb0a391
2 changed files with 41 additions and 0 deletions

View File

@@ -0,0 +1,15 @@
package app
import "testing"
const (
_POSIX_LOGIN_NAME_MAX = 9
)
func TestSysconf(t *testing.T) {
t.Run("LOGIN_NAME_MAX", func(t *testing.T) {
if got := sysconf(_SC_LOGIN_NAME_MAX); got < _POSIX_LOGIN_NAME_MAX {
t.Errorf("sysconf(_SC_LOGIN_NAME_MAX): %d < _POSIX_LOGIN_NAME_MAX", got)
}
})
}