How to get the login class name from a uid?

nocturnal nocturnal at swehack.se
Wed Apr 12 21:20:50 UTC 2006


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



More information about the freebsd-questions mailing list