The San Francisco 49ers announced they have signed defensive lineman Glenn Dorsey to a two-year contract.