Exemplo n.º 1
0
static int processDelete(FirewallParams *firewallParams) {
	StringBuilder strBuilder;
	int ruleIndex = findRuleIndex(firewallParams);
	int status = 0;

	// Delete the iptables firewall rule if it exists
	if (ruleIndex >= 0) {
		c598a24c_initStringBuilder(&strBuilder);

		// Build the iptables command-line
		c598a24c_append_string(&strBuilder, "/sbin/iptables -t ");
		c598a24c_append_string(&strBuilder, firewallParams->tableName);
		c598a24c_append_string(&strBuilder, " -D ");
		c598a24c_append_string(&strBuilder, firewallParams->chainName);
		c598a24c_append_char(&strBuilder, ' ');
		c598a24c_append_int(&strBuilder, ruleIndex);

		// Delete the iptables firewall rule
		status = system(strBuilder.buffer);
	} else {
		c7c88e52_printNotice("Rule does not exist");
	}

	return status;
}
Exemplo n.º 2
0
void WebKitCSSKeyframesRule::deleteRule(const String& s)
{
    int i = findRuleIndex(s);
    if (i < 0)
        return;

    WebKitCSSKeyframeRule* rule = item(i);
    if (CSSMutableStyleDeclaration* style = rule->style())
        style->setParentRule(0);

    rule->setParentRule(0);
    m_lstCSSRules->deleteRule(i);
}
Exemplo n.º 3
0
static int processAdd(FirewallParams *firewallParams) {
	StringBuilder strBuilder;
	int ruleIndex = findRuleIndex(firewallParams);
	int status = 0;

	// Insert the iptables firewall rule if it does not already exist
	if (ruleIndex < 0) {
		c598a24c_initStringBuilder(&strBuilder);

		// Build the iptables command-line
		c598a24c_append_string(&strBuilder, "/sbin/iptables -t ");
		c598a24c_append_string(&strBuilder, firewallParams->tableName);
		c598a24c_append_string(&strBuilder, " -I ");
		c598a24c_append_string(&strBuilder, firewallParams->chainName);
		c598a24c_append_char(&strBuilder, ' ');
		c598a24c_append_uint(&strBuilder, firewallParams->ruleList.length - 2);
		c598a24c_append_string(&strBuilder, " -p ");

		if (firewallParams->protocol == TCP) {
			c598a24c_append_string(&strBuilder, "tcp");
		} else {
			c598a24c_append_string(&strBuilder, "udp");
		}

		c598a24c_append_string(&strBuilder, " -m ");

		if (firewallParams->protocol == TCP) {
			c598a24c_append_string(&strBuilder, "tcp");
		} else {
			c598a24c_append_string(&strBuilder, "udp");
		}

		if (firewallParams->portType == SOURCE) {
			c598a24c_append_string(&strBuilder, " --sport ");
		} else {
			c598a24c_append_string(&strBuilder, " --dport ");
		}

		c598a24c_append_int(&strBuilder, firewallParams->portNumber);

		c598a24c_append_string(&strBuilder, " -j ");
		c598a24c_append_string(&strBuilder, firewallParams->ruleAction);

		// Insert the iptables firewall rule
		status = system(strBuilder.buffer);
	} else {
		c7c88e52_printNotice("Rule already exists");
	}

	return status;
}
WebKitCSSKeyframeRule* WebKitCSSKeyframesRule::findRule(const String& s)
{
    int i = findRuleIndex(s);
    return (i >= 0) ? item(i) : 0;
}
void WebKitCSSKeyframesRule::deleteRule(const String& s)
{
    int i = findRuleIndex(s);
    if (i >= 0)
        m_lstCSSRules.get()->deleteRule(i);
}