• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ rc_conf_str函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中rc_conf_str函数的典型用法代码示例。如果您正苦于以下问题:C++ rc_conf_str函数的具体用法?C++ rc_conf_str怎么用?C++ rc_conf_str使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了rc_conf_str函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: login_allowed

static int
login_allowed(char *tty)
{
	FILE *fp;
	char fname[PATH_MAX];
	int c;

	strcpy(fname, rc_conf_str("nologin"));
	if (access(fname, F_OK) < 0) {
		if (tty) {
			sprintf(fname, "%s.%s", rc_conf_str("nologin"), tty);
			if (access(fname, F_OK) < 0)
				return 1;
		} else {
			return 1;
		}
	}

	if ((fp = fopen(fname, "r")) != NULL)
	{
		while ((c = fgetc(fp)) != EOF)
		{
			if (c == '\n')
				fputc('\r', stdout);
			fputc(c, stdout);
		}
		fflush(stdout);
		fclose(fp);
	} else {
		printf(SC_NOLOGIN);
	}
	return (0);		
}
开发者ID:WiseMan787,项目名称:ralink_sdk,代码行数:33,代码来源:radlogin.c


示例2: rad_init_prot

/*
	Radius implementation for the init_prot callback

	For Radius, initialization consists of:
	- the url is parsed and a configuration structure is obtained
	- the rest field from the configuration structure is, for the radius 
	module, a string for the path of the radius configuration file
	- obtain the connection handle
	- initialize the dictionary

	For Radius, the aaa_conn is actually the rc_handle resulted by reading
	the Radius configuration file.
 */
aaa_conn* rad_init_prot(str* aaa_url) {

	rc_handle *rh;
	aaa_prot_config cfg;

	if (!aaa_url) {
		LM_ERR("null aaa url \n");
		return NULL;
	}

	if (aaa_parse_url(aaa_url, &cfg)) {
		LM_ERR("aaa parse url error\n");
		return NULL;
	}

	if (!(rh = rc_read_config((char*)(cfg.rest)))) {
		LM_ERR("failed to open radius config file: %s\n", (char*)(cfg.rest));
		return NULL;
	}

	if (rc_read_dictionary(rh, rc_conf_str(rh, "dictionary"))) {
		LM_ERR("failed to read radius dictionary\n");
		return NULL;
	}

	return rh;
}
开发者ID:KISSMonX,项目名称:opensips,代码行数:40,代码来源:rad.c


示例3: radius_global_init

static void radius_global_init(void *pool, void *additional)
{
	radius_cfg_st *config = additional;

	if (config == NULL)
		goto fail;

	rh = rc_read_config(config->config);
	if (rh == NULL) {
		goto fail;
	}

	if (config->nas_identifier) {
		strlcpy(nas_identifier, config->nas_identifier, sizeof(nas_identifier));
	} else {
		nas_identifier[0] = 0;
	}

	if (rc_read_dictionary(rh, rc_conf_str(rh, "dictionary")) != 0) {
		fprintf(stderr, "error reading the radius dictionary\n");
		exit(1);
	}

	return;
 fail:
	fprintf(stderr, "radius initialization error\n");
	exit(1);
}
开发者ID:fqtools,项目名称:ocserv,代码行数:28,代码来源:radius.c


示例4: mod_init

/*
 * Module initialization function
 */
static int mod_init(void)
{
	DBG("auth_gsm - Initializing\n");

	if ((rh=rc_read_config(radius_config)) == NULL) {
		LOG(L_ERR, "auth_gsm: Error opening radius configuration file \n");
		return -1;
	}
    
	if (rc_read_dictionary(rh, rc_conf_str(rh, "dictionary")) != 0) {
		LOG(L_ERR, "auth_gsm: Error opening radius dictionary file \n");
		return -2;
	}
	
	sl_reply = find_export("sl_send_reply", 2, 0);

	if (!sl_reply) 
	{
		LOG(L_ERR, "auth_gsm:mod_init: This module requires sl module\n");
		return -2;
	}

	pre_auth_func = (pre_auth_f)find_export("pre_auth", 0, 0);
	post_auth_func = (post_auth_f)find_export("post_auth", 0, 0);

	if (!(pre_auth_func && post_auth_func)) {
		LOG(L_ERR, "auth_gsm:mod_init: This module requires auth module\n");
		return -3;
	}

	return 0;
}
开发者ID:BackupTheBerlios,项目名称:ser,代码行数:35,代码来源:auth_gsm.c


示例5: rc_get_nas_id

int rc_get_nas_id(VALUE_PAIR **sendpairs)
{
	UINT4		client_id;
	char *nasid;

	nasid = rc_conf_str("nas_identifier");
	if (strlen(nasid)) {
		/*
		 * Fill in NAS-Identifier
		 */
		if (rc_avpair_add(sendpairs, PW_NAS_IDENTIFIER, nasid, 0,
				  VENDOR_NONE) == NULL)
			return (ERROR_RC);

		return (OK_RC);
	  
	} else {
		/*
		 * Fill in NAS-IP-Address
		 */
		if ((client_id = rc_own_ipaddress()) == 0)
			return (ERROR_RC);

		if (rc_avpair_add(sendpairs, PW_NAS_IP_ADDRESS, &client_id,
				  0, VENDOR_NONE) == NULL)
			return (ERROR_RC);
	}

	return (OK_RC);
}
开发者ID:BackupTheBerlios,项目名称:wl530g-svn,代码行数:30,代码来源:buildreq.c


示例6: load_module

static int load_module(void)
{
	struct ast_config *cfg;
	int res;
	const char *tmp;

	if ((cfg = ast_config_load(cdr_config))) {
		ast_set2_flag(&global_flags, ast_true(ast_variable_retrieve(cfg, "radius", "usegmtime")), RADIUS_FLAG_USEGMTIME);
		ast_set2_flag(&global_flags, ast_true(ast_variable_retrieve(cfg, "radius", "loguniqueid")), RADIUS_FLAG_LOGUNIQUEID);
		ast_set2_flag(&global_flags, ast_true(ast_variable_retrieve(cfg, "radius", "loguserfield")), RADIUS_FLAG_LOGUSERFIELD);
		if ((tmp = ast_variable_retrieve(cfg, "radius", "radiuscfg")))
			ast_copy_string(radiuscfg, tmp, sizeof(radiuscfg));
		ast_config_destroy(cfg);
	} else 
		return AST_MODULE_LOAD_DECLINE;
	
	/* start logging */
	rc_openlog("asterisk");

	/* read radiusclient-ng config file */
	if (!(rh = rc_read_config(radiuscfg))) {
		ast_log(LOG_NOTICE, "Cannot load radiusclient-ng configuration file %s.\n", radiuscfg);
		return AST_MODULE_LOAD_DECLINE;
	}

	/* read radiusclient-ng dictionaries */
	if (rc_read_dictionary(rh, rc_conf_str(rh, "dictionary"))) {
		ast_log(LOG_NOTICE, "Cannot load radiusclient-ng dictionary file.\n");
		return AST_MODULE_LOAD_DECLINE;
	}
	
	res = ast_cdr_register(name, desc, radius_log);
	return AST_MODULE_LOAD_SUCCESS;
}
开发者ID:commshare,项目名称:squeezeterisk,代码行数:34,代码来源:cdr_radius.c


示例7: apply_config

static int apply_config(rc_handle *rh)
{
	memset(&rh->own_bind_addr, 0, sizeof(rh->own_bind_addr));
	rh->own_bind_addr_set = 0;
	rc_own_bind_addr(rh, &rh->own_bind_addr);
	rh->own_bind_addr_set = 1;
#ifdef HAVE_GNUTLS
        {
                const char *txt;
                int ret;
                txt = rc_conf_str(rh, "serv-auth-type");
                if (txt != NULL) {
                        if (strcasecmp(txt, "dtls") == 0) {
                                ret = rc_init_tls(rh, SEC_FLAG_DTLS);
                        } else if (strcasecmp(txt, "tls") == 0) {
                                ret = rc_init_tls(rh, 0);
                        } else {
                                rc_log(LOG_CRIT, "unknown server authentication type: %s", txt);
                                return -1;
                        }

                        if (ret < 0) {
                                rc_log(LOG_CRIT, "error initializing %s", txt);
                                return -1;
                        }
                }
        }
#endif

	return 0;

}
开发者ID:aravindprasad90,项目名称:radcli,代码行数:32,代码来源:config.c


示例8: rc_own_bind_addr

/** Find our source address
 *
 * Get the IP address to be used as a source address
 * for sending requests in host order.
 *
 * @param rh a handle to parsed configuration
 * @param lia the local address to listen to
 *
 **/
void rc_own_bind_addr(rc_handle *rh, struct sockaddr_storage *lia)
{
	char *txtaddr = rc_conf_str(rh, "bindaddr");
	struct addrinfo *info;

	if (rh->own_bind_addr_set) {
		memcpy(lia, &rh->own_bind_addr, SS_LEN(&rh->own_bind_addr));
		return;
	}

	memset(lia, 0, sizeof(*lia));
	if (txtaddr == NULL || txtaddr[0] == '*') {
		((struct sockaddr_in*)lia)->sin_family = AF_INET;
		((struct sockaddr_in*)lia)->sin_addr.s_addr = INADDR_ANY;
	} else {
		info = rc_getaddrinfo (txtaddr, PW_AI_PASSIVE);
		if (info == NULL) {
			rc_log(LOG_ERR, "rc_own_ipaddress: couldn't get IP address from bindaddr");
			((struct sockaddr_in*)lia)->sin_family = AF_INET;
			((struct sockaddr_in*)lia)->sin_addr.s_addr = INADDR_ANY;
			return;
		}

		memcpy(lia, info->ai_addr, info->ai_addrlen);
       }

       return;
}
开发者ID:credil,项目名称:radcli,代码行数:37,代码来源:ip_util.c


示例9: rc_get_seqnbr

unsigned char rc_get_seqnbr(void)
{
	FILE *sf;
	int tries = 1;
	int seq_nbr, pos;
	char *seqfile = rc_conf_str("seqfile");

	if ((sf = fopen(seqfile, "a+")) == NULL)
	{
		rc_log(LOG_ERR,"rc_get_seqnbr: couldn't open sequence file %s: %s", seqfile, strerror(errno));
		/* well, so guess a sequence number */
		return rc_guess_seqnbr();
	}

	while (do_lock_exclusive(fileno(sf))!= 0)
	{
		if (errno != EWOULDBLOCK) {
			rc_log(LOG_ERR, "rc_get_seqnbr: flock failure: %s: %s", seqfile, strerror(errno));
			fclose(sf);
			return rc_guess_seqnbr();
		}
		tries++;
		if (tries <= 10)
			rc_mdelay(500);
		else
			break;
	}

	if (tries > 10) {
		rc_log(LOG_ERR,"rc_get_seqnbr: couldn't get lock after %d tries: %s", tries-1, seqfile);
		fclose(sf);
		return rc_guess_seqnbr();
	}

	pos = ftell(sf);
	rewind(sf);
	if (fscanf(sf, "%d", &seq_nbr) != 1) {
		if (pos != ftell(sf)) {
			/* file was not empty */
			rc_log(LOG_ERR,"rc_get_seqnbr: fscanf failure: %s", seqfile);
		}
		seq_nbr = rc_guess_seqnbr();
	}

	rewind(sf);
	ftruncate(fileno(sf),0);
	fprintf(sf,"%d\n", (seq_nbr+1) & UCHAR_MAX);

	fflush(sf); /* fflush because a process may read it between the do_unlock and fclose */

	if (do_unlock(fileno(sf)) != 0)
		rc_log(LOG_ERR, "rc_get_seqnbr: couldn't release lock on %s: %s", seqfile, strerror(errno));

	fclose(sf);

	return (unsigned char)seq_nbr;
}
开发者ID:BackupTheBerlios,项目名称:wl530g-svn,代码行数:57,代码来源:buildreq.c


示例10: radius_login

void
radius_login(char *username)
{
	char *login_radius = rc_conf_str("login_radius");

	execle(login_radius, login_radius, NULL, env->env);

	rc_log(LOG_ERR, "couldn't execute %s: %s", login_radius, strerror(errno));
	fprintf(stderr, "couldn't execute %s: %s", login_radius, strerror(errno));

	sleep(1);	/* give the user time to read */
	exit(ERROR_RC);
}
开发者ID:WiseMan787,项目名称:ralink_sdk,代码行数:13,代码来源:radius.c


示例11: load_module

static int load_module(void)
{
	struct ast_config *cfg;
	struct ast_flags config_flags = { 0 };
	const char *tmp;

	if ((cfg = ast_config_load(cel_config, config_flags))) {
		ast_set2_flag(&global_flags, ast_true(ast_variable_retrieve(cfg, "radius", "usegmtime")), RADIUS_FLAG_USEGMTIME);
		if ((tmp = ast_variable_retrieve(cfg, "radius", "radiuscfg"))) {
			ast_copy_string(radiuscfg, tmp, sizeof(radiuscfg));
		}
		ast_config_destroy(cfg);
	} else {
		return AST_MODULE_LOAD_DECLINE;
	}

	/*
	 * start logging
	 *
	 * NOTE: Yes this causes a slight memory leak if the module is
	 * unloaded.  However, it is better than a crash if cdr_radius
	 * and cel_radius are both loaded.
	 */
	tmp = ast_strdup("asterisk");
	if (tmp) {
		rc_openlog((char *) tmp);
	}

	/* read radiusclient-ng config file */
	if (!(rh = rc_read_config(radiuscfg))) {
		ast_log(LOG_NOTICE, "Cannot load radiusclient-ng configuration file %s.\n", radiuscfg);
		return AST_MODULE_LOAD_DECLINE;
	}

	/* read radiusclient-ng dictionaries */
	if (rc_read_dictionary(rh, rc_conf_str(rh, "dictionary"))) {
		ast_log(LOG_NOTICE, "Cannot load radiusclient-ng dictionary file.\n");
		rc_destroy(rh);
		rh = NULL;
		return AST_MODULE_LOAD_DECLINE;
	}

	event_sub = ast_event_subscribe(AST_EVENT_CEL, radius_log, "CEL Radius Logging", NULL, AST_EVENT_IE_END);
	if (!event_sub) {
		rc_destroy(rh);
		rh = NULL;
		return AST_MODULE_LOAD_DECLINE;
	} else {
		return AST_MODULE_LOAD_SUCCESS;
	}
}
开发者ID:cfhb,项目名称:vlink-cti,代码行数:51,代码来源:cel_radius.c


示例12: load_module

static int load_module(void)
{
	struct ast_config *cfg;
	struct ast_flags config_flags = { 0 };
	const char *tmp;

	if ((cfg = ast_config_load(cdr_config, config_flags)) && cfg != CONFIG_STATUS_FILEINVALID) {
		ast_set2_flag(&global_flags, ast_true(ast_variable_retrieve(cfg, "radius", "usegmtime")), RADIUS_FLAG_USEGMTIME);
		ast_set2_flag(&global_flags, ast_true(ast_variable_retrieve(cfg, "radius", "loguniqueid")), RADIUS_FLAG_LOGUNIQUEID);
		ast_set2_flag(&global_flags, ast_true(ast_variable_retrieve(cfg, "radius", "loguserfield")), RADIUS_FLAG_LOGUSERFIELD);
		if ((tmp = ast_variable_retrieve(cfg, "radius", "radiuscfg")))
			ast_copy_string(radiuscfg, tmp, sizeof(radiuscfg));
		ast_config_destroy(cfg);
	} else
		return AST_MODULE_LOAD_DECLINE;

	/*
	 * start logging
	 *
	 * NOTE: Yes this causes a slight memory leak if the module is
	 * unloaded.  However, it is better than a crash if cdr_radius
	 * and cel_radius are both loaded.
	 */
	tmp = ast_strdup("asterisk");
	if (tmp) {
		rc_openlog((char *) tmp);
	}

	/* read radiusclient-ng config file */
	if (!(rh = rc_read_config(radiuscfg))) {
		ast_log(LOG_NOTICE, "Cannot load radiusclient-ng configuration file %s.\n", radiuscfg);
		return AST_MODULE_LOAD_DECLINE;
	}

	/* read radiusclient-ng dictionaries */
	if (rc_read_dictionary(rh, rc_conf_str(rh, "dictionary"))) {
		ast_log(LOG_NOTICE, "Cannot load radiusclient-ng dictionary file.\n");
		rc_destroy(rh);
		rh = NULL;
		return AST_MODULE_LOAD_DECLINE;
	}

	if (ast_cdr_register(name, desc, radius_log)) {
		rc_destroy(rh);
		rh = NULL;
		return AST_MODULE_LOAD_DECLINE;
	} else {
		return AST_MODULE_LOAD_SUCCESS;
	}
}
开发者ID:bugrahantopall,项目名称:asterisk,代码行数:50,代码来源:cdr_radius.c


示例13: pmip_mn_to_hnp_cache_init

int pmip_mn_to_hnp_cache_init(void)
{
  dbg ("\n");
  memset(g_mn_hn_map, 0, sizeof(mnid_hnp_t) * MAX_MOBILES);
  rc_openlog("pmip_radius_client");

  if ((g_rh = rc_read_config(conf.RadiusClientConfigFile)) == NULL) {
    dbg ("ERROR INIT CLIENT RADIUS\n");
    return ERROR_RC;
  } else {
    dbg ("RADIUS client radius read config file OK\n");
  }

  if (rc_read_dictionary(g_rh, rc_conf_str(g_rh, "dictionary")) != 0) {
    dbg ("ERROR INIT CLIENT RADIUS DICTIONNARY\n");
    return ERROR_RC;
  } else {
    dbg ("client radius read dictionnary file OK\n");
  }

  g_default_realm = rc_conf_str(g_rh, "default_realm");
  return 0;
}
开发者ID:awesome-security,项目名称:openairinterface5g,代码行数:23,代码来源:pmip_hnp_cache.c


示例14: init_radius_handle

int init_radius_handle(void) {

	int i;
	DICT_ATTR *da;
	char name[256];
	map_list *mp;


	if (!config_file) {
		LM_ERR("radius configuration file not set\n");
		return -1;
	}

	if ( syslog_name!=NULL && syslog_name[0]!=0 )
		rc_openlog(syslog_name);

	if (!(rh = rc_read_config(config_file))) {
		LM_ERR("failed to open radius config file: %s\n", config_file);
		return -1;
	}

	if (rc_read_dictionary(rh, rc_conf_str(rh, "dictionary"))) {
		LM_ERR("failed to read radius dictionary\n");
		return -1;
	}

	attr = rc_dict_findattr(rh, "SIP-AVP");

	/* initialize values for the attributes in sets */
	for (i = 0; i < set_size; i++) {
		mp = sets[i]->parsed;

		while (mp) {
			sprintf(name,"%.*s", mp->name.len, mp->name.s);
			da = rc_dict_findattr(rh, name);
			if (!da) {
				LM_ERR("attribute not found %s\n", name);
				return -1;
			} else
			mp->value = da->value;
			mp = mp->next;
		}
	}

	return 0;
}
开发者ID:ataillefer,项目名称:opensips,代码行数:46,代码来源:aaa_radius.c


示例15: init_acc_rad

int init_acc_rad(acc_extra_t *leg_info, char *rad_cfg, int srv_type)
{
	int n;

	memset(rd_attrs, 0, sizeof(rd_attrs));
	memset(rd_vals, 0, sizeof(rd_vals));
	rd_attrs[RA_ACCT_STATUS_TYPE].n  = "Acct-Status-Type";
	rd_attrs[RA_SERVICE_TYPE].n      = "Service-Type";
	rd_attrs[RA_SIP_RESPONSE_CODE].n = "Sip-Response-Code";
	rd_attrs[RA_SIP_METHOD].n        = "Sip-Method";
	rd_attrs[RA_TIME_STAMP].n        = "Event-Timestamp";
	n = RA_STATIC_MAX;
	/* caution: keep these aligned to core acc output */
	rd_attrs[n++].n                  = "Sip-From-Tag";
	rd_attrs[n++].n                  = "Sip-To-Tag";
	rd_attrs[n++].n                  = "Acct-Session-Id";

	rd_vals[RV_STATUS_START].n        = "Start";
	rd_vals[RV_STATUS_STOP].n         = "Stop";
	rd_vals[RV_STATUS_ALIVE].n        = "Alive";
	rd_vals[RV_STATUS_FAILED].n       = "Failed";
	rd_vals[RV_SIP_SESSION].n         = "Sip-Session";

	/* add and count the extras as attributes */
	n += extra2attrs( rad_extra, rd_attrs, n);
	/* add and count the legs as attributes */
	n += extra2attrs( leg_info, rd_attrs, n);

	/* read config */
	if ((rh = rc_read_config(rad_cfg)) == NULL) {
		LM_ERR("failed to open radius config file: %s\n", rad_cfg );
		return -1;
	}
	/* read dictionary */
	if (rc_read_dictionary(rh, rc_conf_str(rh, "dictionary"))!=0) {
		LM_ERR("failed to read radius dictionary\n");
		return -1;
	}

	INIT_AV(rh, rd_attrs, n, rd_vals, RV_STATIC_MAX, "acc", -1, -1);

	if (srv_type != -1)
		rd_vals[RV_SIP_SESSION].v = srv_type;

	return 0;
}
开发者ID:4N7HR4X,项目名称:kamailio,代码行数:46,代码来源:acc_radius_mod.c


示例16: rc_test_config

/** Tests the configuration the user supplied
 *
 * @param rh a handle to parsed configuration.
 * @param filename a name of a configuration file.
 * @return 0 on success, -1 when failure.
 */
int rc_test_config(rc_handle *rh, char const *filename)
{
	SERVER *srv;

	srv = rc_conf_srv(rh, "authserver");
	if (!srv || !srv->max)
	{
		rc_log(LOG_ERR,"%s: no authserver specified", filename);
		return -1;
	}

	srv = rc_conf_srv(rh, "acctserver");
	if (!srv || !srv->max)
	{
		/* it is allowed not to have acct servers */
		if (rh->so_type != RC_SOCKET_TLS && rh->so_type != RC_SOCKET_DTLS)
			rc_log(LOG_DEBUG,"%s: no acctserver specified", filename);
	}
	if (!rc_conf_str(rh, "dictionary"))
	{
		rc_log(LOG_ERR,"%s: no dictionary specified", filename);
		return -1;
	}

	if (rc_conf_int(rh, "radius_timeout") <= 0)
	{
		rc_log(LOG_ERR,"%s: radius_timeout <= 0 is illegal", filename);
		return -1;
	}
	if (rc_conf_int(rh, "radius_retries") <= 0)
	{
		rc_log(LOG_ERR,"%s: radius_retries <= 0 is illegal", filename);
		return -1;
	}

	if (apply_config(rh) == -1) {
		return -1;
	}

	return 0;
}
开发者ID:aravindprasad90,项目名称:radcli,代码行数:47,代码来源:config.c


示例17: local_login

void
local_login(rc_handle *rh, char *username)
{
	char *login_local = rc_conf_str(rh, "login_local");

	/* login should spot this... but who knows what old /bin/logins
	 * may be still around
	 */
	if (*username == '-') {
		rc_log(LOG_WARNING, "username can't start with a dash");
		exit(ERROR_RC);
	}
	/* the new shadow login seems to require either a -r or a -h
	 * flag for -f to work (so source code, lmain.c) so we supply
	 * it here. shouldn't hurt on other systems,	-lf, 03/13/96
	 */
	execle(login_local, login_local, "-h", "localhost", "-f", username, NULL, env->env);
	rc_log(LOG_ERR, "couldn't execute %s: %s", login_local, strerror(errno));
	sleep(1);	/* give the user time to read */
	exit(ERROR_RC);
}
开发者ID:Distrotech,项目名称:freeradius-client,代码行数:21,代码来源:local.c


示例18: mod_init

static int mod_init(void)
{
    DICT_VENDOR *vend;
    memset(attrs, 0, sizeof(attrs));
    memset(vals, 0, sizeof(vals));
    
    attrs[A_USER_NAME].n        = "User-Name";
    attrs[A_SER_SERVICE_TYPE].n = "SER-Service-Type";
    attrs[A_SER_ATTR].n	        = "SER-Attr";
    attrs[A_SER_DID].n          = "SER-DID";
    attrs[A_SER_URI_SCHEME].n   = "SER-Uri-Scheme";
    
    vals[V_GET_URI_ATTRS].n  = "Get-URI-Attrs";
    vals[V_GET_USER_ATTRS].n = "Get-User-Attrs";

	 /* open log */
    rc_openlog("ser");
    
	 /* read config */
    if ((rh = rc_read_config(radius_config)) == NULL) {
	LOG(L_ERR, "avp_radius: Error opening radius config file: %s\n",
	    radius_config);
	return -1;
    }
    
	 /* read dictionary */
    if (rc_read_dictionary(rh, rc_conf_str(rh, "dictionary")) != 0) {
	LOG(L_ERR, "avp_radius: Error reading radius dictionary\n");
	return -1;
    }
    
    vend = rc_dict_findvend(rh, "iptelorg");
    if (vend == NULL) {
	ERR("RADIUS dictionary is missing required vendor 'iptelorg'\n");
	return -1;
    }

    INIT_AV(rh, attrs, vals, "avp", -1, -1);
    return 0;
}
开发者ID:asyn,项目名称:openvims,代码行数:40,代码来源:avp_radius.c


示例19: radius_auth_init

static int radius_auth_init(void **ctx, void *pool, const common_auth_init_st *info)
{
	struct radius_ctx_st *pctx;
	char *default_realm;

	if (info->username == NULL || info->username[0] == 0) {
		syslog(LOG_AUTH,
		       "radius-auth: no username present");
		return ERR_AUTH_FAIL;
	}

	pctx = talloc_zero(pool, struct radius_ctx_st);
	if (pctx == NULL)
		return ERR_AUTH_FAIL;

	if (info->ip)
		strlcpy(pctx->remote_ip, info->ip, sizeof(pctx->remote_ip));
	if (info->our_ip)
		strlcpy(pctx->our_ip, info->our_ip, sizeof(pctx->our_ip));

	pctx->pass_msg = NULL;

	default_realm = rc_conf_str(rh, "default_realm");

	if ((strchr(info->username, '@') == NULL) && default_realm &&
	    default_realm[0] != 0) {
		snprintf(pctx->username, sizeof(pctx->username), "%[email protected]%s", info->username, default_realm);
	} else {
		strlcpy(pctx->username, info->username, sizeof(pctx->username));
	}
	pctx->id = info->id;

	if (info->user_agent)
		strlcpy(pctx->user_agent, info->user_agent, sizeof(pctx->user_agent));

	*ctx = pctx;

	return ERR_AUTH_CONTINUE;
}
开发者ID:fqtools,项目名称:ocserv,代码行数:39,代码来源:radius.c


示例20: mod_init

static int mod_init(void)
{
	LM_INFO("initializing...\n");

	memset(attrs, 0, sizeof(attrs));
	memset(vals, 0, sizeof(vals));

	attrs[A_SERVICE_TYPE].n	  = "Service-Type";
	attrs[A_USER_NAME].n	  = "User-Name";
	attrs[A_SIP_AVP].n	  = "SIP-AVP";
	vals[V_SIP_CALLER_AVPS].n = "SIP-Caller-AVPs";
	vals[V_SIP_CALLEE_AVPS].n = "SIP-Callee-AVPs";

	/* read config */
	if ((rh = rc_read_config(radius_config)) == NULL) {
		LM_ERR("failed to open radius config file: %s\n", radius_config);
		return -1;
	}

	/* read dictionary */
	if (rc_read_dictionary(rh, rc_conf_str(rh, "dictionary")) != 0) {
		LM_ERR("failed to read radius dictionary\n");
		return -1;
	}
	
	INIT_AV(rh, attrs, A_MAX, vals, V_MAX, "avp", -1, -1);

	if (caller_service_type != -1) {
		vals[V_SIP_CALLER_AVPS].v = caller_service_type;
	}

	if (callee_service_type != -1) {
		vals[V_SIP_CALLEE_AVPS].v = callee_service_type;
	}

	return 0;
}
开发者ID:Drooids,项目名称:openser-xmlrpc,代码行数:37,代码来源:avp_radius.c



注:本文中的rc_conf_str函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ rc_get_opcode_info函数代码示例发布时间:2022-05-30
下一篇:
C++ rc_avpair_free函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap