This file is indexed.

/usr/share/perl5/Rex/User/OpenWrt.pm is in rex 1.4.1-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
#
# (c) Jan Gehring <jan.gehring@gmail.com>
#
# vim: set ts=2 sw=2 tw=0:
# vim: set expandtab:

package Rex::User::OpenWrt;

use strict;
use warnings;

our $VERSION = '1.4.1'; # VERSION

use Rex::Logger;
require Rex::Commands;
use Rex::Commands::Run;
use Rex::Helper::Run;
use Rex::Commands::Fs;
use Rex::Interface::File;
use Rex::Interface::Fs;
use Rex::Interface::Exec;
use Rex::Helper::Path;

use Rex::User::Linux;
use base qw(Rex::User::Linux);

sub new {
  my $that  = shift;
  my $proto = ref($that) || $that;
  my $self  = $proto->SUPER::new(@_);

  bless( $self, $proto );

  return $self;
}

sub get_user {
  my ( $self, $user ) = @_;

  Rex::Logger::debug("Getting information for $user");
  my $o_data = i_run "perl -e 'print join(\";\", getpwnam(\"$user\"))'";
  chomp $o_data;
  my @data = split( /;/, $o_data );

  return (
    name     => $data[0],
    password => $data[1],
    uid      => $data[2],
    gid      => $data[3],
    comment  => $data[6],
    home     => $data[7],
    shell    => $data[8],
  );
}

sub user_groups {
  my ( $self, $user ) = @_;

  Rex::Logger::debug("Getting group membership of $user");

  my $data_str = i_run "/usr/bin/id -Gn $user";
  if ( $? != 0 ) {
    die("Error getting group list");
  }

  my $wantarray = wantarray();

  if ( defined $wantarray && !$wantarray ) {

    # arrayref
    return [ split( / /, $data_str ) ];
  }

  return split( / /, $data_str );
}

sub user_list {
  my $self = shift;

  Rex::Logger::debug("Getting user list");

  my $data_str = i_run "cut -d':' -f1 /etc/passwd";
  if ( $? != 0 ) {
    die("Error getting user list");
  }

  return split( /\n/, $data_str );
}

1;