Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ulowell!apollo!mishkin From: mishkin@apollo.COM (Nathaniel Mishkin) Newsgroups: comp.sys.apollo Subject: Re: How do I get person, project, org from within a C program? Message-ID: <41dcce50.18fa1@apollo.COM> Date: 6 Mar 89 14:55:00 GMT References: <149@wbcs.UUCP> Reply-To: mishkin@apollo.com (Nathaniel Mishkin) Distribution: usa Organization: Apollo Computer, Chelmsford, MA Lines: 19 In article <149@wbcs.UUCP> doug@wbcs.UUCP (Doug Kratky) writes: >I need to be able to get the login identifier of a calling process from >wihin a C program. The description of pm_$get_sid_txt advertises that >it does just that, and pm_$get_sid_txt returns a string in a useful >format. Unfortunately, the sid (login identifier) that pm_$get_sid_txt >returns can be changed by changing enivronment variables! > >Is there an equivalent call or a series of calls that will produce a >login identifier that can be trusted (i.e., not affected by changes in >environment variables)? Just use the getuid/getgid/getoid calls to get the current Unix user, group, and organization IDs. You can then use getpwuid/getgrgid/getorgid to get the corresponding text string names. -- -- Nat Mishkin Apollo Computer Inc., Chelmsford, MA mishkin@apollo.com