MCPcopy Create free account
hub / github.com/OpenSIPS/opensips / mod_init

Function mod_init

modules/auth_db/authdb_mod.c:217–266  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

215
216
217static int mod_init(void)
218{
219 bind_auth_t bind_auth;
220
221 LM_INFO("initializing...\n");
222
223 init_db_url( db_url , 0 /*cannot be null*/);
224 user_column.len = strlen(user_column.s);
225 domain_column.len = strlen(domain_column.s);
226 pass_column.len = strlen(pass_column.s);
227 hash_column_sha256.len = strlen(hash_column_sha256.s);
228 hash_column_sha512t256.len = strlen(hash_column_sha512t256.s);
229
230 uri_user_column.len = strlen(uri_user_column.s);
231 uri_domain_column.len = strlen(uri_domain_column.s);
232 uri_uriuser_column.len = strlen(uri_uriuser_column.s);
233
234 /* Find a database module */
235 if (db_bind_mod(&db_url, &auth_dbf) < 0){
236 LM_ERR("unable to bind to a database driver\n");
237 return -1;
238 }
239
240 /* bind to auth module and import the API */
241 bind_auth = (bind_auth_t)find_export("bind_auth", 0);
242 if (!bind_auth) {
243 LM_ERR("unable to find bind_auth function."
244 " Check if you load the auth module.\n");
245 return -2;
246 }
247
248 if (bind_auth(&auth_api) < 0) {
249 LM_ERR("unable to bind auth module\n");
250 return -3;
251 }
252
253 /* load SIGNALING API */
254 if(load_sig_api(&sigb)< 0) {
255 LM_ERR("can't load signaling functions\n");
256 return -1;
257 }
258
259 /* process additional list of credentials */
260 if (parse_aaa_avps( credentials_list, &credentials, &credentials_n)!=0) {
261 LM_ERR("failed to parse credentials\n");
262 return -5;
263 }
264
265 return 0;
266}
267
268
269static void destroy(void)

Callers

nothing calls this directly

Calls 5

db_bind_modFunction · 0.85
find_exportFunction · 0.85
bind_authFunction · 0.85
load_sig_apiFunction · 0.85
parse_aaa_avpsFunction · 0.85

Tested by

no test coverage detected