Re: Core dump on sql config errors

Sergey Poznyakoff <[email protected]> Tue, 25 Nov 2003 14:09:58 +0200
Newsgroups gmane.comp.gnu.radius.bugs
Organization Farlep-Internet
Message-ID <[email protected]>
Maurice Makaay <[email protected]> wrote:

> (even if do_acct is set to false) the server will crash. In the case 
> sql debugging is enabled, the server will trip over the statement
> debug(1, ("SQL init using: %s:%d,%s,%s,%s,%d,%ld,%d,%d",....) in 
> sql_check_config() which will try to print out NULL values.

Thanks!

> In the attached patch, the sql_check_config() is extended to have 
> better checking of the sql configuration and to provide defaults for
> variables which are not set in the sqlserver config file.

Hmm, I believe providing defaults in such case is not correct. Radiusd
should emit a critical error message and abort. I'll implement it this
way.

Besides, there is a subtle detail:

> +	if (!cfg->port) {
> +		radlog(L_WARN,
> +		       _("SQL: missing parameter '%s', reverting to '%s'"),
> +		       "port", "3306");
> +		cfg->port = 3306;
> +	}

Port is optional. Omitting it is OK for any interface type.

Regards,
Sergey