-
Notifications
You must be signed in to change notification settings - Fork 88
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[capistrano] Add ability to use
etc.getpwuid
instead of `etc.getlog…
…in` to get the user name (#146) * Do not use getlogin() function to obtain username `getlogin()` obtains the logged-in username by looking up the current tty in `utmp` and reporting the login name found in that utmp record. If Capistrano is ran from Jenkins in the host it returns the user logged in to `pts/0`, which is not the same user as runs the Capistrano. Also Ruby docs recommends avoid using `getlogin()`: >getlogin → String >Returns the short user name of the currently logged in user. Unfortunately, it is often rather easy to fool ::getlogin. > >Avoid ::getlogin for security-related purposes. > >If ::getlogin fails, try ::getpwuid. > >See the unix manpage for getpwuid(3) for more detail. http://ruby-doc.org/stdlib-2.2.0/libdoc/etc/rdoc/Etc.html#method-c-getlogin * keep backward compat * rubocop * add doc Co-authored-by: Hippolyte HENRY <zippolyte@users.noreply.github.com>
- Loading branch information
Showing
5 changed files
with
43 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters