- Revenera Community
- :
- FlexNet Publisher
- :
- FlexNet Publisher Forum
- :
- Re: Replacement for deprecated functions lc_username(), lc_display(), lc_hostname()
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
Hello,
We are using lc_username(), lc_display() and lc_hostname() functions for logging mostly, and I know that those functions are deprecated, so I would like to replace them with OS alternatives.
My question is, what is the suggested alternatives are, especially for lc_username() ? I don't want to cause any confusion to costumers who already reading the logs.
I know 3 ways to get the username in Linux,
1) with getenv("USER") // which is bad, anyone can spoof the username and the getenv will be MT-unsafe if someone will call setenv/putenv.
2) with getlogin_r() // which is buggy according to man pages
3) and with getpwid_r() // which is Ok i guess
What replacements for do Revenera team suggest?
Thank you
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
@rstelmac , may i suggest you to have a look at this KB (link below) and confirm if that helps:
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
@rstelmac , may i suggest you to have a look at this KB (link below) and confirm if that helps: