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)
|
ctx, cancel := context.WithTimeout(context.Background(), 15*time.Second)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
cmd := exec.CommandContext(ctx, config.ExternalAuthProgram)
|
cmd := exec.CommandContext(ctx, config.ExternalAuthProgram)
|
||||||
|
cmd.Env = os.Environ()
|
||||||
cmd.Env = append(cmd.Env, fmt.Sprintf("SFTPGO_AUTHD_USERNAME=%v", username))
|
cmd.Env = append(cmd.Env, fmt.Sprintf("SFTPGO_AUTHD_USERNAME=%v", username))
|
||||||
if len(password) > 0 {
|
if len(password) > 0 {
|
||||||
cmd.Env = append(cmd.Env, fmt.Sprintf("SFTPGO_AUTHD_PASSWORD=%v", password))
|
cmd.Env = append(cmd.Env, fmt.Sprintf("SFTPGO_AUTHD_PASSWORD=%v", password))
|
||||||
|
|
Loading…
Reference in a new issue