int rad_load_credentials(TALLOC_CTX *ctx, ikev2_ctx *i2,char *filename,char *authtype_name)
{
	rad_assert(i2 && filename && authtype_name);
	int authtype;

	authtype=AuthtypeFromName(authtype_name);
	if(authtype==-1) {
	ERROR(IKEv2_LOG_PREFIX "Unsupported 'default_auth_type' value (%s), using both",authtype_name);
	authtype=IKEv2_AUTH_BOTH;
	}

	PAIR_LIST *users=NULL;
	if(getusersfile(ctx, filename,&users,"no")!=0) {
	ERROR(IKEv2_LOG_PREFIX "Error while loading %s userfile",filename);
	return -1;
	}
	PAIR_LIST *tusers=users;
	while(tusers) {
	if(strcmp(tusers->name,"DEFAULT")) {
		rad_update_shared_seclist(&i2->sslist,tusers->name,tusers->check,authtype);
	}
	tusers=tusers->next;
	}
	pairlist_free(&users);
	//print sslist
//	struct sharedSecList *sslist=i2->sslist;
//	while(sslist) {
//	ERROR("sslist:id=%s",sslist->id);
//	ERROR("sslist:idlen=%d",sslist->idlen);
//	ERROR("sslist:pwd=%s",sslist->pwd);
//	ERROR("sslist:pwdlen=%d",sslist->pwdlen);
//	ERROR("sslist:idtype= %d",sslist->idtype);
//	ERROR("sslist:authtype=%d",sslist->authtype);
//	sslist=sslist->next;
//	}
	return 0;


}
/*
 *	(Re-)read the "users" file into memory.
 */
static int file_instantiate(CONF_SECTION *conf, void **instance)
{
	struct file_instance *inst;
	int rcode;

	inst = rad_malloc(sizeof *inst);
	if (!inst) {
		return -1;
	}
	memset(inst, 0, sizeof(*inst));

	if (cf_section_parse(conf, inst, module_config) < 0) {
		free(inst);
		return -1;
	}

	rcode = getusersfile(inst->usersfile, &inst->users, inst->compat_mode);
	if (rcode != 0) {
	  radlog(L_ERR|L_CONS, "Errors reading %s", inst->usersfile);
		file_detach(inst);
		return -1;
	}

	rcode = getusersfile(inst->acctusersfile, &inst->acctusers, inst->compat_mode);
	if (rcode != 0) {
		radlog(L_ERR|L_CONS, "Errors reading %s", inst->acctusersfile);
		file_detach(inst);
		return -1;
	}

	/*
	 *  Get the pre-proxy stuff
	 */
	rcode = getusersfile(inst->preproxy_usersfile, &inst->preproxy_users, inst->compat_mode);
	if (rcode != 0) {
		radlog(L_ERR|L_CONS, "Errors reading %s", inst->preproxy_usersfile);
		file_detach(inst);
		return -1;
	}

	rcode = getusersfile(inst->auth_usersfile, &inst->auth_users, inst->compat_mode);
	if (rcode != 0) {
		radlog(L_ERR|L_CONS, "Errors reading %s", inst->auth_usersfile);
		file_detach(inst);
		return -1;
	}

	rcode = getusersfile(inst->postproxy_usersfile, &inst->postproxy_users, inst->compat_mode);
	if (rcode != 0) {
		radlog(L_ERR|L_CONS, "Errors reading %s", inst->postproxy_usersfile);
		file_detach(inst);
		return -1;
	}

	rcode = getusersfile(inst->postauth_usersfile, &inst->postauth_users, inst->compat_mode);
	if (rcode != 0) {
		radlog(L_ERR|L_CONS, "Errors reading %s", inst->postauth_usersfile);
		file_detach(inst);
		return -1;
	}

	*instance = inst;
	return 0;
}