summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xinu.at>2018-09-25 10:44:12 +0200
committerFlorian Pritz <bluewind@xinu.at>2018-09-25 16:49:13 +0200
commit54de879d1b71366b9d9f5430d624c29651ef1b7f (patch)
tree168a149807dc28c8c3a6269c3bb787cbcfdd1276
parent24083421e4a38b1dbca6f0f593aaecae8f4f57ec (diff)
downloadApp-ImapNotify-54de879d1b71366b9d9f5430d624c29651ef1b7f.tar.gz
App-ImapNotify-54de879d1b71366b9d9f5430d624c29651ef1b7f.tar.xz
Remove imap password from trace log
Signed-off-by: Florian Pritz <bluewind@xinu.at>
-rw-r--r--lib/App/ImapNotify/ImapClient.pm12
1 files changed, 7 insertions, 5 deletions
diff --git a/lib/App/ImapNotify/ImapClient.pm b/lib/App/ImapNotify/ImapClient.pm
index ae91c78..c57204f 100644
--- a/lib/App/ImapNotify/ImapClient.pm
+++ b/lib/App/ImapNotify/ImapClient.pm
@@ -77,7 +77,7 @@ method _login() {
croak "Server doesn't support AUTH=PLAIN";
}
- my $response = $self->send_command("login $self->{config}->{username} $self->{config}->{password}");
+ my $response = $self->send_command("login $self->{config}->{username} $self->{config}->{password}", "login $self->{config}->{username} [...]");
return if not defined $response;
confess "No capabilities found in response: '".$response->[0]."'" unless $response->[0] =~ m/^OK \[(.*)\].*$/;
@@ -97,12 +97,14 @@ method select($mailbox) {
}
-method send_command($command) {
+method send_command($command, $log_command = undef) {
my $id = "CMD-".$self->{command_counter}++;
chomp($command);
- $self->writeline("$id $command\r\n");
+ $log_command = $command if !defined $log_command;
+
+ $self->writeline("$id $command\r\n", "$id $log_command");
my @lines;
@@ -164,8 +166,8 @@ method handle_fetch($first_line) {
}
}
-method writeline($line) {
- $log->tracef("%s >> %s", $self->{log_id}, $line =~ s/\r\n$//r);
+method writeline($line, $log_line) {
+ $log->tracef("%s >> %s", $self->{log_id}, $log_line);
return $self->{deps}->{sock}->writeline($line);
}