How can one accomplish the V-ray material wrapper matte surface in cycles?

I posted earlier about this problem but now I have a solution from vray to compare it to. The V-ray material wrapper has a matte surface options that allows you to just render shadows from other objects but does not render the meshes own shadows. I have been accomplishing this by dividing two passes of the shadow geometry, one with foreground objects and one with out. The final image was one without unnecessary shadows but this doubles render times. Any solutions with material nodes?