static int mod_init(void) { bind_auth_s_t bind_auth; /* Find a database module */ if (db_bind_mod(&db_url, &auth_dbf) < 0){ LM_ERR("unable to bind to a database driver\n"); return -1; } /* bind to auth module and import the API */ bind_auth = (bind_auth_s_t)find_export("bind_auth_s", 0, 0); if (!bind_auth) { LM_ERR("unable to find bind_auth function. Check if you load" " the auth module.\n"); return -2; } if (bind_auth(&auth_api) < 0) { LM_ERR("unable to bind auth module\n"); return -3; } /* process additional list of credentials */ if (parse_aaa_pvs(credentials_list, &credentials, &credentials_n) != 0) { LM_ERR("failed to parse credentials\n"); return -5; } return 0; }
static int mod_init(void) { bind_auth_s_t bind_auth; if (register_mi_mod(exports.name, mi_cmds) != 0) { LM_ERR("registering MI commands\n"); return -1; } if (secret_list == NULL) { LM_ERR("secret modparam not set\n"); return -1; } switch(autheph_username_format) { case AUTHEPH_USERNAME_NON_IETF: LM_WARN("the %d value for the username_format modparam is " "deprecated. You should update the web-service that " "generates credentials to use the format specified in " "draft-uberti-rtcweb-turn-rest.\n", autheph_username_format); /* Fall-thru */ case AUTHEPH_USERNAME_IETF: break; default: LM_ERR("bad value for username_format modparam: %d\n", autheph_username_format); return -1; } bind_auth = (bind_auth_s_t) find_export("bind_auth_s", 0, 0); if (bind_auth) { if (bind_auth(&eph_auth_api) < 0) { LM_ERR("unable to bind to auth module\n"); return -1; } } else { memset(&eph_auth_api, 0, sizeof(auth_api_s_t)); LM_INFO("auth module not loaded - digest authentication and " "check functions will not be available\n"); } return 0; }
static int mod_init(void) { bind_auth_t bind_auth; LOG(L_INFO, "AUTH_DB module - initializing\n"); user_column.len = strlen(user_column.s); domain_column.len = strlen(domain_column.s); pass_column.len = strlen(pass_column.s); pass_column_2.len = strlen(pass_column.s); /* Find a database module */ if (bind_dbmod(db_url, &auth_dbf) < 0){ LOG(L_ERR,"ERROR:auth_db:child_init: Unable to bind to " "a database driver\n"); return -1; } /* bind to auth module and import the API */ bind_auth = (bind_auth_t)find_export("bind_auth", 0, 0); if (!bind_auth) { LOG(L_ERR,"ERROR:auth_db:mod_init: Unable to find \"bind_auth\"" "function\n"); return -2; } if (bind_auth(&auth_api) < 0) { LOG(L_ERR,"ERROR:auth_db:mod_init: Unable to bind auth module\n"); return -3; } sl_reply = find_export("sl_send_reply", 2, 0); if (!sl_reply) { LOG(L_ERR,"ERROR:auth_db:mod_init: This module requires sl module\n"); return -4; } /* process additional list of credentials */ if (parse_aaa_avps( credentials_list, &credentials, &credentials_n)!=0) { LOG(L_ERR,"ERROR:auth_db:mod_init: failed to parse credentials\n"); return -5; } return 0; }
static int mod_init(void) { bind_auth_t bind_auth; LM_INFO("initializing...\n"); init_db_url( db_url , 0 /*cannot be null*/); user_column.len = strlen(user_column.s); domain_column.len = strlen(domain_column.s); pass_column.len = strlen(pass_column.s); pass_column_2.len = strlen(pass_column_2.s); /* Find a database module */ if (db_bind_mod(&db_url, &auth_dbf) < 0){ LM_ERR("unable to bind to a database driver\n"); return -1; } /* bind to auth module and import the API */ bind_auth = (bind_auth_t)find_export("bind_auth", 0, 0); if (!bind_auth) { LM_ERR("unable to find bind_auth function. Check if you load the auth module.\n"); return -2; } if (bind_auth(&auth_api) < 0) { LM_ERR("unable to bind auth module\n"); return -3; } /* load SIGNALING API */ if(load_sig_api(&sigb)< 0) { LM_ERR("can't load signaling functions\n"); return -1; } /* process additional list of credentials */ if (parse_aaa_avps( credentials_list, &credentials, &credentials_n)!=0) { LM_ERR("failed to parse credentials\n"); return -5; } return 0; }
/* * Initialize OSP module * return 0 success, -1 failure */ static int ospInitMod(void) { bind_auth_t bind_auth; LM_INFO("initializing...\n"); if (ospVerifyParameters() != 0) { /* At least one parameter incorrect -> error */ return -1; } /* Load the RR API */ if (load_rr_api(&osp_rr) != 0) { LM_WARN("failed to load the RR API. Check if you load the rr module\n"); LM_WARN("add_rr_param is required for reporting duration for OSP transactions\n"); memset(&osp_rr, 0, sizeof(osp_rr)); } /* Load the AUTH API */ bind_auth = (bind_auth_t)find_export("bind_auth", 0); if ((bind_auth == NULL) || (bind_auth(&osp_auth) != 0)) { LM_WARN("failed to load the AUTH API. Check if you load the auth module.\n"); LM_WARN("rpid_avp & rpid_avp_type is required for calling number translation\n"); memset(&osp_auth, 0, sizeof(osp_auth)); } if (ospInitSig() != 0) { return -1; } if (ospInitTm() != 0) { return -1; } if(ospParseAvps() != 0) { return -1; } /* everything is fine, initialization done */ return 0; }
/* * Module initialization function */ static int mod_init(void) { DICT_VENDOR *vend; bind_auth_s_t bind_auth; int n; if ((rh = rc_read_config(radius_config)) == NULL) { LM_ERR("failed to open configuration file \n"); return -1; } if (rc_read_dictionary(rh, rc_conf_str(rh, "dictionary")) != 0) { LM_ERR("failed to open dictionary file \n"); return -2; } bind_auth = (bind_auth_s_t)find_export("bind_auth_s", 0, 0); if (!bind_auth) { LM_ERR("unable to find bind_auth function. Check if you load the auth module.\n"); return -1; } if (bind_auth(&auth_api) < 0) { LM_ERR("cannot bind to auth module\n"); return -4; } /* init the extra engine */ init_extra_engine(); /* parse extra attributes (if any) */ if (auth_extra_str && (auth_extra=parse_extra_str(auth_extra_str)) == 0 ) { LM_ERR("failed to parse auth_extra parameter\n"); return -1; } memset(attrs, 0, sizeof(attrs)); attrs[A_SERVICE_TYPE].n = "Service-Type"; attrs[A_SIP_URI_USER].n = "Sip-URI-User"; attrs[A_DIGEST_RESPONSE].n = "Digest-Response"; attrs[A_DIGEST_ALGORITHM].n = "Digest-Algorithm"; attrs[A_DIGEST_BODY_DIGEST].n = "Digest-Body-Digest"; attrs[A_DIGEST_CNONCE].n = "Digest-CNonce"; attrs[A_DIGEST_NONCE_COUNT].n = "Digest-Nonce-Count"; attrs[A_DIGEST_QOP].n = "Digest-QOP"; attrs[A_DIGEST_METHOD].n = "Digest-Method"; attrs[A_DIGEST_URI].n = "Digest-URI"; attrs[A_DIGEST_NONCE].n = "Digest-Nonce"; attrs[A_DIGEST_REALM].n = "Digest-Realm"; attrs[A_DIGEST_USER_NAME].n = "Digest-User-Name"; attrs[A_USER_NAME].n = "User-Name"; attrs[A_SIP_AVP].n = "SIP-AVP"; vend = rc_dict_findvend(rh, "Cisco"); if (vend == NULL) { LM_DBG("no `Cisco' vendor in Radius dictionary\n"); } else { attrs[A_CISCO_AVPAIR].n = "Cisco-AVPair"; } n = A_MAX; n += extra2attrs(auth_extra, attrs, n); memset(vals, 0, sizeof(vals)); vals[V_SIP_SESSION].n = "Sip-Session"; INIT_AV(rh, attrs, n, vals, V_MAX, "auth_radius", -5, -6); if (service_type != -1) { vals[V_SIP_SESSION].v = service_type; } return 0; }
/* * Module initialization function */ static int mod_init(void) { bind_auth_t bind_auth; str proto_url; aaa_map map; LM_INFO("initializing...\n"); memset(attrs, 0, sizeof(attrs)); memset(vals, 0, sizeof(vals)); attrs[A_SERVICE_TYPE].name = "Service-Type"; attrs[A_SIP_URI_USER].name = "Sip-URI-User"; attrs[A_DIGEST_RESPONSE].name = "Digest-Response"; attrs[A_DIGEST_ALGORITHM].name = "Digest-Algorithm"; attrs[A_DIGEST_BODY_DIGEST].name = "Digest-Body-Digest"; attrs[A_DIGEST_CNONCE].name = "Digest-CNonce"; attrs[A_DIGEST_NONCE_COUNT].name = "Digest-Nonce-Count"; attrs[A_DIGEST_QOP].name = "Digest-QOP"; attrs[A_DIGEST_METHOD].name = "Digest-Method"; attrs[A_DIGEST_URI].name = "Digest-URI"; attrs[A_DIGEST_NONCE].name = "Digest-Nonce"; attrs[A_DIGEST_REALM].name = "Digest-Realm"; attrs[A_DIGEST_USER_NAME].name = "Digest-User-Name"; attrs[A_USER_NAME].name = "User-Name"; attrs[A_CISCO_AVPAIR].name = "Cisco-AVPair"; attrs[A_SIP_AVP].name = "SIP-AVP"; attrs[A_ACCT_SESSION_ID].name = "Acct-Session-Id"; vals[V_SIP_SESSION].name = "Sip-Session"; fix_flag_name(&use_ruri_flag_str, use_ruri_flag); use_ruri_flag = get_flag_id_by_name(FLAG_TYPE_MSG, use_ruri_flag_str); if (!aaa_proto_url) { LM_ERR("aaa_url is empty\n"); return -1; } proto_url.s = aaa_proto_url; proto_url.len = strlen(aaa_proto_url); if(aaa_prot_bind(&proto_url, &proto)) { LM_ERR("aaa protocol bind failure\n"); return -1; } if (!(conn = proto.init_prot(&proto_url))) { LM_ERR("aaa init protocol failure\n"); return -2; } map.name = "Cisco"; if (proto.dictionary_find(conn, &map, AAA_DICT_FIND_VEND)) { LM_DBG("no `Cisco' vendor in AAA protocol dictionary\n"); attrs[A_CISCO_AVPAIR].name = NULL; } bind_auth = (bind_auth_t)find_export("bind_auth", 0, 0); if (!bind_auth) { LM_ERR("unable to find bind_auth function. Check if you load the auth module.\n"); return -1; } if (bind_auth(&auth_api) < 0) { LM_ERR("cannot bind to auth module\n"); return -4; } INIT_AV(proto, conn, attrs, A_MAX, vals, V_MAX, "auth_aaa", -5, -6); if (service_type != -1) { vals[V_SIP_SESSION].value = service_type; } return 0; }