static void delete_activity(struct pa_policy_context           *ctx,
                            struct pa_policy_activity_variable *variable)
{
    struct pa_policy_activity_variable *last;

    for (last = (struct pa_policy_activity_variable *)&ctx->activities;
         last->next != NULL;
         last = last->next) {

        if (last->next == variable) {
            last->next = variable->next;

            pa_xfree(variable->device);

            while (variable->active_rules != NULL)
                delete_rule(&variable->active_rules, variable->active_rules);
            while (variable->inactive_rules != NULL)
                delete_rule(&variable->inactive_rules, variable->inactive_rules);

            pa_xfree(variable);
            return;
        }
    }

    pa_log("%s(): confused with data structures: can't find activity variable",
           __FUNCTION__);
}
static void delete_variable(struct pa_policy_context          *ctx,
                            struct pa_policy_context_variable *variable)
{
    struct pa_policy_context_variable *last;
    
    for (last = (struct pa_policy_context_variable *)&ctx->variables;
         last->next != NULL;
         last = last->next)
    {
        if (last->next == variable) {
            last->next = variable->next;

#if 0
            pa_log_debug("delete context variable '%s'", variable->name);
#endif

            pa_xfree(variable->name);

            while (variable->rules != NULL)
                delete_rule(&variable->rules, variable->rules);

            pa_xfree(variable);

            return;
        }
    }

    pa_log("%s(): confused with data structures: can't find variable",
           __FUNCTION__);
}
Ejemplo n.º 3
0
static int apply_rule(const char *rule) {
        int r;

        delete_rule(rule);

        r = write_string_file("/proc/sys/fs/binfmt_misc/register", rule, 0);
        if (r < 0)
                return log_error_errno(r, "Failed to add binary format: %m");

        return 0;
}
Ejemplo n.º 4
0
static int apply_rule(const char *rule) {
        int r;

        delete_rule(rule);

        if ((r = write_one_line_file("/proc/sys/fs/binfmt_misc/register", rule)) < 0) {
                log_error("Failed to add binary format: %s", strerror(-r));
                return r;
        }

        return 0;
}
Ejemplo n.º 5
0
int
mark_close()
{
	iptc_handle_t t;
	int res;

	if (!clean_on_exit) {
		debug(DBG_NORMAL, "mark_close: cleaning is not my task.");
		return 0;
	}
	load_dump_rules();
	res = table_init(MANGLE_TABLE, &t);
	if (res)
		goto reset_error;
	res = 0;
	res += delete_rule(&rr, &t);
	res += delete_rule(&fr, &t);
	if (death_loop_rule) {
		debug(DBG_INSANE,
			  "In mark_close: I'm an IGW: deleting death loop rule.");
		res += delete_rule(&dr, &t);
	}
	if (res)
		goto reset_error;
	res = delete_ntk_forward_chain(&t);
	if (res)
		goto reset_error;
	res = commit_rules(&t);
	if (res)
		goto reset_error;
	debug(DBG_NORMAL, "Netfilter completely restored.");
	return 0;
  reset_error:
	error(err_str);
	loginfo("Netfilter was not restored. To clean, run:\n"
			"\tiptables -t mangle -F\n"
			"\tiptables -t mangle -X %s", NTK_MARK_CHAIN);
	err_ret(ERR_NETRST, -1);
}
Ejemplo n.º 6
0
int _afm_delete(dialogMenuItem *self)
{
	delete_rule();	
	return DITEM_SUCCESS | DITEM_RESTORE | DITEM_CONTINUE;
}
Ejemplo n.º 7
0
//! reads foreign keys info from database
void Table::loadForeignKeys()
{
    if (foreignKeysLoadedM)
        return;
    foreignKeysM.clear();

    DatabasePtr db = getDatabase();
    wxMBConv* conv = db->getCharsetConverter();
    MetadataLoader* loader = db->getMetadataLoader();
    // first start a transaction for metadata loading, then lock the table
    // when objects go out of scope and are destroyed, table will be unlocked
    // before the transaction is committed - any update() calls on observers
    // can possibly use the same transaction
    MetadataLoaderTransaction tr(loader);
    SubjectLocker lock(this);

    IBPP::Statement& st1 = loader->getStatement(
        "select r.rdb$constraint_name, i.rdb$field_name, c.rdb$update_rule, "
        " c.rdb$delete_rule, c.RDB$CONST_NAME_UQ, r.rdb$index_name "
        "from rdb$relation_constraints r, rdb$index_segments i, rdb$ref_constraints c "
        "where r.rdb$relation_name=? and r.rdb$index_name=i.rdb$index_name  "
        "and r.rdb$constraint_name = c.rdb$constraint_name "
        "and (r.rdb$constraint_type='FOREIGN KEY') order by 1, i.rdb$field_position"
    );

    IBPP::Statement& st2 = loader->getStatement(
        "select r.rdb$relation_name, i.rdb$field_name"
        " from rdb$relation_constraints r"
        " join rdb$index_segments i on i.rdb$index_name = r.rdb$index_name "
        " where r.rdb$constraint_name = ?"
        " order by i.rdb$field_position "
    );

    st1->Set(1, wx2std(getName_(), conv));
    st1->Execute();
    ForeignKey *fkp = 0;
    while (st1->Fetch())
    {
        std::string s;
        st1->Get(1, s);
        wxString cname(std2wxIdentifier(s, conv));
        st1->Get(2, s);
        wxString fname(std2wxIdentifier(s, conv));
        st1->Get(3, s);
        wxString update_rule(std2wxIdentifier(s, conv));
        st1->Get(4, s);
        wxString delete_rule(std2wxIdentifier(s, conv));
        std::string ref_constraint;
        st1->Get(5, ref_constraint);
        st1->Get(6, s);
        wxString ixname(std2wxIdentifier(s, conv));

        if (fkp && fkp->getName_() == cname) // add column
            fkp->columnsM.push_back(fname);
        else
        {
            ForeignKey fk;
            foreignKeysM.push_back(fk);
            fkp = &foreignKeysM.back();
            fkp->setName_(cname);
            fkp->setParent(this);
            fkp->updateActionM = update_rule;
            fkp->deleteActionM = delete_rule;
            fkp->indexNameM = ixname;

            st2->Set(1, ref_constraint);
            st2->Execute();
            std::string rtable;
            while (st2->Fetch())
            {
                st2->Get(1, rtable);
                st2->Get(2, s);
                fkp->referencedColumnsM.push_back(std2wxIdentifier(s, conv));
            }
            fkp->referencedTableM = std2wxIdentifier(rtable, conv);
            fkp->columnsM.push_back(fname);
        }
    }
    foreignKeysLoadedM = true;
}