html-match-db — controls databases of HTML form values used by the generic data matching module
html-match-db
-h
{ -a
| -d
| -s
| -l
} db_file
html-match-db
-r
{ -a
| -A
| -d
| -D
| -s
| -l
| -n
} db_file
html-match-db
-r
{ -k
| -e
}
Utility html-match-db is used to manage database files used by the generic data matching and processing module, see also data-matching(7). It provides functions for adding, deleting, searching, and listing records in a database file. All accesses to a database are properly locked, therefore html-match-db can be executed while the database file is used by a proxy.
-h
The provided database file is expected to be
a database used by the html-hash
and
html-alert
tests of the data matching
module.
-r
The provided database file is expected to be
a database used by the html-replace
test.
-a
Adds a new record to the database. If used
together with -h
, a single line from the input is
read, its hash computed and stored in the
database. If used with -r
, the input contains
lines corresponding to the values expected in an HTML form (the
original values), followed by the same number of lines with
the replacement values.
-A
Adds a new record to the HTML form replacement
database. It expects two lines of input with the database key
and encrypted value in the hexadecimal format as displayed by
options -k
and -e
,
respectively.
-d
Deletes a record from the database. If used with
-h
, the value to be deleted is expected on
a single input line. If used with -r
,
a sequence of input lines contains the original form values.
The corresponding encrypted replacement values are deleted
from the database.
-D
Deletes a record from the HTML form
replacement database. It expects a single input line with the
database key in the format as displayed by option
-k
.
-s
Searches the database for a record. Together
with option -h
, it reads a single input line
containing the value to be searched for and terminates with
zero exit code if the corresponding hash is found in the
database, or returns a nonzero exit code
otherwise. Together with -r
, it reads
a sequence of input lines containing the original form values
and displays the same number of lines with the replacement
values.
-l
Lists all records from the database, either
individual lines containing stored hashes of values for option
-h
, or pairs of lines containing keys and
corresponding encrypted values in format as displayed by
options -k
and -e
.
-n
Reports the number of records in the database.
-k
Reads a sequence of input lines containing the original form values and displays the corresponding database key obtained by hashing the input values.
-e
Reads a sequence of input lines corresponding to the original values, followed by the same number of lines with the replacement values. It then displays the encrypted database value, i.e., the replacement values encrypted by a key constructed from the original values.
db_file
Name of the database file.
The program returns exit code 0 if a record has been
successfully added, deleted, or found, or if options
-k
or -e
have been specified. Exit
code 1 is returned if a record cannot be added because the maximum number
of records permitted by the product license has been reached, or if
a record cannot be found in search and delete operations. Exit code
2 is returned if the program fails, for example, if it cannot access
the specified database file.