static void account_fixups_fn(void *var) {
	struct s_auth *account = var;
	if (account->ac_users < -1) account->ac_users = DEFAULT_AC_USERS;
	if (account->ac_penalty < -1) account->ac_penalty = DEFAULT_AC_PENALTY;
}
#endif

#define OFS(X) offsetof(struct s_auth, X)
#define SIZEOF(X) sizeof(((struct s_auth *)0)->X)

static const struct config_list account_opts[] = {
#ifdef CS_ANTICASC
	DEF_OPT_FIXUP_FUNC(account_fixups_fn),
#endif
	DEF_OPT_INT8("disabled"				, OFS(disabled),				0 ),
	DEF_OPT_SSTR("user"					, OFS(usr),						"", SIZEOF(usr) ),
	DEF_OPT_STR("pwd"					, OFS(pwd),						NULL ),
#ifdef WEBIF
	DEF_OPT_STR("description"			, OFS(description),				NULL ),
#endif
	DEF_OPT_STR("hostname"				, OFS(dyndns),					NULL ),
	DEF_OPT_FUNC("caid"					, OFS(ctab),					check_caidtab_fn ),
	DEF_OPT_INT8("uniq"					, OFS(uniq),					0 ),
	DEF_OPT_UINT8("sleepsend"			, OFS(c35_sleepsend),			0 ),
	DEF_OPT_INT32("failban"				, OFS(failban),					0 ),
	DEF_OPT_INT8("monlevel"				, OFS(monlvl),					0 ),
	DEF_OPT_FUNC("sleep"				, OFS(tosleep),					account_tosleep_fn ),
	DEF_OPT_FUNC("suppresscmd08"		, OFS(c35_suppresscmd08),		account_c35_suppresscmd08_fn ),
	DEF_OPT_FUNC("keepalive"			, OFS(ncd_keepalive),			account_ncd_keepalive_fn ),
	DEF_OPT_FUNC("au"					, 0,							account_au_fn ),
	DEF_OPT_FUNC("expdate"				, 0,							account_expdate_fn ),
		}
		return;
	}
	value = mk_t_cccam_port();
	fprintf_conf(f, token, "%s\n", value);
	free_mk_t(value);
}

static bool cccam_should_save_fn(void *UNUSED(var)) { return cfg.cc_port[0]; }

static const struct config_list cccam_opts[] = {
	DEF_OPT_SAVE_FUNC(cccam_should_save_fn),
	DEF_OPT_FUNC("port"						, OFS(cc_port),				cccam_port_fn ),
	DEF_OPT_FUNC("serverip"					, OFS(cc_srvip),			serverip_fn ),
	DEF_OPT_HEX("nodeid"					, OFS(cc_fixed_nodeid),		SIZEOF(cc_fixed_nodeid) ),
	DEF_OPT_SSTR("version"					, OFS(cc_version),			"", SIZEOF(cc_version) ),
	DEF_OPT_INT8("reshare"					, OFS(cc_reshare),			10 ),
	DEF_OPT_INT8("reshare_mode"				, OFS(cc_reshare_services),	0 ),
	DEF_OPT_INT8("ignorereshare"			, OFS(cc_ignore_reshare),	0 ),
	DEF_OPT_INT8("forward_origin_card"		, OFS(cc_forward_origin_card), 0 ),
	DEF_OPT_INT8("stealth"					, OFS(cc_stealth),			0 ),
	DEF_OPT_INT32("updateinterval"			, OFS(cc_update_interval),	DEFAULT_UPDATEINTERVAL ),
	DEF_OPT_INT8("minimizecards"			, OFS(cc_minimize_cards),	0 ),
	DEF_OPT_INT8("keepconnected"			, OFS(cc_keep_connected),	1 ),
	DEF_OPT_STR("cccamcfgfile"				, OFS(cc_cfgfile),		NULL ),
	DEF_OPT_INT8("autosidblock"				, OFS(cc_autosidblock),		1),
	DEF_OPT_UINT32("recv_timeout"			, OFS(cc_recv_timeout),		DEFAULT_CC_RECV_TIMEOUT ),
	DEF_LAST_OPT
};
#else
static const struct config_list cccam_opts[] = { DEF_LAST_OPT };
	fprintf_conf(f, token, "%s\n", value);
	free_mk_t(value);
}

static bool cccam_should_save_fn(void *UNUSED(var))
{
	return cfg.cc_port[0];
}

static const struct config_list cccam_opts[] =
{
	DEF_OPT_SAVE_FUNC(cccam_should_save_fn),
	DEF_OPT_FUNC("port"			, OFS(cc_port),			cccam_port_fn),
	DEF_OPT_FUNC("serverip"			, OFS(cc_srvip),		serverip_fn),
	DEF_OPT_HEX("nodeid"			, OFS(cc_fixed_nodeid),		SIZEOF(cc_fixed_nodeid)),
	DEF_OPT_SSTR("version"			, OFS(cc_version),		"", SIZEOF(cc_version)),
	DEF_OPT_INT8("reshare"			, OFS(cc_reshare),		10),
	DEF_OPT_INT8("reshare_mode"		, OFS(cc_reshare_services),	4),
	DEF_OPT_INT8("ignorereshare"		, OFS(cc_ignore_reshare),	0),
	DEF_OPT_INT8("forward_origin_card"	, OFS(cc_forward_origin_card),	0),
	DEF_OPT_INT8("stealth"			, OFS(cc_stealth),		0),
	DEF_OPT_INT32("updateinterval"		, OFS(cc_update_interval),	DEFAULT_UPDATEINTERVAL),
	DEF_OPT_INT8("minimizecards"		, OFS(cc_minimize_cards),	0),
	DEF_OPT_INT8("keepconnected"		, OFS(cc_keep_connected),	1),
	DEF_OPT_UINT32("recv_timeout"		, OFS(cc_recv_timeout),		DEFAULT_CC_RECV_TIMEOUT),
	DEF_LAST_OPT
};
#else
static const struct config_list cccam_opts[] = { DEF_LAST_OPT };
#endif