Re: Getting errors during security(8) maintenance

2015-03-27 Thread sven falempin
On Fri, Mar 27, 2015 at 8:41 AM, Ingo Schwarze schwa...@usta.de wrote:

 Hi Denis,

 Denis Lapshin wrote on Thu, Mar 26, 2015 at 11:33:16AM +0300:

  Some time ago start getting errors after nightly Secutiry running:
 
  Use of uninitialized value $home in concatenation (.)
  or string at /usr/libexec/security line 356.

 Fixed in -current, thanks for reporting.

 Regarding the corrupted file /etc/passwd on your machine,
 use vipw(8) in the way i explained before.

 Note that 5.4 is old and no longer supported.

 Yours,
   Ingo


good morning


my $homes = find_homes;
check_rhosts_owner @$_ foreach @$homes;

I am not sure about perl internal but aren 't you playing too much from @
to \@ lol


why not check_homes(sub {
  check_rhosts_content @_;
  check whaterver you want on passwd;
});

Just leaving that here:

#!/usr/bin/perl


use strict;
use v5.10;
use Data::Dumper;



sub whatever {
  open my $fh, '', $ARGV[0] or die 'oops'.$!;
  my @passwd = map [ @{[split /:/]}[0,2,5] ], $fh;

  my @homes = grep {
$_[0]($_);
  } @passwd;

  return \@homes;
}

my $check_home = sub {
  say Dumper($_) ;
  unless ( -d $_-[ 2 ] ) {
warn $_-[ 2 ].' is not existing, so what ? ';
return;
  }
  return 1;
};

say Dumper(whatever($check_home));


-- 
-
() ascii ribbon campaign - against html e-mail
/\



Re: Getting errors during security(8) maintenance

2015-03-27 Thread Ingo Schwarze
Hi Denis,

Denis Lapshin wrote on Thu, Mar 26, 2015 at 11:33:16AM +0300:

 Some time ago start getting errors after nightly Secutiry running:

 Use of uninitialized value $home in concatenation (.)
 or string at /usr/libexec/security line 356.

Fixed in -current, thanks for reporting.

Regarding the corrupted file /etc/passwd on your machine,
use vipw(8) in the way i explained before.

Note that 5.4 is old and no longer supported.

Yours,
  Ingo



Re: Getting errors during security(8) maintenance

2015-03-27 Thread Ingo Schwarze
Hi Sven,

sven falempin wrote on Fri, Mar 27, 2015 at 09:02:09AM -0400:

 I am not sure about perl internal but aren 't you playing
 too much from @ to \@ lol

Your patch doesn't apply, and from the code snippets you are
throwing at me, i neither understand what you consider defective
nor what you want to improve.

Note: One of the worst weaknesses of Perl is that there is
more than one way to do it.

Yours,
  Ingo



Getting errors during security(8) maintenance

2015-03-26 Thread Denis Lapshin
Some time ago start getting errors after nightly Secutiry running:

What problem can be?

Running security(8):

Checking root sh paths, umask values:
/etc/profile /root/.profile
The root path includes .
Use of uninitialized value $home in concatenation (.) or string at 
/usr/libexec/security line 356.
Use of uninitialized value $home in concatenation (.) or string at 
/usr/libexec/security line 356.
Use of uninitialized value $home in concatenation (.) or string at 
/usr/libexec/security line 369.
Use of uninitialized value $home in concatenation (.) or string at 
/usr/libexec/security line 369.
Use of uninitialized value $home in -d at /usr/libexec/security line 386.
Use of uninitialized value $home in concatenation (.) or string at 
/usr/libexec/security line 406.
Use of uninitialized value $home in concatenation (.) or string at 
/usr/libexec/security line 406.
Use of uninitialized value $home in concatenation (.) or string at 
/usr/libexec/security line 406.
Use of uninitialized value $home in concatenation (.) or string at 
/usr/libexec/security line 406.
Use of uninitialized value $home in concatenation (.) or string at 
/usr/libexec/security line 406.
Use of uninitialized value $home in concatenation (.) or string at 
/usr/libexec/security line 406.
Use of uninitialized value $home in concatenation (.) or string at 
/usr/libexec/security line 406.
Use of uninitialized value $home in concatenation (.) or string at 
/usr/libexec/security line 406.
Use of uninitialized value $home in concatenation (.) or string at 
/usr/libexec/security line 406.
Use of uninitialized value $home in concatenation (.) or string at 
/usr/libexec/security line 406.
Use of uninitialized value $home in concatenation (.) or string at 
/usr/libexec/security line 434.
Use of uninitialized value $home in concatenation (.) or string at 
/usr/libexec/security line 434.
Use of uninitialized value $home in concatenation (.) or string at 
/usr/libexec/security line 434.
Use of uninitialized value $home in concatenation (.) or string at 
/usr/libexec/security line 434.

Thank you.

Denis



Re: Getting errors during security(8) maintenance

2015-03-26 Thread Nick Holland
On 03/26/15 04:32, Denis Lapshin wrote:
 Some time ago start getting errors after nightly Secutiry running:
 
 What problem can be?
 
 Running security(8):
 
 Checking root sh paths, umask values:
 /etc/profile /root/.profile
 The root path includes .

This would not be a bad thing to fix.

 Use of uninitialized value $home in concatenation (.) or string at 
 /usr/libexec/security line 356.
 Use of uninitialized value $home in concatenation (.) or string at 
 /usr/libexec/security line 356.
 Use of uninitialized value $home in concatenation (.) or string at 
 /usr/libexec/security line 369.
 Use of uninitialized value $home in concatenation (.) or string at 
 /usr/libexec/security line 369.
 Use of uninitialized value $home in -d at /usr/libexec/security line 386.
 Use of uninitialized value $home in concatenation (.) or string at 
 /usr/libexec/security line 406.
 Use of uninitialized value $home in concatenation (.) or string at 
 /usr/libexec/security line 406.
 Use of uninitialized value $home in concatenation (.) or string at 
 /usr/libexec/security line 406.
 Use of uninitialized value $home in concatenation (.) or string at 
 /usr/libexec/security line 406.
 Use of uninitialized value $home in concatenation (.) or string at 
 /usr/libexec/security line 406.
 Use of uninitialized value $home in concatenation (.) or string at 
 /usr/libexec/security line 406.
 Use of uninitialized value $home in concatenation (.) or string at 
 /usr/libexec/security line 406.
 Use of uninitialized value $home in concatenation (.) or string at 
 /usr/libexec/security line 406.
 Use of uninitialized value $home in concatenation (.) or string at 
 /usr/libexec/security line 406.
 Use of uninitialized value $home in concatenation (.) or string at 
 /usr/libexec/security line 406.
 Use of uninitialized value $home in concatenation (.) or string at 
 /usr/libexec/security line 434.
 Use of uninitialized value $home in concatenation (.) or string at 
 /usr/libexec/security line 434.
 Use of uninitialized value $home in concatenation (.) or string at 
 /usr/libexec/security line 434.
 Use of uninitialized value $home in concatenation (.) or string at 
 /usr/libexec/security line 434.

Stunning lack of information, but sounds like you botched an upgrade
somewhere.

Nick.



Re: Getting errors during security(8) maintenance

2015-03-26 Thread Denis Lapshin

I forgot to say, this happens on OpenBSD 5.4.

Where is no any changes has been made in the system before. No upgrade etc.

Please ask for more information if its help.

What I have to check to fix this?

Thanks

Denis

On 26.03.2015 14:40, Nick Holland wrote:

On 03/26/15 04:32, Denis Lapshin wrote:

Some time ago start getting errors after nightly Secutiry running:

What problem can be?

Running security(8):

Checking root sh paths, umask values:
/etc/profile /root/.profile
The root path includes .

This would not be a bad thing to fix.


Use of uninitialized value $home in concatenation (.) or string at 
/usr/libexec/security line 356.
Use of uninitialized value $home in concatenation (.) or string at 
/usr/libexec/security line 356.
Use of uninitialized value $home in concatenation (.) or string at 
/usr/libexec/security line 369.
Use of uninitialized value $home in concatenation (.) or string at 
/usr/libexec/security line 369.
Use of uninitialized value $home in -d at /usr/libexec/security line 386.
Use of uninitialized value $home in concatenation (.) or string at 
/usr/libexec/security line 406.
Use of uninitialized value $home in concatenation (.) or string at 
/usr/libexec/security line 406.
Use of uninitialized value $home in concatenation (.) or string at 
/usr/libexec/security line 406.
Use of uninitialized value $home in concatenation (.) or string at 
/usr/libexec/security line 406.
Use of uninitialized value $home in concatenation (.) or string at 
/usr/libexec/security line 406.
Use of uninitialized value $home in concatenation (.) or string at 
/usr/libexec/security line 406.
Use of uninitialized value $home in concatenation (.) or string at 
/usr/libexec/security line 406.
Use of uninitialized value $home in concatenation (.) or string at 
/usr/libexec/security line 406.
Use of uninitialized value $home in concatenation (.) or string at 
/usr/libexec/security line 406.
Use of uninitialized value $home in concatenation (.) or string at 
/usr/libexec/security line 406.
Use of uninitialized value $home in concatenation (.) or string at 
/usr/libexec/security line 434.
Use of uninitialized value $home in concatenation (.) or string at 
/usr/libexec/security line 434.
Use of uninitialized value $home in concatenation (.) or string at 
/usr/libexec/security line 434.
Use of uninitialized value $home in concatenation (.) or string at 
/usr/libexec/security line 434.

Stunning lack of information, but sounds like you botched an upgrade
somewhere.

Nick.



--
Denis Lapshin
mailto: den...@mindall.org



Re: Getting errors during security(8) maintenance

2015-03-26 Thread Andrew Fresh
On Thu, Mar 26, 2015 at 03:42:07PM +0100, Ingo Schwarze wrote:
 Hi Andrew (or any other developer),
 
 OK to commit the following fix?
 
 Note that chomping after splitting is important because split
 drops trailing empty fields.

A blank home_dir is valid?  I will defer to others on that but seems
surprising to me.

Although I haven't had time to apply the patch and try it, the
implementation looks sane given that above is as expected.

OK afresh1@ 


 Index: security
 ===
 RCS file: /cvs/src/libexec/security/security,v
 retrieving revision 1.32
 diff -u -p -r1.32 security
 --- security  4 Dec 2014 00:07:21 -   1.32
 +++ security  26 Mar 2015 14:23:53 -
 @@ -336,7 +336,16 @@ sub find_homes {
   nag !(open my $fh, '', $filename),
   open: $filename: $!
   and return [];
 - my $homes = [ map [ @{[split /:/]}[0,2,5] ], $fh ];
 + my $homes = [];
 + while ($fh) {
 + my $entry = [ @{[split /:/]}[0,2,5] ];
 + chomp;
 + nag !defined $entry-[2],
 + Incomplete line \$_\ in $filename.
 + and next;
 + chomp $entry-[2];
 + push @$homes, $entry;
 + }
   close $fh;
   return $homes;
  }

-- 
andrew - http://afresh1.com

Unix is very simple,
but it takes a genius to understand the simplicity.
  -- Dennis Ritchie



Re: Getting errors during security(8) maintenance

2015-03-26 Thread Ingo Schwarze
Hi Andrew,

Andrew Fresh wrote on Thu, Mar 26, 2015 at 01:12:39PM -0700:
 On Thu, Mar 26, 2015 at 03:42:07PM +0100, Ingo Schwarze wrote:

 Hi Andrew (or any other developer),
 
 OK to commit the following fix?
 
 Note that chomping after splitting is important because split
 drops trailing empty fields.

 A blank home_dir is valid?

Certainly not in general, but it does occur in the +:*:0:0:::
YP entry.

 I will defer to others on that but seems surprising to me.

In case we want security(8) to catch that, the right function
to do so would be check_passwd(), not find_homes().
But i would consider that a separate matter.

 Although I haven't had time to apply the patch and try it, the
 implementation looks sane given that above is as expected.
 
 OK afresh1@ 

Thanks for checking!
  Ingo

 Index: security
 ===
 RCS file: /cvs/src/libexec/security/security,v
 retrieving revision 1.32
 diff -u -p -r1.32 security
 --- security 4 Dec 2014 00:07:21 -   1.32
 +++ security 26 Mar 2015 14:23:53 -
 @@ -336,7 +336,16 @@ sub find_homes {
  nag !(open my $fh, '', $filename),
  open: $filename: $!
  and return [];
 -my $homes = [ map [ @{[split /:/]}[0,2,5] ], $fh ];
 +my $homes = [];
 +while ($fh) {
 +my $entry = [ @{[split /:/]}[0,2,5] ];
 +chomp;
 +nag !defined $entry-[2],
 +Incomplete line \$_\ in $filename.
 +and next;
 +chomp $entry-[2];
 +push @$homes, $entry;
 +}
  close $fh;
  return $homes;
  }



Re: Getting errors during security(8) maintenance

2015-03-26 Thread Ingo Schwarze
Hi Andrew (or any other developer),

OK to commit the following fix?

Note that chomping after splitting is important because split
drops trailing empty fields.


Hi Denis,

Denis Lapshin wrote on Thu, Mar 26, 2015 at 11:33:16AM +0300:

 Some time ago start getting errors after nightly Secutiry running:
 What problem can be?

Your file /etc/passwd contains two incomplete entries.
Never edit it by hand.  Always use vipw(8) to change
user account information.

Please apply the following patch to the file /usr/libexec/security,
run sh /etc/daily (both as root) and report back whether the
error messages you get then make more sense to you.

After that, to repair the damage, run vipw(8), do some trivial
change - like adding a letter to the full name field of some entry
- and try to save and exit vipw(8).  If it works, great (and if you
want, revert the trivial change, using vipw(8) again).  If it denies
saving, your master.passwd(5) file is corrupt, too.  In that case,
choose re-edit and fix whatever problems it reports.

Btw., Nick is right that in general, you should note in problem reports
which version of OpenBSD you are running, it's mere luck that it doesn't
matters in the case at hand.

Yours,
  Ingo

 Use of uninitialized value $home in concatenation (.) or string
 at /usr/libexec/security line 356.


Index: security
===
RCS file: /cvs/src/libexec/security/security,v
retrieving revision 1.32
diff -u -p -r1.32 security
--- security4 Dec 2014 00:07:21 -   1.32
+++ security26 Mar 2015 14:23:53 -
@@ -336,7 +336,16 @@ sub find_homes {
nag !(open my $fh, '', $filename),
open: $filename: $!
and return [];
-   my $homes = [ map [ @{[split /:/]}[0,2,5] ], $fh ];
+   my $homes = [];
+   while ($fh) {
+   my $entry = [ @{[split /:/]}[0,2,5] ];
+   chomp;
+   nag !defined $entry-[2],
+   Incomplete line \$_\ in $filename.
+   and next;
+   chomp $entry-[2];
+   push @$homes, $entry;
+   }
close $fh;
return $homes;
 }