comparison multipass-checkpassword.go @ 8:4db389f948c9

Preserve the entire environment when password checking.
author Paul Fisher <paul@pfish.zone>
date Sun, 25 Oct 2015 00:03:06 -0400
parents 10613f0f4737
children
comparison
equal deleted inserted replaced
7:406d3cd76739 8:4db389f948c9
38 } 38 }
39 user, err := user.Lookup(username) 39 user, err := user.Lookup(username)
40 if err != nil { 40 if err != nil {
41 os.Exit(Failed) 41 os.Exit(Failed)
42 } 42 }
43 os.Setenv("USER", user.Username)
44 os.Setenv("HOME", user.HomeDir)
43 os.Setenv("userdb_uid", user.Uid) 45 os.Setenv("userdb_uid", user.Uid)
44 os.Setenv("userdb_gid", user.Gid) 46 os.Setenv("userdb_gid", user.Gid)
45 os.Setenv("EXTRA", "userdb_uid userdb_gid") 47 os.Setenv("EXTRA", "userdb_uid userdb_gid")
46 environ := []string{ 48 syscall.Exec(os.Args[1], os.Args[1:], os.Environ())
47 "USER=" + user.Username,
48 "userdb_uid=" + user.Uid,
49 "userdb_gid=" + user.Gid,
50 "HOME=" + user.HomeDir,
51 "EXTRA=userdb_uid userdb_gid",
52 }
53 syscall.Exec(os.Args[1], os.Args[1:], environ)
54 } 49 }