mirror of
https://github.com/drakkan/sftpgo.git
synced 2024-11-21 23:20:24 +00:00
Expand environment variables for external auth program
Use os.Environ() as a base instead of empty variable. Currently the environment of executed external auth program only contains SFTPGO_AUTHD* variables and therefore the program lacks additional context when started.
This commit is contained in:
parent
8e604f888a
commit
37c602a477
1 changed files with 1 additions and 0 deletions
|
@ -698,6 +698,7 @@ func doExternalAuth(username, password, pubKey string) (User, error) {
|
|||
ctx, cancel := context.WithTimeout(context.Background(), 15*time.Second)
|
||||
defer cancel()
|
||||
cmd := exec.CommandContext(ctx, config.ExternalAuthProgram)
|
||||
cmd.Env = os.Environ()
|
||||
cmd.Env = append(cmd.Env, fmt.Sprintf("SFTPGO_AUTHD_USERNAME=%v", username))
|
||||
if len(password) > 0 {
|
||||
cmd.Env = append(cmd.Env, fmt.Sprintf("SFTPGO_AUTHD_PASSWORD=%v", password))
|
||||
|
|
Loading…
Reference in a new issue