コード例 #1
0
ファイル: config.c プロジェクト: platinasystems/openipmi
void
read_persist_users(sys_data_t *sys)
{
    unsigned int i, j;

    for (i = 0; i < IPMI_MAX_MCS; i++) {
	lmc_data_t *mc = sys->ipmb_addrs[i];
	user_t *users;
	persist_t *p;
	long iv;

	if (!mc)
	    continue;

	p = read_persist("users.mc%2.2x", ipmi_mc_get_ipmb(mc));
	if (!p)
	    continue;

	users = ipmi_mc_get_users(mc);
	for (j = 0; j <= MAX_USERS; j++) {
	    void *data;
	    unsigned int len;

	    if (!read_persist_int(p, &iv, "%d.valid", j))
		users[j].valid = iv;
	    if (!read_persist_int(p, &iv, "%d.link_auth", j))
		users[j].link_auth = iv;
	    if (!read_persist_int(p, &iv, "%d.cb_only", j))
		users[j].cb_only = iv;
	    if (!read_persist_data(p, &data, &len, "%d.username", j)) {
		if (len == sizeof(users[j].username))
		    memcpy(users[j].username, data, len);
		free_persist_data(data);
	    }
	    if (!read_persist_data(p, &data, &len, "%d.passwd", j)) {
		if (len == sizeof(users[j].pw))
		    memcpy(users[j].pw, data, len);
		free_persist_data(data);
	    }
	    if (!read_persist_int(p, &iv, "%d.privilege", j))
		users[j].privilege = iv;
	    if (!read_persist_int(p, &iv, "%d.max_sessions", j))
		users[j].max_sessions = iv;
	    if (!read_persist_int(p, &iv, "%d.allowed_auths", j))
		users[j].allowed_auths = iv;
	}
	free_persist(p);
    }
}
コード例 #2
0
ファイル: sol.c プロジェクト: turtle-fly/openipmi
int
read_sol_config(sys_data_t *sys)
{
    unsigned int i;
    int rv;

    for (i = 0; i < IPMI_MAX_MCS; i++) {
	lmc_data_t *mc = sys->ipmb_addrs[i];
	ipmi_sol_t *sol;
	persist_t *p;
	long iv;

	if (!mc)
	    continue;
	sol = ipmi_mc_get_sol(mc);
	if (!sol->configured)
	    continue;

	sys->sol_present = 1;

	sol->solparm.enabled = 1;
	sol->solparm.bitrate_nonv = 0;

	p = read_persist("sol.mc%2.2x", ipmi_mc_get_ipmb(mc));
	if (p) {
	    if (!read_persist_int(p, &iv, "enabled"))
		sol->solparm.enabled = iv;

	    if (!read_persist_int(p, &iv, "bitrate"))
		sol->solparm.bitrate_nonv = iv;

	    sol->solparm.bitrate = sol->solparm.bitrate_nonv;

	    free_persist(p);
	}
	rv = sol_init_mc(sys, mc);
	if (rv)
	    return rv;
    }

    return 0;
}