In response to Mahmoud Ahmadinejad's speech at the UN, Barack Obama says in a statement released by his campaign that he's disappointed Ahmadinejad was allowed to speak (emphasis mine):

"I strongly condemn President Ahmadinejad's outrageous remarks at the United Nations, and am disappointed that he had a platform to air his hateful and anti-Semitic views. The threat from Iran's nuclear program is grave. Now is the time for Americans to unite on behalf of the strong sanctions that are needed to increase pressure on the Iranian regime. "Once again, I call upon Senator McCain to join me in supporting a bipartisan bill to increase pressure on the Iranian regime by allowing states and private companies to divest from companies doing business in Iran. The security of our ally Israel is too important to play partisan politics, and it is deeply disappointing that Senator McCain and a few of his allies in Congress feel otherwise," said Senator Barack Obama.

But Obama supported Ahmadinejad's right to speak at the UN in September 2007:

The other point I'd make about President Ahmadinejad's presence here in New York is that although I probably would not have invited him to speak [at Columbia]--he's got other forums, he's got the United Nations available to him--hateful lies that he may utter about Israel or the Holocaust, the answer to those lies is for us to promote the truth and show the world the kind of values and ideals that we hold dear. ... We don't need to be fearful of the rantings of somebody like Ahmadinejad.

Asked by a reporter why he wouldn't have invited Ahmadinejad to speak at Columbia University, Obama said: "Because he has other forums in which to speak. He's here for the United Nations meeting. He's going to get ample publicity." You can watch the September 2007 press conference here:

What exactly has changed that led to Obama to shift his position--besides the fact that he is now running in the general election instead of the Democratic primary?
Update: The McCain-Palin campaign responds:

"Barack Obama has the gall today to express 'disappointment' that Mahmoud Ahmadinejad had 'a platform to air his hateful and anti-Semitic views.' It is Barack Obama who would give him the greatest platform of all, an unconditional summit with the President of the United States. Barack Obama's reckless determination to meet with a man who believes our Israeli friends are ‘Zionist murderers' undermines our nation's allies and demonstrates a frightening lack of judgment. "While Senator McCain and Governor Palin will work with our allies to contain and eliminate the threat from Iran, Barack Obama has pledged to meet with this country's most dangerous enemies, including Mahmoud Ahmadinejad, without preconditions. The American people have a right to know precisely what additional concessions Barack Obama plans to make. What they don't need is a lecture on getting tough with Iran from the man who railed against bipartisan legislation labeling the Iranian Revolutionary Guard a terrorist organization." --McCain-Palin spokesman Michael Goldfarb