  In this paper we compute rest-frame extinctions for the afterglows of a
sample of gamma-ray bursts complete in redshift. The selection criteria of the
sample are based on observational high-energy parameters of the prompt emission
and therefore our sample should not be biased against dusty sight-lines. It is
therefore expected that our inferences hold for the general population of
gamma-ray bursts. Our main result is that the optical/near-infrared extinction
of gamma-ray burst afterglows in our sample does not follow a single
distribution. 87% of the events are absorbed by less than 2 mag, and 50% suffer
from less than 0.3-0.4 mag extinction. The remaining 13% of the afterglows are
highly absorbed. The true percentage of gamma-ray burst afterglows showing high
absorption could be even higher since a fair fraction of the events without
reliable redshift measurement are probably part of this class. These events may
be due to highly dusty molecular clouds/star forming regions associated with
the gamma-ray burst progenitor or along the afterglow line of sight, and/or to
massive dusty host galaxies. No clear evolution in the dust extinction
properties is evident within the redshift range of our sample, although the
largest extinctions are at z~1.5-2, close to the expected peak of the star
formation rate. Those events classified as dark are characterized, on average,
by a higher extinction than typical events in the sample. A correlation between
optical/near-infrared extinction and hydrogen-equivalent column density based
on X-ray studies is shown although the observed NH appears to be well in excess
compared to those observed in the Local Group. Dust extinction does not seem to
correlate with GRB energetics or luminosity.
