And THERE is quite a loop. The surveillance is of foreign agents, with specific recognition in the cited law as not needing warrants. Excluding it because they happen to call people in the U.S. from time to time is silly.
Anyways, the President is authorized and empowered by the Constitution to be the CINC. Inerent in executing this duty is collecting military information. Again, the gray area is not in collecting the information for military and diplomatic intelligence purposes. It is not a civil or criminal prosecution, nor abusing collection resources for politics.