The trial court did not impose an unauthorized sentence by holding the defendant to an agreement to waive credit for time served during the period between his arrest and the revocation of his probation. The court told defendant, who had a long standing drug problem, that it would grant probation conditioned upon his completion of a residential drug program, but only if he agreed to waive all credits for time served prior to and while enrolled in the program. Defendant agreed without argument or objection. He left the program after two days. He was later sentenced to the maximum term (which had been imposed with the earlier grant of probation).