cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
rstelmac
Level 2

Replacement for deprecated functions lc_username(), lc_display(), lc_hostname()

Jump to solution

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

Labels (1)
0 Kudos
(1) Solution
aparashar1
Flexera Alumni

@rstelmac , may i suggest you to have a look at this KB (link below) and confirm if that helps:

https://community.flexera.com/t5/FlexNet-Publisher-Knowledge-Base/How-nbsp-FNP-fetches-username-and-hostname-through-native-source/ta-p/115287

 

(If my response assists with your questions , then please click "ACCEPT AS SOLUTION" or 'Kudos' so that it help others.)

View solution in original post

(1) Reply
aparashar1
Flexera Alumni

@rstelmac , may i suggest you to have a look at this KB (link below) and confirm if that helps:

https://community.flexera.com/t5/FlexNet-Publisher-Knowledge-Base/How-nbsp-FNP-fetches-username-and-hostname-through-native-source/ta-p/115287

 

(If my response assists with your questions , then please click "ACCEPT AS SOLUTION" or 'Kudos' so that it help others.)