diff options
Diffstat (limited to 'sd_login/logind_session.go')
-rw-r--r-- | sd_login/logind_session.go | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/sd_login/logind_session.go b/sd_login/logind_session.go index 5c2c5ca..c48d619 100644 --- a/sd_login/logind_session.go +++ b/sd_login/logind_session.go @@ -14,9 +14,22 @@ package sd_login +import ( + "strings" +) + // A SessionName represents a login session. type SessionName string +func (name SessionName) isValid() bool { + id := string(name) + if id == "" { + return false + } + + return strings.TrimLeft(id, letters+digits) == "" +} + type SessionState int const ( |