This file is indexed.

/usr/share/perl5/SyncUtil/localHash.pm is in syncbbdb 2.3-6.2.

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
 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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
#------------------------------------------------------------------------------
#   $Date: 2000/08/27 15:16:02 $
#   RCS: $Id: localHash.pm,v 1.6 2000/08/27 15:16:02 tdeweese Exp $
#------------------------------------------------------------------------------

package localHash;

use strict;
use FileHandle;

sub new {
  my $type = shift;
  my $self =	{};
  
  bless ($self, $type);
  $self->{'host'}     = shift;
  $self->{'hashFile'} = shift;
  $self->{'syncTime'} = undef;
  $self->{'ok'}       = 0;

  $self->{'last-time'}    = 0;

  if (!$self->{'hashFile'}) {
    $self->{'hashFile'} = ($self->{'host'}->getUserName() . "_" .
			   $self->{'host'}->getUserID());
    $self->{'hashFile'} =~ s/\s+/_/g;
    $self->{'hashFile'} = ($self->{'host'}->getConduitDir() . "/ids." . 
			   $self->{'hashFile'});
			   
    $self->{'host'}->output($self->{'hashFile'} . "\n");
  }

  $self->readHash();
  $self;
}

sub finish {
  my $self = shift;
  $self->syncDate($self->{'host'}->{'info'}->{'thisSyncDate'});
  $self->writeHash();
}

sub readHash{
  my $self=shift;
  
  ## Load Pilot Hash's this lets us know if a pilot entry is new or
  ## if the record was deleted from BBDB.
  my $hashFile = new FileHandle($self->{'hashFile'});
  
  if ($hashFile)
    {
      $self->{'ok'} = 1;

      my $first = 1;
      while (<$hashFile>) {
	my ($id, $local_hash, $pilot_hash) = split(" ",$_);
	if ($first) {
	    $first = 0;
	    if ((!defined($local_hash) || !$local_hash) && 
		(!defined($pilot_hash) || !$pilot_hash)) {
		$self->syncDate($id);
		next;
	    } else {
		# Don't use 0 since PilotMgr uses that for forcing a sync
		$self->syncDate(1234);
	    }
	}
	$local_hash = undef if ($local_hash =~ m/<undef>/);
	$pilot_hash = undef if ($pilot_hash =~ m/<undef>/);

	$self->{'ids'}{$id} = [$local_hash, $pilot_hash];

	$self->update();
      }
      undef $hashFile;
    }
}

sub writeHash {
  my $self = shift;

  my $hashFile = new FileHandle(">$self->{'hashFile'}");
  if ($hashFile) 
  {
      if (defined $self->{'syncTime'}) {
	  print $hashFile $self->{'syncTime'} . "\n";
      }

      foreach my $id (keys(%{$self->{'ids'}})) {
	my ($local_hash, $pilot_hash) = @{$self->{'ids'}{$id}};
	next if ((!defined $local_hash) && (!defined $pilot_hash));
	$local_hash = "<undef>" if (!defined $local_hash);
	$pilot_hash = "<undef>" if (!defined $pilot_hash);
	print $hashFile $id . " " . $local_hash . " " . $pilot_hash . "\n";
      }

      undef $hashFile;
    } else {
      warn ("Unable to write Pilot ID's file: $self->{'hashFile'}\n"  .
	    "This will really screw up your next sync!!!\n" .
	    "It will think that all of your records on the pilot are new!");
    }
}

sub getNumIds {
    my $self = shift;
    return scalar(keys %{$self->{'ids'}});
}

sub getPilotHash {
  my $self = shift;
  my $id   = shift;
  return undef if (! defined $self->{'ids'}{$id});
  my ($local_hash, $pilot_hash) = @{$self->{'ids'}{$id}};
  return $pilot_hash;
}

sub getLocalHash {
  my $self = shift;
  my $id   = shift;
  return undef if (! defined $self->{'ids'}{$id});
  my ($local_hash, $pilot_hash) = @{$self->{'ids'}{$id}};
  return $local_hash;
}

sub setPilotHash {
  my $self = shift;
  my $id  = shift;
  my $val  = shift;
  my $local_hash = $self->getLocalHash($id);

  if ((!defined $local_hash) && (!defined $val)) {
    delete $self->{'ids'}{$id};
  } else {
    $self->{'ids'}{$id} = [$local_hash, $val];
  }
}

sub setLocalHash {
  my $self = shift;
  my $id  = shift;
  my $val  = shift;
  my $pilot_hash = $self->getPilotHash($id);

  if ((!defined $pilot_hash) && (!defined $val)) {
    delete $self->{'ids'}{$id};
  } else {
    $self->{'ids'}{$id} = [$val, $pilot_hash];
  }
}

sub syncDate {
  my $self    = shift;
  my $newDate = shift;

  if (defined $newDate) {
    $self->{'syncTime'} = $newDate;
  }

  return $self->{'syncTime'}
}

sub update {
  my $self = shift;
  my $ctime = time();
  # at least once a second give host some time...
  if ($self->{'last-time'} != $ctime)
    {
      $self->{'host'}->update();
      $self->{'last-time'} = $ctime;
    }
}

1;