| 215 | |
| 216 | |
| 217 | static 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 | |
| 269 | static void destroy(void) |
nothing calls this directly
no test coverage detected