[OpenSER-Users] Permissions Module
Kelvin Williams
kelvin-lists at williamschadwell.com
Mon Jun 25 17:02:25 CEST 2007
Many thanks Klaus.
Changing the data type to integer worked perfectly.
In postgresqldb.sh, someone may want to modify the create table statement:
CREATE TABLE address (
id $AUTO_INCREMENT,
grp smallint NOT NULL default '0',
ip_addr varchar(15) NOT NULL default '',
mask $TINYINT NOT NULL default 32,
port smallint NOT NULL default '0'
) $TABLE_TYPE;
As the $TINYINT variable is defined in postgresqldb.sh as:
TINYINT="NUMERIC(4,0)"
Thanks,
kw
-----Original Message-----
From: Klaus Darilion [mailto:klaus.mailinglists at pernau.at]
Sent: Monday, June 25, 2007 3:13 AM
To: Kelvin Williams
Cc: users at openser.org
Subject: Re: [OpenSER-Users] Permissions Module
in address.c:
119 val = ROW_VALUES(row + i);
120 if ((ROW_N(row + i) == 4) &&
121 (VAL_TYPE(val) == DB_INT) && !VAL_NULL(val) &&
122 (VAL_TYPE(val + 1) == DB_STRING) && !VAL_NULL(val + 1) &&
123 inet_aton((char *)VAL_STRING(val + 1), &ip_addr) != 0 &&
124 (VAL_TYPE(val + 2) == DB_INT) && !VAL_NULL(val + 2) &&
125 ((unsigned int)VAL_INT(val + 2) > 0) &&
126 ((unsigned int)VAL_INT(val + 2) <= 32) &&
127 (VAL_TYPE(val + 3) == DB_INT) && !VAL_NULL(val + 3)) {
128 if ((unsigned int)VAL_INT(val + 2) == 32) {
129 if (addr_hash_table_insert(new_hash_table,
130 (unsigned int)VAL_INT(val),
131 (unsigned int)ip_addr.s_addr,
132 (unsigned int)VAL_INT(val + 3))
133 == -1) {
I guess this check fails: (VAL_TYPE(val + 3) == DB_INT)
as the mask is returned as DOUBLE from postgres:
Jun 25 08:56:41 ds3000 /usr/sbin/openser[19796]: PG[convert_row]: col[0]
Jun 25 08:56:41 ds3000 /usr/sbin/openser[19796]: PG[str2val]: Converting
INT [0]
Jun 25 08:56:41 ds3000 /usr/sbin/openser[19796]: PG[convert_row]: col[1]
Jun 25 08:56:41 ds3000 /usr/sbin/openser[19796]: PG[str2val]: Converting
STRING [192.168.1.100]
Jun 25 08:56:41 ds3000 /usr/sbin/openser[19796]: PG[convert_row]: col[2]
Jun 25 08:56:41 ds3000 /usr/sbin/openser[19796]: PG[str2val]: Converting
DOUBLE [32]
Jun 25 08:56:41 ds3000 /usr/sbin/openser[19796]: PG[convert_row]: col[3]
Jun 25 08:56:41 ds3000 /usr/sbin/openser[19796]: PG[str2val]: Converting
INT [5060]
try to change the table definition.
regards
klaus
Kelvin Williams wrote:
> Does anyone have Openser 1.2, with PostgreSQL 8.2.4 and the Permissions
> module working with at least one entry in the address table?
>
>
>
> If anyone has Openser 1.2 and PostgreSQL 8.2.4 running in combination,
could
> you see if you can duplicate this problem? Any time any entry is in the
> address table, OpenSER will not start, reporting this error:
>
>
>
> openser=# select * from address;
>
> id | grp | ip_addr | mask | port
>
> ----+-----+---------+------+------
>
> (0 rows)
>
>
>
> Starts fine!
>
>
>
> openser=# insert into address (grp, ip_addr, mask, port) values (0,
> '192.168.1.100',32, 5060);
>
> INSERT 0 1
>
> openser=# select * from address;
>
> id | grp | ip_addr | mask | port
>
> ----+-----+---------------+------+------
>
> 5 | 0 | 192.168.1.100 | 32 | 5060
>
> (1 row)
>
>
>
> openser=#
>
>
>
> Jun 23 16:55:47 gaia /usr/local/sbin/openser[24163]: ERROR: permissions:
> address_reload(): Database problem
>
> Jun 23 16:55:47 gaia /usr/local/sbin/openser[24163]:
> permissions:init_addresses(): Reload of address table failed
>
> Jun 23 16:55:47 gaia /usr/local/sbin/openser[24163]: Error while
> initializing allow_address function
>
> Jun 23 16:55:47 gaia /usr/local/sbin/openser[24163]: init_mod(): Error
while
> initializing module permissions
>
>
>
>
>
> Thanks in advance,
>
> kw
>
>
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Users mailing list
> Users at openser.org
> http://openser.org/cgi-bin/mailman/listinfo/users
More information about the Users
mailing list