pass the name to a password file, don't use pw directly
This commit is contained in:
parent
5734364517
commit
376cd19fd4
|
@ -5,6 +5,7 @@ package main
|
|||
import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"git.gutmet.org/goutil"
|
||||
"git.gutmet.org/libUnreadMail"
|
||||
"os"
|
||||
)
|
||||
|
@ -14,17 +15,24 @@ 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}
|
||||
|
||||
mails, errs := unreadMail.FetchPlaintext(par)
|
||||
for _, err := range errs {
|
||||
passwd, err := goutil.ReadFile(*pwFilePtr)
|
||||
|
||||
if err != nil {
|
||||
fmt.Fprintln(os.Stderr, err)
|
||||
}
|
||||
for _, mail := range mails {
|
||||
fmt.Println(mail)
|
||||
fmt.Println("\n=*=*=*=*=*=*=*=*=\n")
|
||||
} else {
|
||||
par := &unreadMail.Parameters{*serverPtr, *portPtr, *certPtr, *userPtr, passwd}
|
||||
|
||||
mails, errs := unreadMail.FetchPlaintext(par)
|
||||
for _, err := range errs {
|
||||
fmt.Fprintln(os.Stderr, err)
|
||||
}
|
||||
for _, mail := range mails {
|
||||
fmt.Println(mail)
|
||||
fmt.Println("\n=*=*=*=*=*=*=*=*=\n")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user