#! /bin/sh
sed -i -e 's/if (\!error \&\& (ia_valid \& (ATTR_UID | ATTR_GID))) error = CheckCapabilityACL(TOMOYO_SYS_CHOWN);/if (\!error \&\& (ia_valid \& (ATTR_UID | ATTR_GID)) \&\& CheckCapabilityACL(TOMOYO_SYS_CHOWN)) error = -EPERM;/' -e 's/if (\!error \&\& (ia_valid \& ATTR_MODE)) error = CheckCapabilityACL(TOMOYO_SYS_CHMOD);/if (\!error \&\& (ia_valid \& ATTR_MODE) \&\& CheckCapabilityACL(TOMOYO_SYS_CHMOD)) error = -EPERM;/' -e 's/if (sig \&\& CheckCapabilityACL(TOMOYO_SYS_KILL) < 0) return -EPERM;/if (sig \&\& CheckCapabilityACL(TOMOYO_SYS_KILL)) return -EPERM;/' -e 's/if (CheckCapabilityACL(TOMOYO_SYS_IOCTL) < 0) return -EPERM;/if (CheckCapabilityACL(TOMOYO_SYS_IOCTL)) return -EPERM;/' -e 's/if ((error = CheckCapabilityACL(TOMOYO_SYS_IOCTL)) < 0) goto out;/if (CheckCapabilityACL(TOMOYO_SYS_IOCTL)) { error = -EPERM; goto out; }/' -e 's/if (CheckCapabilityACL(TOMOYO_SYS_VHANGUP) == 0)/if (CheckCapabilityACL(TOMOYO_SYS_VHANGUP)) return -EPERM;/' -e 's/if ((error = CheckCapabilityACL(TOMOYO_SYS_IOCTL)) < 0) break;/if (CheckCapabilityACL(TOMOYO_SYS_IOCTL)) { error = -EPERM; break; }/' -e 's/if ((error = CheckCapabilityACL(TOMOYO_SYS_IOCTL)) < 0) goto out_fput;/if (CheckCapabilityACL(TOMOYO_SYS_IOCTL)) { error = -EPERM; goto out_fput; }/' -- patches/ccs-patch-*.diff
sed -i -e 's:CheckChRootPermission:ccs_check_chroot_permission:g' -e 's:SAKURA_MayUmount:ccs_may_umount:g' -e 's:SAKURA_MayMount:ccs_may_mount:g' -e 's:CheckMountPermission:ccs_check_mount_permission:g' -e 's:CheckPivotRootPermission:ccs_check_pivot_root_permission:g' -e 's:SAKURA_MayAutobind:ccs_may_autobind:g' -e 's:CheckSingleWritePermission:ccs_check_1path_perm:g' -e 's:CheckDoubleWritePermission:ccs_check_2path_perm:g' -e 's:CheckFilePerm:ccs_check_file_perm:g' -e 's:CheckSignalACL:ccs_check_signal_acl:g' -e 's:CheckOpenPermission:ccs_check_open_permission:g' -e 's:CheckReWritePermission:ccs_check_rewrite_permission:g' -e 's:CheckSocketSendMsgPermission:ccs_socket_sendmsg_permission:g' -e 's:CheckSocketCreatePermission:ccs_socket_create_permission:g' -e 's:CheckSocketBindPermission:ccs_socket_bind_permission:g' -e 's:CheckSocketListenPermission:ccs_socket_listen_permission:g' -e 's:CheckSocketAcceptPermission:ccs_socket_accept_permission:g' -e 's:CheckSocketConnectPermission:ccs_socket_connect_permission:g' -e 's:CheckSocketRecvDatagramPermission:ccs_socket_recv_datagram_permission:g' -e 's:CheckCapabilityACL:\!ccs_capable:g' -- patches/ccs-patch-*.diff
