Well done Ken
Your changes all look correct to me.
I have added them to CVS, so they will be included in the next release
Michael
----- Original Message -----
From: "Ken Nonaka" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, January 10, 2004 3:03 AM
Subject: [vchkpw] [patch] 5.4.0-rc1 vpgsql.c
with --enable-ip-alias-domains=y
> Hi all who use pgsql module,
>
> I got compile errors.
>
> version: 5.4.0-rc1
> file: vpgsql.c
> option: --enable-ip-alias-domains=y
>
> #./configure \
> --enable-auth-module=pgsql \
> --enable-incdir=/usr/local/pgsql/include \
> --enable-libdir=/usr/local/pgsql/lib \
> --enable-roaming-users=y \
> --enable-relay-clear-minutes=10 \
> --enable-logging=y \
> --enable-pgsql-logging=y \
> --enable-defaultquota=10MB \
> --enable-ip-alias-domains=y
>
> # make
> ...
> vauth.c: In function `vget_ip_map':
> vauth.c:789: warning: implicit declaration of function `vauth_open_read'
> vauth.c: In function `vadd_ip_map':
> vauth.c:831: warning: conversion lacks type at end of format
> vauth.c:831: warning: too many arguments for format
> vauth.c:860: parse error before `int'
> vauth.c: In function `vshow_ip_map':
> vauth.c:892: warning: implicit declaration of function `open_read'
> vauth.c:901: `qr' undeclared (first use in this function)
> vauth.c:901: (Each undeclared identifier is reported only once
> vauth.c:901: for each function it appears in.)
> ...
>
> I compiled again using the following patch with no error.
> It may be the patch which fix errors but I'm not sure.
>
> Do you have any suggestion?
>
> --- vpgsql.c.5.4.0.rc1 Fri Jan 9 23:52:41 2004
> +++ vpgsql.c.5.4.0.rc1.2004-01-09 Sat Jan 10 00:37:14 2004
> @@ -786,7 +786,7 @@
>
> if ( ip == NULL || strlen(ip) <= 0 ) return(-1);
> if ( domain == NULL ) return(-2);
> - if ( vauth_open_read() != 0 ) return(-3);
> + if ( vauth_open() != 0 ) return(-3);
>
> snprintf(SqlBufRead, SQL_BUF_SIZE,
> "select domain from ip_alias_map where ip_addr = '%s'",
> @@ -827,7 +827,7 @@
> return(err);
> }
> snprintf(SqlBufUpdate,SQL_BUF_SIZE,
> - "delete from ip_alias_map where ip_addr='%s' and domain='%'",
> + "delete from ip_alias_map where ip_addr='%s' and domain='%s'",
> ip, domain);
>
> /* step 1: delete previous entry */
> @@ -853,8 +853,9 @@
> free(SqlBufUpdate);
> return -1;
> }
> - if( pgres ) PQclear(pgres);
> - return ( pg_end() ); /* end transaction */
> + }
> + if( pgres ) PQclear(pgres);
> + return ( pg_end() ); /* end transaction */
> }
>
> int vdel_ip_map( char *ip, char *domain)
> @@ -889,7 +890,7 @@
>
> if ( ip == NULL ) return(-1);
> if ( domain == NULL ) return(-1);
> - if ( ( err=open_read() ) != 0 ) return(err);
> + if ( ( err=vauth_open() ) != 0 ) return(err);
>
> if ( first == 1 ) {
> snprintf(SqlBufRead,SQL_BUF_SIZE,
> @@ -898,13 +899,13 @@
> PQclear(pgres);
> ntuples=ctuple=0;
> }
> - if ( ! (pgres=PQexec(pgc, qr))
> + if ( ! (pgres=PQexec(pgc, SqlBufRead))
> || PQresultStatus(pgres) != PGRES_TUPLES_OK ) {
> if(pgres) PQclear(pgres);
> snprintf(SqlBufRead,SQL_BUF_SIZE,
> "select ip_addr, domain from ip_alias_map");
> vcreate_ip_map_table();
> - if ( ! (pgres=PQexec(pgc, qr))
> + if ( ! (pgres=PQexec(pgc, SqlBufRead))
> || PQresultStatus(pgres) != PGRES_TUPLES_OK ) {
> return(0);
> }
>
>
> Regards,
>
> Ken
>
> --
> Ken Nonaka
> nonaka at imasy or jp
>