One of five precepts states that one is to refrain from sexual misconduct or, more accurately, one is to refrain from indulging in sexual pleasure. Most Buddhist schools construe this to means that monks and nuns are to practice celibacy. Anal sex falls into this prohibition along with other sexual behaviour.
For laypersons, this precept mainly applies to adultery. However, wide ranges of interpretations are possible about what exactly consititutes "sexual misconduct" and therefore the different schools of Buddhism - or even different individual monks - at different periods of time have offered varying opinions.
It is common to see condemnation of homosexual behaviour by Buddhists in more traditional societies in Asia. However, there is no explicit scriptural basis upon which homosexuality is to be condemned. Therefore, there is no definite Buddhist view on homosexuality except to say that celibacy is ideal.
It is worth noting that the Dalai Lama, while somewhat ambiguous on certain terms of homosexuality, has openly campaigned for and supported equal rights for homosexuals.
External links
Homosexuality and Theravada Buddhism (http://www.buddhanet.net/homosexu.htm)
The views on homosexuality in the history of Buddhism have often varied with different cultures and social circumstances, just as the views on war and monastic ideas have.
Buddhists will agree that homosexual orientation is determined prior to birth, but that doesn't mean the homosexual is off the hook.
Homosexuals were thus problematic for both groups and rules were set forth curtailing their behavior insofar as they wished to be associated with the Buddhist community.
Note that homosexuality, as a psychological disposition, is not technically against the Sharia, which governs the physical actions, and not the inner thoughts and feelings.
In Saudi Arabia, homosexuals may be killed for their practices, although in practise this is not usually done unless the state perceives a threat to its power http://www.sodomylaws.org/world/saudi_arabia/saudinews19.htm.
In Afghanistan at least 10 homosexuals are known to have been executed for their sexual conduct by the Taliban.