int sftp_tap_set_policy(const char *policy) { register unsigned int i; if (tap_pool) { /* Special case: IFF the existing policy is 'none' AND the given * policy is 'rogaway', just return. The 'none' policy must have been * explicitly configured, and it should override the automatic use of * the 'rogaway' policy. */ if (strncmp(curr_policy.policy, "none", 5) == 0 && strncasecmp(policy, "rogaway", 8) == 0) { (void) pr_log_writefile(sftp_logfd, MOD_SFTP_VERSION, "'none' traffic policy explicitly configured, ignoring '%s' policy", policy); return 0; } destroy_pool(tap_pool); if (tap_timerno > 0) { pr_timer_remove(tap_timerno, &sftp_module); tap_timerno = -1; } } tap_pool = make_sub_pool(sftp_pool); pr_pool_tag(tap_pool, "SFTP TAP Pool"); memset(&curr_policy, 0, sizeof(struct sftp_tap_policy)); for (i = 0; tap_policies[i].policy; i++) { if (strcasecmp(tap_policies[i].policy, policy) == 0) { copy_policy(&curr_policy, &(tap_policies[i])); set_policy_chance(&curr_policy); set_policy_timer(&curr_policy); return 0; } } errno = ENOENT; return -1; }
/// Constructor accepting the segment to adapt explicit segment_view(Segment const& segment) : detail::points_view<point_type, 2>(copy_policy(segment)) {}