doug@wbcs.UUCP (Doug Kratky) (03/04/89)
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)? Doug Kratky ... US MAIL ....................... UUCP ................................... Boeing Computer Services ...!scubed!ncr-sd!ncrwic!wbcs!doug PO Box 7730, MS K79-32 ...!bellcore!fenix!ncrlnk!ncrwic!wbcs!doug Wichita, KS 67277-7730 ...!hplabs!hp-sdd!ncr-sd!ncrwic!wbcs!doug ............................................................................
mishkin@apollo.COM (Nathaniel Mishkin) (03/06/89)
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