Skip to content

Commit 3056548

Browse files
author
H.Merijn Brand - Tux
committed
Autologin (only if config is only readable by owner)
1 parent 4afef7f commit 3056548

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

lib/PM/CB/GUI.pm

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -559,6 +559,12 @@ sub update_time {
559559
sub login_dialog {
560560
my ($self) = @_;
561561
562+
if ($self->{username} && $self->{password}) {
563+
($login, $password) = ($self->{username}, $self->{password});
564+
$self->send_login;
565+
return;
566+
}
567+
562568
my $dialog = $self->{mw}->Dialog(
563569
-title => 'Login',
564570
-default_button => 'Login',

pm-cb-g

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,11 @@ BEGIN {
3636
my $home = $ENV{HOME} || $ENV{USERPROFILE} || $ENV{HOMEPATH};
3737
foreach my $rcf (grep { -s }
3838
"$home/pm-cb.rc", "$home/.pm-cbrc", "$home/.config/pm-cb") {
39-
(stat $rcf)[2] & 022 and next;
39+
my $mode = (stat $rcf)[2];
40+
$mode & 022 and next;
4041
open my $fh, "<", $rcf or next;
4142
while (<$fh>) {
43+
$mode & 044 && m/password/i and next;
4244
s/\s*#.*$//;
4345
my ($k, $v) = (m/^\s*([-\w]+)\s*[:=]\s*(.*\S)/) or next;
4446
$conf{ lc $k
@@ -56,6 +58,7 @@ BEGIN {
5658
=~ s{^(?:no|false)$}{0}ir
5759
=~ s{^(?:yes|true)$}{1}ir;
5860
}
61+
5962
}
6063
exists $conf{show_time} and $conf{no_time} = !delete $conf{show_time};
6164
$conf{font_name} =~ m/\s/ and $conf{font_name} = "{".$conf{font_name}."}";

0 commit comments

Comments
 (0)