comparison multipass-checkpassword.go @ 3:ec4ded022025

Fix checkpassword to actually build.
author Paul Fisher <paul@pfish.zone>
date Sat, 24 Oct 2015 22:36:33 -0400
parents faf4aad86fc9
children b8545eea86b4
comparison
equal deleted inserted replaced
2:a4fa4f28b472 3:ec4ded022025
1 package main 1 package main
2 2
3 import ( 3 import (
4 "bufio" 4 "bufio"
5 "fmt"
6 "os" 5 "os"
7 "os/user" 6 "os/user"
8 "syscall" 7 "syscall"
9 8
10 "pfish.zone/go/multipass/file" 9 "pfish.zone/go/multipass/file"
14 InternalError = 111 13 InternalError = 111
15 Failed = 1 14 Failed = 1
16 ) 15 )
17 16
18 func main() { 17 func main() {
19 infile = os.NewFile(3, "") 18 infile := os.NewFile(3, "")
20 reader := bufio.NewReader(os.Stdin) 19 reader := bufio.NewReader(os.Stdin)
21 username, err := reader.ReadString('\n') 20 username, err := reader.ReadString('\n')
22 if err != nil { 21 if err != nil {
23 os.Exit(InternalError) 22 os.Exit(InternalError)
24 } 23 }
43 } 42 }
44 os.Setenv("userdb_uid", user.Uid) 43 os.Setenv("userdb_uid", user.Uid)
45 os.Setenv("userdb_gid", user.Gid) 44 os.Setenv("userdb_gid", user.Gid)
46 os.Setenv("EXTRA", "userdb_uid userdb_gid") 45 os.Setenv("EXTRA", "userdb_uid userdb_gid")
47 environ := []string{ 46 environ := []string{
48 "USER=" + user.Username 47 "USER=" + user.Username,
49 "userdb_uid=" + user.Uid, 48 "userdb_uid=" + user.Uid,
50 "userdb_gid=" + user.Gid, 49 "userdb_gid=" + user.Gid,
51 "HOME=" + user.HomeDir, 50 "HOME=" + user.HomeDir,
52 "EXTRA=userdb_uid userdb_gid", 51 "EXTRA=userdb_uid userdb_gid",
53 } 52 }