lslogins: store users in a tree

Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
lslogins: use thread-safe functions

Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
lslogins: minor optimizations

Signed-off-by: Ondrej Oprala <ooprala@redhat.com>