This file is indexed.

/usr/share/doc/libperlmenu-perl/examples/ezpasswd is in libperlmenu-perl 4.0-5.

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

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
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
#!/usr/bin/perl
#**************************************************************************
# ezpasswd --  Full-screen data display template demo
#
# Notes:   Perl4 - Requires curseperl
#          Perl5 - Requires William Setzer's "Curses" extension
#
#          Demonstrates data display using templates (template file is
#          "ezp_template" in the current directory)
#
#          With a little work this program could be converted to a
#          full-screen /etc/passwd updater (left as an excercise for the
#          user).
#
# Author:  Steven L. Kunz
#          Networked Applications
#          Iowa State University Computation Center
#          Ames, IA  50011
#          Email: skunz@iastate.edu
#
# Date:    February 1997
#**************************************************************************

# Perl5+Curses ONLY!
# Comment these lines for use with Perl4/curseperl
BEGIN { $Curses::OldCurses = 1; }
use Curses;                     # PerlMenu needs "Curses"
use perlmenu;                   # Main menu package (Perl5 only)
require "./menuutil.pl";        # For "pause" and "print_nl" routines.

# Perl4/curseperl ONLY!
# Uncomment these lines for use with Perl4/curseperl
# (Did you remember to run "create_menu.pl"?)
#require "./menu.pl";           # Main menu package (Perl4 only)
#require "./menuutil.pl";       # For "pause" and "print_nl" routines.

$| = 1;				# Flush after every write to stdout

@input_data = ();	# Not really used (but still needed)
@display_data = ();	# Display data
@protect = ();		# Protection
$bell = "\007";		# Ascii bell character
$default = "";		# Default login for main loop

#
# Since we are not using menus in this example, we need to call "menu_init"
# to initialize the curses environment.  Not necessary if you have at
# least one menu display (which will include a menu_init) first.
#
&menu_init();

#
# Load the template from the data file (created with a text editor)
# Data entry fields denoted by underscores ("_") or back-slashes ("\");
#
if (&menu_load_template("./template_ezp")) {
  die "Cannot find \"template_ezp\"template file.\n";
}

#
# Set protected fields in this "display only" example.
#
$protect[0] = $protect[1] = $protect[2] = $protect[3] = 1;
$protect[4] = $protect[5] = $protect[6] = $protect[7] = 1;

#
# Main loop
#
while (1) {
  # Prompt for a /etc/passwd entry to display
  &top_title("PerlMenu 4.0");
  &print_nl("  Enter login to display from /etc/passwd",1);
  &print_nl("  Supply a null value to exit.",2);
  $prow = $row; $pcol = $col+2;
  $string = &menu_getstr($prow,$pcol,"Login: ",0,$default,8,0);
  last if ($string eq "");

  # Display entry (handle errors)
  if (!&display_entry($string)) {
    &new_line(1);
    &pause("  Login \"$string\" not found - Press any key to continue $bell");
    $default = $string;
  } else { $default = ""; }
}

#
# Clean up and go home.
#
&clear();
&refresh();
&endwin();
exit(0);

#***********
# DISPLAY_ENTRY -- Display an entry from the password file
#
# Arguments:	Login-id to display
#
# Returns:	Boolean flag (0=not there, 1=found it)
#***********
sub display_entry {
  local($seek) = @_;
  local($found_it) = 0;

  $i = 0;			# Record count
  open(PASSWD,"/etc/passwd");	# Where the BSD-style "passwd" file is
  while(<PASSWD>) {
    $i++;			# Count the record
    @display_data = split(":");	# Split fields
    next if ($display_data[0] ne $seek);
    $found_it = 1;
    unshift(display_data,$i);	# Insert line number

    # IMPORTANT: Note the use of pointers to arrays here
    &menu_display_template(*input_data,*display_data,*protect);
  }
  close(PASSWD);

  return($found_it);
}