pass the name to a password file, don't use pw directly

This commit is contained in:
Alexander Weinhold 2017-09-08 14:38:00 +02:00
parent 5734364517
commit 376cd19fd4

View File

@ -5,6 +5,7 @@ package main
import (
"flag"
"fmt"
"git.gutmet.org/goutil"
"git.gutmet.org/libUnreadMail"
"os"
)
@ -14,10 +15,16 @@ func main() {
portPtr := flag.Int("port", 993, "server port")
certPtr := flag.String("cert", "", "PEM cert of server")
userPtr := flag.String("user", "", "user login name")
passwdPtr := flag.String("passwd", "", "password for user")
pwFilePtr := flag.String("pwfile", "", "password file for user")
flag.Parse()
par := &unreadMail.Parameters{*serverPtr, *portPtr, *certPtr, *userPtr, *passwdPtr}
passwd, err := goutil.ReadFile(*pwFilePtr)
if err != nil {
fmt.Fprintln(os.Stderr, err)
} else {
par := &unreadMail.Parameters{*serverPtr, *portPtr, *certPtr, *userPtr, passwd}
mails, errs := unreadMail.FetchPlaintext(par)
for _, err := range errs {
@ -27,4 +34,5 @@ func main() {
fmt.Println(mail)
fmt.Println("\n=*=*=*=*=*=*=*=*=\n")
}
}
}