First of all, make sure to think in more general terms than Division/Corps, think Unit/Stack
The benefit from the stack commander is larger than from a unit commander (5% per rating vs. 3% per rating). If a given general is both, only the stack benefit counts.
For a general to count for the unit, there needs to be a different guy commanding the stack AND the general must be integrated with the unit.
If an army stack contains an "aide-de-camp", i.e. a non-commanding general with a strategic rating of at least 4, the army stack and the subordinate stack gets +1 CP. Other "loose" generals also benfit CP, but there's a limit to how much CP a stack can (with some variations), but I'm not fully familiar with the exact numbers for that.
Some abilities, such as "artillery officer" (not sure about the name) and "pontoneer" are group abilities, which benefit the entire stack. Other, such as "sharpshooter" and "high morale", are unit abilities, which benefit just the unit that the leader/element is part of. I hope to add an overview of the abilities to the wiki, but haven't gotten that far yet.