Wed, 10 Feb 2010 21:21:24 +0100
Introduce authentication credential logic into the LCR module.
This logic is meant to complement that of changeset 18, adding
additional authentication flexibility to the UAC module.
michael@17 | 1 | Index: modules/lcr/lcr_mod.c |
michael@17 | 2 | diff -Nau modules/lcr/lcr_mod.c.orig modules/lcr/lcr_mod.c |
michael@17 | 3 | --- modules/lcr/lcr_mod.c.orig 2010-01-18 12:32:29.697648000 +0100 |
michael@17 | 4 | +++ modules/lcr/lcr_mod.c 2010-02-10 19:52:14.838272303 +0100 |
michael@17 | 5 | @@ -114,9 +114,18 @@ |
michael@17 | 6 | |
michael@17 | 7 | #define PRIORITY_COL "priority" |
michael@17 | 8 | |
michael@17 | 9 | +#define USER_COL "user" |
michael@17 | 10 | + |
michael@17 | 11 | +#define REALM_COL "realm" |
michael@17 | 12 | + |
michael@17 | 13 | +#define PASSWD_COL "passwd" |
michael@17 | 14 | + |
michael@17 | 15 | #define MAX_NO_OF_GWS 32 |
michael@17 | 16 | #define MAX_NO_OF_LCRS 256 |
michael@17 | 17 | #define MAX_PREFIX_LEN 256 |
michael@17 | 18 | +#define MAX_USER_LEN 64 |
michael@17 | 19 | +#define MAX_REALM_LEN 64 |
michael@17 | 20 | +#define MAX_PASSWD_LEN 64 |
michael@17 | 21 | #define MAX_TAG_LEN 16 |
michael@17 | 22 | #define MAX_FROM_URI_LEN 256 |
michael@17 | 23 | |
michael@17 | 24 | @@ -141,6 +150,12 @@ |
michael@17 | 25 | char tag[MAX_TAG_LEN + 1]; |
michael@17 | 26 | unsigned short tag_len; |
michael@17 | 27 | unsigned int flags; |
michael@17 | 28 | + char user[MAX_USER_LEN]; |
michael@17 | 29 | + unsigned short user_len; |
michael@17 | 30 | + char realm[MAX_REALM_LEN]; |
michael@17 | 31 | + unsigned short realm_len; |
michael@17 | 32 | + char passwd[MAX_PASSWD_LEN]; |
michael@17 | 33 | + unsigned short passwd_len; |
michael@17 | 34 | }; |
michael@17 | 35 | |
michael@17 | 36 | struct lcr_info { |
michael@17 | 37 | @@ -196,6 +211,9 @@ |
michael@17 | 38 | static str prefix_col = str_init(PREFIX_COL); |
michael@17 | 39 | static str from_uri_col = str_init(FROM_URI_COL); |
michael@17 | 40 | static str priority_col = str_init(PRIORITY_COL); |
michael@17 | 41 | +static str user_col = str_init(USER_COL); |
michael@17 | 42 | +static str realm_col = str_init(REALM_COL); |
michael@17 | 43 | +static str passwd_col = str_init(PASSWD_COL); |
michael@17 | 44 | |
michael@17 | 45 | /* timer */ |
michael@17 | 46 | int fr_inv_timer = DEF_FR_INV_TIMER; |
michael@17 | 47 | @@ -208,6 +226,9 @@ |
michael@17 | 48 | static char *contact_avp_param = NULL; |
michael@17 | 49 | static char *rpid_avp_param = NULL; |
michael@17 | 50 | static char *flags_avp_param = NULL; |
michael@17 | 51 | +static char *user_avp_param = NULL; |
michael@17 | 52 | +static char *realm_avp_param = NULL; |
michael@17 | 53 | +static char *passwd_avp_param = NULL; |
michael@17 | 54 | |
michael@17 | 55 | /* prefix mode */ |
michael@17 | 56 | int prefix_mode_param = DEF_PREFIX_MODE; |
michael@17 | 57 | @@ -239,6 +260,12 @@ |
michael@17 | 58 | static int_str rpid_avp; |
michael@17 | 59 | static int flags_avp_type; |
michael@17 | 60 | static int_str flags_avp; |
michael@17 | 61 | +static int user_avp_type; |
michael@17 | 62 | +static int_str user_avp; |
michael@17 | 63 | +static int realm_avp_type; |
michael@17 | 64 | +static int_str realm_avp; |
michael@17 | 65 | +static int passwd_avp_type; |
michael@17 | 66 | +static int_str passwd_avp; |
michael@17 | 67 | |
michael@17 | 68 | struct gw_info **gws; /* Pointer to current gw table pointer */ |
michael@17 | 69 | struct gw_info *gws_1; /* Pointer to gw table 1 */ |
michael@17 | 70 | @@ -327,6 +354,12 @@ |
michael@17 | 71 | {"fr_inv_timer", INT_PARAM, &fr_inv_timer }, |
michael@17 | 72 | {"fr_inv_timer_next", INT_PARAM, &fr_inv_timer_next }, |
michael@17 | 73 | {"prefix_mode", INT_PARAM, &prefix_mode_param }, |
michael@17 | 74 | + {"user_column", STR_PARAM, &user_col.s }, |
michael@17 | 75 | + {"realm_column", STR_PARAM, &realm_col.s }, |
michael@17 | 76 | + {"passwd_column", STR_PARAM, &passwd_col.s }, |
michael@17 | 77 | + {"auth_username_avp", STR_PARAM, &user_avp_param }, |
michael@17 | 78 | + {"auth_realm_avp", STR_PARAM, &realm_avp_param }, |
michael@17 | 79 | + {"auth_password_avp", STR_PARAM, &passwd_avp_param }, |
michael@17 | 80 | {0, 0, 0} |
michael@17 | 81 | }; |
michael@17 | 82 | |
michael@17 | 83 | @@ -438,6 +471,9 @@ |
michael@17 | 84 | prefix_col.len = strlen(prefix_col.s); |
michael@17 | 85 | from_uri_col.len = strlen(from_uri_col.s); |
michael@17 | 86 | priority_col.len = strlen(priority_col.s); |
michael@17 | 87 | + user_col.len = strlen(user_col.s); |
michael@17 | 88 | + realm_col.len = strlen(realm_col.s); |
michael@17 | 89 | + passwd_col.len = strlen(passwd_col.s); |
michael@17 | 90 | |
michael@17 | 91 | /* Bind database */ |
michael@17 | 92 | if (lcr_db_bind(&db_url)) { |
michael@17 | 93 | @@ -563,6 +599,60 @@ |
michael@17 | 94 | return -1; |
michael@17 | 95 | } |
michael@17 | 96 | |
michael@17 | 97 | + if (user_avp_param && *user_avp_param) { |
michael@17 | 98 | + s.s = user_avp_param; s.len = strlen(s.s); |
michael@17 | 99 | + if (pv_parse_spec(&s, &avp_spec)==0 |
michael@17 | 100 | + || avp_spec.type!=PVT_AVP) { |
michael@17 | 101 | + LM_ERR("Malformed or non AVP definition <%s>\n", user_avp_param); |
michael@17 | 102 | + return -1; |
michael@17 | 103 | + } |
michael@17 | 104 | + |
michael@17 | 105 | + if(pv_get_avp_name(0, &(avp_spec.pvp), &user_avp, &avp_flags)!=0) { |
michael@17 | 106 | + LM_ERR("Invalid AVP definition <%s>\n", user_avp_param); |
michael@17 | 107 | + return -1; |
michael@17 | 108 | + } |
michael@17 | 109 | + user_avp_type = avp_flags; |
michael@17 | 110 | + } else { |
michael@17 | 111 | + LM_ERR("AVP user_avp has not been defined\n"); |
michael@17 | 112 | + return -1; |
michael@17 | 113 | + } |
michael@17 | 114 | + |
michael@17 | 115 | + if (realm_avp_param && *realm_avp_param) { |
michael@17 | 116 | + s.s = realm_avp_param; s.len = strlen(s.s); |
michael@17 | 117 | + if (pv_parse_spec(&s, &avp_spec)==0 |
michael@17 | 118 | + || avp_spec.type!=PVT_AVP) { |
michael@17 | 119 | + LM_ERR("Malformed or non AVP definition <%s>\n", realm_avp_param); |
michael@17 | 120 | + return -1; |
michael@17 | 121 | + } |
michael@17 | 122 | + |
michael@17 | 123 | + if(pv_get_avp_name(0, &(avp_spec.pvp), &realm_avp, &avp_flags)!=0) { |
michael@17 | 124 | + LM_ERR("Invalid AVP definition <%s>\n", realm_avp_param); |
michael@17 | 125 | + return -1; |
michael@17 | 126 | + } |
michael@17 | 127 | + realm_avp_type = avp_flags; |
michael@17 | 128 | + } else { |
michael@17 | 129 | + LM_ERR("AVP realm_avp has not been defined\n"); |
michael@17 | 130 | + return -1; |
michael@17 | 131 | + } |
michael@17 | 132 | + |
michael@17 | 133 | + if (passwd_avp_param && *passwd_avp_param) { |
michael@17 | 134 | + s.s = passwd_avp_param; s.len = strlen(s.s); |
michael@17 | 135 | + if (pv_parse_spec(&s, &avp_spec)==0 |
michael@17 | 136 | + || avp_spec.type!=PVT_AVP) { |
michael@17 | 137 | + LM_ERR("Malformed or non AVP definition <%s>\n", passwd_avp_param); |
michael@17 | 138 | + return -1; |
michael@17 | 139 | + } |
michael@17 | 140 | + |
michael@17 | 141 | + if(pv_get_avp_name(0, &(avp_spec.pvp), &passwd_avp, &avp_flags)!=0) { |
michael@17 | 142 | + LM_ERR("Invalid AVP definition <%s>\n", passwd_avp_param); |
michael@17 | 143 | + return -1; |
michael@17 | 144 | + } |
michael@17 | 145 | + passwd_avp_type = avp_flags; |
michael@17 | 146 | + } else { |
michael@17 | 147 | + LM_ERR("AVP passwd_avp has not been defined\n"); |
michael@17 | 148 | + return -1; |
michael@17 | 149 | + } |
michael@17 | 150 | + |
michael@17 | 151 | /* Check table version */ |
michael@17 | 152 | db_con_t* dbh; |
michael@17 | 153 | if (lcr_dbf.init==0){ |
michael@17 | 154 | @@ -801,16 +891,17 @@ |
michael@17 | 155 | int reload_gws(void) |
michael@17 | 156 | { |
michael@17 | 157 | unsigned int i, port, strip, tag_len, prefix_len, from_uri_len, |
michael@17 | 158 | - grp_id, priority; |
michael@17 | 159 | + user_len, realm_len, passwd_len, grp_id, priority; |
michael@17 | 160 | struct in_addr ip_addr; |
michael@17 | 161 | unsigned int flags; |
michael@17 | 162 | uri_type scheme; |
michael@17 | 163 | uri_transport transport; |
michael@17 | 164 | db_con_t* dbh; |
michael@17 | 165 | char *tag, *prefix, *from_uri; |
michael@17 | 166 | + char *user, *realm, *passwd; |
michael@17 | 167 | db_res_t* res = NULL; |
michael@17 | 168 | db_row_t* row; |
michael@17 | 169 | - db_key_t gw_cols[8]; |
michael@17 | 170 | + db_key_t gw_cols[11]; |
michael@17 | 171 | db_key_t lcr_cols[4]; |
michael@17 | 172 | |
michael@17 | 173 | gw_cols[0] = &ip_addr_col; |
michael@17 | 174 | @@ -823,6 +914,9 @@ |
michael@17 | 175 | in the two tables? (ge vw lcr) */ |
michael@17 | 176 | gw_cols[6] = &grp_id_col; |
michael@17 | 177 | gw_cols[7] = &flags_col; |
michael@17 | 178 | + gw_cols[8] = &user_col; |
michael@17 | 179 | + gw_cols[9] = &realm_col; |
michael@17 | 180 | + gw_cols[10] = &passwd_col; |
michael@17 | 181 | |
michael@17 | 182 | lcr_cols[0] = &prefix_col; |
michael@17 | 183 | lcr_cols[1] = &from_uri_col; |
michael@17 | 184 | @@ -846,7 +940,7 @@ |
michael@17 | 185 | return -1; |
michael@17 | 186 | } |
michael@17 | 187 | |
michael@17 | 188 | - if (lcr_dbf.query(dbh, NULL, 0, NULL, gw_cols, 0, 8, 0, &res) < 0) { |
michael@17 | 189 | + if (lcr_dbf.query(dbh, NULL, 0, NULL, gw_cols, 0, 11, 0, &res) < 0) { |
michael@17 | 190 | LM_ERR("Failed to query gw data\n"); |
michael@17 | 191 | lcr_dbf.close(dbh); |
michael@17 | 192 | return -1; |
michael@17 | 193 | @@ -938,6 +1032,45 @@ |
michael@17 | 194 | lcr_dbf.close(dbh); |
michael@17 | 195 | return -1; |
michael@17 | 196 | } |
michael@17 | 197 | + if (VAL_NULL(ROW_VALUES(row) + 8) == 1) { |
michael@17 | 198 | + user_len = 0; |
michael@17 | 199 | + user = (char *)0; |
michael@17 | 200 | + } else { |
michael@17 | 201 | + user = (char *)VAL_STRING(ROW_VALUES(row) + 8); |
michael@17 | 202 | + user_len = strlen(user); |
michael@17 | 203 | + if (user_len > MAX_USER_LEN) { |
michael@17 | 204 | + LM_ERR("Too long gw user <%u>\n", user_len); |
michael@17 | 205 | + lcr_dbf.free_result(dbh, res); |
michael@17 | 206 | + lcr_dbf.close(dbh); |
michael@17 | 207 | + return -1; |
michael@17 | 208 | + } |
michael@17 | 209 | + } |
michael@17 | 210 | + if (VAL_NULL(ROW_VALUES(row) + 9) == 1) { |
michael@17 | 211 | + realm_len = 0; |
michael@17 | 212 | + realm = (char *)0; |
michael@17 | 213 | + } else { |
michael@17 | 214 | + realm = (char *)VAL_STRING(ROW_VALUES(row) + 9); |
michael@17 | 215 | + realm_len = strlen(realm); |
michael@17 | 216 | + if (realm_len > MAX_REALM_LEN) { |
michael@17 | 217 | + LM_ERR("Too long gw realm <%u>\n", realm_len); |
michael@17 | 218 | + lcr_dbf.free_result(dbh, res); |
michael@17 | 219 | + lcr_dbf.close(dbh); |
michael@17 | 220 | + return -1; |
michael@17 | 221 | + } |
michael@17 | 222 | + } |
michael@17 | 223 | + if (VAL_NULL(ROW_VALUES(row) + 10) == 1) { |
michael@17 | 224 | + passwd_len = 0; |
michael@17 | 225 | + passwd = (char *)0; |
michael@17 | 226 | + } else { |
michael@17 | 227 | + passwd = (char *)VAL_STRING(ROW_VALUES(row) + 10); |
michael@17 | 228 | + passwd_len = strlen(passwd); |
michael@17 | 229 | + if (passwd_len > MAX_PASSWD_LEN) { |
michael@17 | 230 | + LM_ERR("Too long gw passwd <%u>\n", passwd_len); |
michael@17 | 231 | + lcr_dbf.free_result(dbh, res); |
michael@17 | 232 | + lcr_dbf.close(dbh); |
michael@17 | 233 | + return -1; |
michael@17 | 234 | + } |
michael@17 | 235 | + } |
michael@17 | 236 | if (*gws == gws_1) { |
michael@17 | 237 | gws_2[i].ip_addr = (unsigned int)ip_addr.s_addr; |
michael@17 | 238 | gws_2[i].port = port; |
michael@17 | 239 | @@ -949,6 +1082,15 @@ |
michael@17 | 240 | gws_2[i].tag_len = tag_len; |
michael@17 | 241 | if (tag_len) |
michael@17 | 242 | memcpy(&(gws_2[i].tag[0]), tag, tag_len); |
michael@17 | 243 | + gws_2[i].user_len = user_len; |
michael@17 | 244 | + if (user_len) |
michael@17 | 245 | + memcpy(&(gws_2[i].user[0]), user, user_len); |
michael@17 | 246 | + gws_2[i].realm_len = realm_len; |
michael@17 | 247 | + if (realm_len) |
michael@17 | 248 | + memcpy(&(gws_2[i].realm[0]), realm, realm_len); |
michael@17 | 249 | + gws_2[i].passwd_len = passwd_len; |
michael@17 | 250 | + if (passwd_len) |
michael@17 | 251 | + memcpy(&(gws_2[i].passwd[0]), passwd, passwd_len); |
michael@17 | 252 | } else { |
michael@17 | 253 | gws_1[i].ip_addr = (unsigned int)ip_addr.s_addr; |
michael@17 | 254 | gws_1[i].port = port; |
michael@17 | 255 | @@ -960,6 +1102,15 @@ |
michael@17 | 256 | gws_1[i].tag_len = tag_len; |
michael@17 | 257 | if (tag_len) |
michael@17 | 258 | memcpy(&(gws_1[i].tag[0]), tag, tag_len); |
michael@17 | 259 | + gws_1[i].user_len = user_len; |
michael@17 | 260 | + if (user_len) |
michael@17 | 261 | + memcpy(&(gws_1[i].user[0]), user, user_len); |
michael@17 | 262 | + gws_1[i].realm_len = realm_len; |
michael@17 | 263 | + if (realm_len) |
michael@17 | 264 | + memcpy(&(gws_1[i].realm[0]), realm, realm_len); |
michael@17 | 265 | + gws_1[i].passwd_len = passwd_len; |
michael@17 | 266 | + if (passwd_len) |
michael@17 | 267 | + memcpy(&(gws_1[i].passwd[0]), passwd, passwd_len); |
michael@17 | 268 | } |
michael@17 | 269 | } |
michael@17 | 270 | |
michael@17 | 271 | @@ -1141,6 +1292,21 @@ |
michael@17 | 272 | attr = add_mi_attr(node, MI_DUP_VALUE, "FLAGS", 5, p, len); |
michael@17 | 273 | if(attr == NULL) |
michael@17 | 274 | return -1; |
michael@17 | 275 | + |
michael@17 | 276 | + attr = add_mi_attr(node, MI_DUP_VALUE, "USER", 6, |
michael@17 | 277 | + (*gws)[i].user, (*gws)[i].user_len ); |
michael@17 | 278 | + if(attr == NULL) |
michael@17 | 279 | + return -1; |
michael@17 | 280 | + |
michael@17 | 281 | + attr = add_mi_attr(node, MI_DUP_VALUE, "REALM", 6, |
michael@17 | 282 | + (*gws)[i].realm, (*gws)[i].realm_len ); |
michael@17 | 283 | + if(attr == NULL) |
michael@17 | 284 | + return -1; |
michael@17 | 285 | + |
michael@17 | 286 | + attr = add_mi_attr(node, MI_DUP_VALUE, "PASSWD", 6, |
michael@17 | 287 | + (*gws)[i].passwd, (*gws)[i].passwd_len ); |
michael@17 | 288 | + if(attr == NULL) |
michael@17 | 289 | + return -1; |
michael@17 | 290 | } |
michael@17 | 291 | |
michael@17 | 292 | for (i = 0; i < MAX_NO_OF_LCRS; i++) { |
michael@17 | 293 | @@ -1184,6 +1350,9 @@ |
michael@17 | 294 | char ruri[MAX_URI_SIZE]; |
michael@17 | 295 | unsigned int i, j, k, index, addr, port, strip, gw_index, |
michael@17 | 296 | duplicated_gw, flags, have_rpid_avp; |
michael@17 | 297 | + char *user; |
michael@17 | 298 | + char *realm; |
michael@17 | 299 | + char *passwd; |
michael@17 | 300 | uri_type scheme; |
michael@17 | 301 | uri_transport transport; |
michael@17 | 302 | struct ip_addr address; |
michael@17 | 303 | @@ -1407,6 +1576,9 @@ |
michael@17 | 304 | transport = (*gws)[index].transport; |
michael@17 | 305 | flags = (*gws)[index].flags; |
michael@17 | 306 | strip = (*gws)[index].strip; |
michael@17 | 307 | + user = (*gws)[index].user; |
michael@17 | 308 | + realm = (*gws)[index].realm; |
michael@17 | 309 | + passwd = (*gws)[index].passwd; |
michael@17 | 310 | if (strip > ruri_user.len) { |
michael@17 | 311 | LM_ERR("Strip count of gw is too large <%u>\n", strip); |
michael@17 | 312 | goto skip; |
michael@17 | 313 | @@ -1476,6 +1648,25 @@ |
michael@17 | 314 | val.s = value; |
michael@17 | 315 | add_avp(gw_uri_avp_type|AVP_VAL_STR, gw_uri_avp, val); |
michael@17 | 316 | LM_DBG("Added gw_uri_avp <%.*s>\n", value.len, value.s); |
michael@17 | 317 | + |
michael@17 | 318 | + value.s = user; |
michael@17 | 319 | + value.len = strlen(value.s); |
michael@17 | 320 | + val.s = value; |
michael@17 | 321 | + add_avp(user_avp_type|AVP_VAL_STR, user_avp, val); |
michael@17 | 322 | + LM_DBG("Added user_avp <%.*s>\n", value.len, value.s); |
michael@17 | 323 | + |
michael@17 | 324 | + value.s = realm; |
michael@17 | 325 | + value.len = strlen(value.s); |
michael@17 | 326 | + val.s = value; |
michael@17 | 327 | + add_avp(realm_avp_type|AVP_VAL_STR, realm_avp, val); |
michael@17 | 328 | + LM_DBG("Added realm_avp <%.*s>\n", value.len, value.s); |
michael@17 | 329 | + |
michael@17 | 330 | + value.s = passwd; |
michael@17 | 331 | + value.len = strlen(value.s); |
michael@17 | 332 | + val.s = value; |
michael@17 | 333 | + add_avp(passwd_avp_type|AVP_VAL_STR, passwd_avp, val); |
michael@17 | 334 | + LM_DBG("Added passwd_avp <%.*s>\n", value.len, value.s); |
michael@17 | 335 | + |
michael@17 | 336 | skip: |
michael@17 | 337 | continue; |
michael@17 | 338 | } |
michael@17 | 339 | @@ -1558,7 +1749,8 @@ |
michael@17 | 340 | static int next_gw(struct sip_msg* _m, char* _s1, char* _s2) |
michael@17 | 341 | { |
michael@17 | 342 | int_str gw_uri_val, ruri_user_val, val; |
michael@17 | 343 | - struct usr_avp *gu_avp, *ru_avp; |
michael@17 | 344 | + int_str user_val, realm_val, passwd_val; |
michael@17 | 345 | + struct usr_avp *gu_avp, *ru_avp, *usr_avp, *rlm_avp, *pwd_avp; |
michael@17 | 346 | int rval; |
michael@17 | 347 | str new_ruri; |
michael@17 | 348 | char *at, *at_char, *strip_char, *endptr; |
michael@17 | 349 | @@ -1575,6 +1767,35 @@ |
michael@17 | 350 | gw_uri_val.s.len = gw_uri_val.s.len - (at - gw_uri_val.s.s); |
michael@17 | 351 | gw_uri_val.s.s = at; |
michael@17 | 352 | |
michael@17 | 353 | + /* Save gateway AVPs for use in script */ |
michael@17 | 354 | + usr_avp = search_first_avp(user_avp_type, user_avp, &user_val, 0); |
michael@17 | 355 | + rlm_avp = search_first_avp(realm_avp_type, realm_avp, &realm_val, 0); |
michael@17 | 356 | + pwd_avp = search_first_avp(passwd_avp_type, passwd_avp, &passwd_val, 0); |
michael@17 | 357 | + if (!usr_avp) { |
michael@17 | 358 | + LM_DBG("User AVP no set\n"); |
michael@17 | 359 | + return -1; |
michael@17 | 360 | + } |
michael@17 | 361 | + else { |
michael@17 | 362 | + add_avp(user_avp_type|AVP_VAL_STR, user_avp, user_val); |
michael@17 | 363 | + LM_DBG("Added user_avp <%.*s>\n", user_val.s.len, user_val.s.s); |
michael@17 | 364 | + } |
michael@17 | 365 | + if (!rlm_avp) { |
michael@17 | 366 | + LM_DBG("Realm AVP no set\n"); |
michael@17 | 367 | + return -1; |
michael@17 | 368 | + } |
michael@17 | 369 | + else { |
michael@17 | 370 | + add_avp(realm_avp_type|AVP_VAL_STR, realm_avp, realm_val); |
michael@17 | 371 | + LM_DBG("Added realm_avp <%.*s>\n", realm_val.s.len, realm_val.s.s); |
michael@17 | 372 | + } |
michael@17 | 373 | + if (!pwd_avp) { |
michael@17 | 374 | + LM_DBG("Passwd AVP no set\n"); |
michael@17 | 375 | + return -1; |
michael@17 | 376 | + } |
michael@17 | 377 | + else { |
michael@17 | 378 | + add_avp(passwd_avp_type|AVP_VAL_STR, passwd_avp, passwd_val); |
michael@17 | 379 | + LM_DBG("Added passwd_avp <%.*s>\n", passwd_val.s.len, passwd_val.s.s); |
michael@17 | 380 | + } |
michael@17 | 381 | + |
michael@17 | 382 | /* Create new Request-URI taking URI user from ruri_user AVP |
michael@17 | 383 | and other parts of from gateway URI AVP. */ |
michael@17 | 384 | ru_avp = search_first_avp(ruri_user_avp_type, ruri_user_avp, |
michael@17 | 385 | Index: scripts/db_berkeley/opensips/gw |
michael@17 | 386 | diff -Nau scripts/db_berkeley/opensips/gw.orig scripts/db_berkeley/opensips/gw |
michael@17 | 387 | --- scripts/db_berkeley/opensips/gw.orig 2010-01-18 12:31:09.312068000 +0100 |
michael@17 | 388 | +++ scripts/db_berkeley/opensips/gw 2010-02-10 19:57:18.467214268 +0100 |
michael@17 | 389 | @@ -1,5 +1,5 @@ |
michael@17 | 390 | METADATA_COLUMNS |
michael@17 | 391 | -id(int) gw_name(str) grp_id(int) ip_addr(str) port(int) uri_scheme(int) transport(int) strip(int) tag(str) flags(int) |
michael@17 | 392 | +id(int) gw_name(str) grp_id(int) ip_addr(str) port(int) uri_scheme(int) transport(int) strip(int) tag(str) flags(int) user(str) realm(str) passwd(str) |
michael@17 | 393 | METADATA_KEY |
michael@17 | 394 | 1 |
michael@17 | 395 | METADATA_READONLY |
michael@17 | 396 | @@ -7,4 +7,4 @@ |
michael@17 | 397 | METADATA_LOGFLAGS |
michael@17 | 398 | 0 |
michael@17 | 399 | METADATA_DEFAULTS |
michael@17 | 400 | -NIL|NIL|NIL|NIL|NIL|NIL|NIL|NIL|NULL|0 |
michael@17 | 401 | +NIL|NIL|NIL|NIL|NIL|NIL|NIL|NIL|NULL|0|NULL|NULL|NULL |
michael@17 | 402 | Index: scripts/dbtext/opensips/gw |
michael@17 | 403 | diff -Nau scripts/dbtext/opensips/gw.orig scripts/dbtext/opensips/gw |
michael@17 | 404 | --- scripts/dbtext/opensips/gw.orig 2010-01-18 12:31:01.221183000 +0100 |
michael@17 | 405 | +++ scripts/dbtext/opensips/gw 2010-02-10 19:57:19.099512686 +0100 |
michael@17 | 406 | @@ -1 +1 @@ |
michael@17 | 407 | -id(int,auto) gw_name(string) grp_id(int) ip_addr(string) port(int,null) uri_scheme(int,null) transport(int,null) strip(int,null) tag(string,null) flags(int) |
michael@17 | 408 | +id(int,auto) gw_name(string) grp_id(int) ip_addr(string) port(int,null) uri_scheme(int,null) transport(int,null) strip(int,null) tag(string,null) flags(int) user(string,null) realm(string,null) passwd(string,null) |
michael@17 | 409 | Index: scripts/mysql/lcr-create.sql |
michael@17 | 410 | diff -Nau scripts/mysql/lcr-create.sql.orig scripts/mysql/lcr-create.sql |
michael@17 | 411 | --- scripts/mysql/lcr-create.sql.orig 2010-01-18 12:31:05.995635000 +0100 |
michael@17 | 412 | +++ scripts/mysql/lcr-create.sql 2010-02-10 20:00:24.123864285 +0100 |
michael@17 | 413 | @@ -10,6 +10,9 @@ |
michael@17 | 414 | strip TINYINT UNSIGNED, |
michael@17 | 415 | tag CHAR(16) DEFAULT NULL, |
michael@17 | 416 | flags INT UNSIGNED DEFAULT 0 NOT NULL, |
michael@17 | 417 | + user CHAR(16) DEFAULT NULL, |
michael@17 | 418 | + realm CHAR(16) DEFAULT NULL, |
michael@17 | 419 | + passwd CHAR(16) DEFAULT NULL, |
michael@17 | 420 | CONSTRAINT gw_name_idx UNIQUE (gw_name) |
michael@17 | 421 | ) ENGINE=MyISAM; |
michael@17 | 422 | |
michael@17 | 423 | Index: scripts/oracle/lcr-create.sql |
michael@17 | 424 | diff -Nau scripts/oracle/lcr-create.sql.orig scripts/oracle/lcr-create.sql |
michael@17 | 425 | --- scripts/oracle/lcr-create.sql.orig 2010-01-18 12:31:09.035730000 +0100 |
michael@17 | 426 | +++ scripts/oracle/lcr-create.sql 2010-02-10 20:00:23.643867960 +0100 |
michael@17 | 427 | @@ -10,6 +10,9 @@ |
michael@17 | 428 | strip NUMBER(5), |
michael@17 | 429 | tag VARCHAR2(16) DEFAULT NULL, |
michael@17 | 430 | flags NUMBER(10) DEFAULT 0 NOT NULL, |
michael@17 | 431 | + user VARCHAR2(16) DEFAULT NULL, |
michael@17 | 432 | + realm VARCHAR2(16) DEFAULT NULL, |
michael@17 | 433 | + passwd VARCHAR2(16) DEFAULT NULL, |
michael@17 | 434 | CONSTRAINT gw_gw_name_idx UNIQUE (gw_name) |
michael@17 | 435 | ); |
michael@17 | 436 | |
michael@17 | 437 | Index: scripts/postgres/lcr-create.sql |
michael@17 | 438 | diff -Nau scripts/postgres/lcr-create.sql.orig scripts/postgres/lcr-create.sql |
michael@17 | 439 | --- scripts/postgres/lcr-create.sql.orig 2010-01-18 12:31:09.151881000 +0100 |
michael@17 | 440 | +++ scripts/postgres/lcr-create.sql 2010-02-10 19:59:19.649196584 +0100 |
michael@17 | 441 | @@ -10,6 +10,9 @@ |
michael@17 | 442 | strip SMALLINT, |
michael@17 | 443 | tag VARCHAR(16) DEFAULT NULL, |
michael@17 | 444 | flags INTEGER DEFAULT 0 NOT NULL, |
michael@17 | 445 | + user VARCHAR(16) DEFAULT NULL, |
michael@17 | 446 | + realm VARCHAR(16) DEFAULT NULL, |
michael@17 | 447 | + passwd VARCHAR(16) DEFAULT NULL, |
michael@17 | 448 | CONSTRAINT gw_gw_name_idx UNIQUE (gw_name) |
michael@17 | 449 | ); |
michael@17 | 450 |