mirror of
https://blitiri.com.ar/repos/chasquid
synced 2025-12-17 14:37:02 +00:00
chasquid-util: Print errors to stderr
To make it more difficult to accidentally supress errors, or mistake them for legitimate output, print errors to stderr.
This commit is contained in:
@@ -96,9 +96,10 @@ func main() {
|
||||
}
|
||||
}
|
||||
|
||||
// Fatalf prints the given message, then exits the program with an error code.
|
||||
// Fatalf prints the given message to stderr, then exits the program with an
|
||||
// error code.
|
||||
func Fatalf(s string, arg ...interface{}) {
|
||||
fmt.Printf(s+"\n", arg...)
|
||||
fmt.Fprintf(os.Stderr, s+"\n", arg...)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ if ! r user-add denied@domain --receive_only > /dev/null; then
|
||||
fi
|
||||
check_userdb
|
||||
|
||||
if r user-add xxx@domain --password=passwd --receive_only > /dev/null; then
|
||||
if r user-add xxx@domain --password=passwd --receive_only > /dev/null 2>&1; then
|
||||
echo user-add --password --receive_only worked
|
||||
exit 1
|
||||
fi
|
||||
@@ -50,12 +50,12 @@ if ! r authenticate user@domain --password=passwd > /dev/null; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if r authenticate user@domain --password=abcd > /dev/null; then
|
||||
if r authenticate user@domain --password=abcd > /dev/null 2>&1; then
|
||||
echo authenticate with bad password worked
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if r authenticate denied@domain --password=abcd > /dev/null; then
|
||||
if r authenticate denied@domain --password=abcd > /dev/null 2>&1; then
|
||||
echo authenticate on a no-submission user worked
|
||||
exit 1
|
||||
fi
|
||||
@@ -82,7 +82,7 @@ if ! r user-remove user@domain > /dev/null; then
|
||||
fi
|
||||
check_userdb
|
||||
|
||||
if r authenticate user@domain --password=passwd > /dev/null; then
|
||||
if r authenticate user@domain --password=passwd > /dev/null 2>&1; then
|
||||
echo authenticate for removed user worked
|
||||
exit 1
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user