Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 12 Apr 2006 23:20:54 +0200
From:      nocturnal <nocturnal@swehack.se>
To:        freebsd-questions@freebsd.org
Subject:   How to get the login class name from a uid?
Message-ID:  <443D6F36.2010904@swehack.se>

next in thread | raw e-mail | index | archive | help
Hi

Reading the login_cap(3) manual i thought i would get default returned 
if no other login classes are found but it's possible i misunderstood 
the manual. A sample of code i'm using is below. The user running the 
application is in a login class other than default, i've verified this 
in the master.passwd files class field. I have also rebuilt the termcap 
database for login.conf after adding the class. Right the new class only 
has a simple :tc=default: to test if it works. The code below outputs 
only (null).

  uid_t uid = getuid();
  struct passwd * pw = getpwuid(uid);
  login_cap_t * lc = login_getuserclass(pw);
  printf("%s\n", lc->lc_class);

Thank you in advance for any help.
-- 



Med vänliga hälsningar

Stefan Midjich aka nocturnal
[Swehack] http://swehack.se




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?443D6F36.2010904>