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

fall back to env var USER when /etc/passwd and stdlib faculties fail … #583

Merged
merged 1 commit into from
Mar 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

FIX: Also update the Python SDK to include the permission mode and access grants fields on the `ShareRequest` (https://github.com/openziti/zrok/issues/432)

FIX: Add a way to find the username on Linux when /etc/passwd and stdlib can't resolve the UID (https://github.com/openziti/zrok/issues/454)

## v0.4.26

FEATURE: New _permission modes_ available for shares. _Open permission mode_ retains the behavior of previous zrok releases and is the default setting. _Closed permission mode_ (`--closed`) only allows a share to be accessed (`zrok access`) by users who have been granted access with the `--access-grant` flag. See the documentation at (https://docs.zrok.io/docs/guides/permission-modes/) (https://github.com/openziti/zrok/issues/432)
Expand Down
12 changes: 9 additions & 3 deletions cmd/zrok/enable.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,19 @@ func (cmd *enableCommand) run(_ *cobra.Command, args []string) {
if err != nil {
panic(err)
}
var username string
user, err := user2.Current()
if err != nil {
panic(err)
username := os.Getenv("USER")
if username == "" {
logrus.Panicf("unable to determine the current user: %v", err)
}
} else {
username = user.Username
}
hostDetail = fmt.Sprintf("%v; %v", user.Username, hostDetail)
hostDetail = fmt.Sprintf("%v; %v", username, hostDetail)
if cmd.description == "<user>@<hostname>" {
cmd.description = fmt.Sprintf("%v@%v", user.Username, hostName)
cmd.description = fmt.Sprintf("%v@%v", username, hostName)
}
zrok, err := env.Client()
if err != nil {
Expand Down
Loading