| 199 | |
| 200 | |
| 201 | static int mod_init(void) |
| 202 | { |
| 203 | LM_DBG("group module - initializing\n"); |
| 204 | |
| 205 | /* check for a database module */ |
| 206 | if (db_url.s) { |
| 207 | |
| 208 | db_url.len = strlen(db_url.s); |
| 209 | table.len = strlen(table.s); |
| 210 | user_column.len = strlen(user_column.s); |
| 211 | domain_column.len = strlen(domain_column.s); |
| 212 | group_column.len = strlen(group_column.s); |
| 213 | |
| 214 | re_table.len = (re_table.s && re_table.s[0])?strlen(re_table.s):0; |
| 215 | re_exp_column.len = strlen(re_exp_column.s); |
| 216 | re_gid_column.len = strlen(re_gid_column.s); |
| 217 | |
| 218 | if (group_db_bind(&db_url)) { |
| 219 | LM_ERR("unable to bind database module\n"); |
| 220 | return -1; |
| 221 | } |
| 222 | |
| 223 | if (group_db_init(&db_url) < 0 ){ |
| 224 | LM_ERR("unable to open database connection\n"); |
| 225 | return -1; |
| 226 | } |
| 227 | |
| 228 | /* check version for group table */ |
| 229 | if (db_check_table_version(&group_dbf, group_dbh, &table, TABLE_VERSION) < 0) { |
| 230 | LM_ERR("error during group table version check.\n"); |
| 231 | return -1; |
| 232 | } |
| 233 | |
| 234 | if (re_table.len) { |
| 235 | /* check version for group re_group table */ |
| 236 | if (db_check_table_version(&group_dbf, group_dbh, &re_table, RE_TABLE_VERSION) < 0) { |
| 237 | LM_ERR("error during re_group table version check.\n"); |
| 238 | return -1; |
| 239 | } |
| 240 | if (load_re( &re_table )!=0 ) { |
| 241 | LM_ERR("failed to load <%s> table\n", re_table.s); |
| 242 | return -1; |
| 243 | } |
| 244 | } |
| 245 | |
| 246 | group_db_close(); |
| 247 | |
| 248 | LM_DBG("group database loaded\n"); |
| 249 | } |
| 250 | |
| 251 | /* check for an aaa module */ |
| 252 | if (aaa_proto_url.s) { |
| 253 | |
| 254 | aaa_proto_url.len = strlen(aaa_proto_url.s); |
| 255 | |
| 256 | memset(attrs, 0, sizeof(attrs)); |
| 257 | memset(vals, 0, sizeof(vals)); |
| 258 | attrs[A_SERVICE_TYPE].name = "Service-Type"; |
nothing calls this directly
no test coverage detected