ACK changing this. But I believe the only other line of code you need for this patch is one additional RPCTypeCheck right here:

    RPCTypeCheck(prevOut, map_list_of("redeemScript",str_type), true);

The rest of the existing code should then Do The Right Thing.  The third arg to RPCTypeCheck will make redeemScript optional...