From 37c602a47776753d35ff236722b93bb9f03c509e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20K?= Date: Thu, 9 Jan 2020 02:45:22 +0100 Subject: [PATCH] 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. --- dataprovider/dataprovider.go | 1 + 1 file changed, 1 insertion(+) diff --git a/dataprovider/dataprovider.go b/dataprovider/dataprovider.go index f83122b8..326ad30d 100644 --- a/dataprovider/dataprovider.go +++ b/dataprovider/dataprovider.go @@ -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))