Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add user information to process #34

Merged
merged 8 commits into from
Jan 3, 2019
Merged

Conversation

cwurm
Copy link

@cwurm cwurm commented Jan 2, 2019

Adds a User() function to Process and implements it for all providers.

For Linux and Darwin (macOS) this retrieves the real, effective, and saved user and group IDs.

For Windows, this retrieves the user and primary group SID.

It does not retrieve the Linux-specific filesystem UID and GID because its use has been deprecated for a long time (since 1995, I believe).

Closes #10.

@cwurm cwurm added the review label Jan 2, 2019
@cwurm cwurm requested a review from andrewkroh January 2, 2019 13:11
types/process.go Outdated
// On Linux and Darwin (macOS) this is the real user ID.
// On Windows, this is the security identifier (SID) of the
// user account of the process access token.
Uid string `json:"uid"`

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

struct field Uid should be UID

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fyi, I first had it as UID but changed it to Uid to be like Golang's User.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think about going our own way and capitalizing each of these acronyms? Or do you have any insight why the os/user package doesn't follow this practice?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can capitalize, that was my first instinct as well. I looked at the history of os/user - it has been Uid/Gid since when it was introduced some 8 years ago. So maybe back then the Go coding standards were not as consistent.

Copy link
Member

@andrewkroh andrewkroh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice 👍

providers/linux/process_linux.go Outdated Show resolved Hide resolved
types/process.go Outdated
// On Linux and Darwin (macOS) this is the real user ID.
// On Windows, this is the security identifier (SID) of the
// user account of the process access token.
Uid string `json:"uid"`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think about going our own way and capitalizing each of these acronyms? Or do you have any insight why the os/user package doesn't follow this practice?

@cwurm cwurm merged commit e685522 into elastic:master Jan 3, 2019
@cwurm cwurm deleted the process_uid_gid branch January 3, 2019 14:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants