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 (
|
import (
|
||||||
"flag"
|
"flag"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"git.gutmet.org/goutil"
|
||||||
"git.gutmet.org/libUnreadMail"
|
"git.gutmet.org/libUnreadMail"
|
||||||
"os"
|
"os"
|
||||||
)
|
)
|
||||||
|
@ -14,10 +15,16 @@ func main() {
|
||||||
portPtr := flag.Int("port", 993, "server port")
|
portPtr := flag.Int("port", 993, "server port")
|
||||||
certPtr := flag.String("cert", "", "PEM cert of server")
|
certPtr := flag.String("cert", "", "PEM cert of server")
|
||||||
userPtr := flag.String("user", "", "user login name")
|
userPtr := flag.String("user", "", "user login name")
|
||||||
passwdPtr := flag.String("passwd", "", "password for user")
|
pwFilePtr := flag.String("pwfile", "", "password file for user")
|
||||||
|
|
||||||
flag.Parse()
|
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)
|
mails, errs := unreadMail.FetchPlaintext(par)
|
||||||
for _, err := range errs {
|
for _, err := range errs {
|
||||||
|
@ -27,4 +34,5 @@ func main() {
|
||||||
fmt.Println(mail)
|
fmt.Println(mail)
|
||||||
fmt.Println("\n=*=*=*=*=*=*=*=*=\n")
|
fmt.Println("\n=*=*=*=*=*=*=*=*=\n")
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user