Skip to contentSkip to conversation

ulogd 1.24 mysql bad identification

PATCH Applied [email protected] 3 participants 5 messages Jul 22, 2007 – Jul 26, 2007 netfilter

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ulogd 1.24 mysql bad identification

Hi list,

trying to build ulogd-1.24, ./configure give me a warning, leading to a bad identification in the mysql :

....
checking for MySQL files... found mysql_config in /usr/bin checking for mysql_real_escape_string support... strings: invalid option -- L
Usage: strings [option(s)] [file(s)]
Display printable strings in [file(s)] (stdin by default)
The options are:

  -a - --all                Scan the entire file, not just the data section
  -f --print-file-name      Print the name of the file before each string
  -n --bytes=[number]       Locate & print any NUL-terminated sequence of at
  -<number>                 least [number] characters (default 4).
  -t --radix={o,d,x}        Print the location of the string in base 8, 10 or 16
  -o                        An alias for --radix=o
  -T --target=<BFDNAME>     Specify the binary file format
  -e --encoding={s,S,b,l,B,L} Select character size and endianness:
                            s = 7-bit, S = 8-bit, {b,l} = 16-bit, {B,L} = 32-bit

-h --help Display this information
-v --version Print the program's version number
strings: supported targets: elf32-i386 a.out-i386-linux efi-app-ia32 elf32-little elf32-big srec symbolsrec tekhex binary ihex trad-core found old MySQL
.....

after some digging in the lists archives, it looks like ulogd 1.x support looks nearly "abandoned" ...

As I, and certainly some more people are, am "stucked" with kernel 2.4.x, working on a live-cd firewall distro(devil-linux), I tried to fix the problem by myself; As I'm not developper and a "bad bash scripting guy", the patch may not be optimal but it solves the issue, at least for me :

....
checking for MySQL files... found mysql_config in /usr/bin checking for mysql_real_escape_string support... found new MySQL creating ./config.status
....

So, as it may help some folks around, I send it on this mailling-list ...

configure 2007-07-22 17:18:17.000000000 -0500 renamed from configure.old 2007-07-22 17:24:37.000000000 -0500 +1 -1
@@ -1728,7 +1728,7 @@
 EOF
 
         MYSQLINCLUDES=`$d/mysql_config --include`
-        MYSQLLIBS=`$d/mysql_config --libs`
+        MYSQLLIBS=`$d/mysql_config --libs | awk '{ print $1 }' | cut -c3-`
 
        DATABASE_DIR="${DATABASE_DIR} mysql"
 

Thank you all for the fantastic job done,

Best Regards,

MaNU ESCaR

#1 lore raw
Quoted 6 lines · On Jul 23 2007 01:43, [email protected] wrote:

checking for MySQL files... found mysql_config in /usr/bin checking for mysql_real_escape_string support... strings: invalid option -- L
Usage: strings [option(s)] [file(s)]
Display printable strings in [file(s)] (stdin by default)

So, as it may help some folks around, I send it on this mailling-list ...

No, the configure script is fundamentally broken.

        MYSQLLIBS=`$d/mysql_config --libs`

...

        MYSQL_FUNCTION_TEST=`strings ${MYSQLLIBS}/libmysqlclient.so |
	grep mysql_real_escape_string

Which is really wrong, because mysql_config --libs returns *linker flags*, not a directory. A better fix is to replace it with

AC_SEARCH_LIBS(mysql_real_escape_string, mysqlclient_r mysqlclient,

	[
		AC_MSG_NOTICE([found old MySQL])
		EXTRA_MYSQL_DEF="-DOLD_MYSQL=1"
	],
	[
		AC_MSG_NOTICE([found new MySQL])
	])

(untested)

Jan

#2 lore raw

Hi,

Quoted 33 lines · Jan Engelhardt
Quoted 7 lines · On Jul 23 2007 01:43, [email protected] wrote:

checking for MySQL files... found mysql_config in /usr/bin checking for mysql_real_escape_string support... strings: invalid option -- L
Usage: strings [option(s)] [file(s)]
Display printable strings in [file(s)] (stdin by default)

So, as it may help some folks around, I send it on this mailling-list ...

No, the configure script is fundamentally broken.

        MYSQLLIBS=`$d/mysql_config --libs`

...

        MYSQL_FUNCTION_TEST=`strings ${MYSQLLIBS}/libmysqlclient.so |
	grep mysql_real_escape_string

Which is really wrong, because mysql_config --libs returns *linker flags*, not a directory. A better fix is to replace it with

AC_SEARCH_LIBS(mysql_real_escape_string, mysqlclient_r mysqlclient,

	[
		AC_MSG_NOTICE([found old MySQL])
		EXTRA_MYSQL_DEF="-DOLD_MYSQL=1"
	],
	[
		AC_MSG_NOTICE([found new MySQL])
	])
Quoted 6 lines

(untested)

Jan

tested it :

....
checking for strerror... (cached) yes
./configure: line 1762: syntax error near unexpected token `mysql_real_escape_string,'
./configure: line 1762: `AC_SEARCH_LIBS(mysql_real_escape_string, mysqlclient_r mysqlclient,'

So as I don't understand your things (don't know if AC_SEARCH_LIBS is a predefined function somewhere...) as I am not any kind of developper, only a poor little wanabe hacker, I continue my way as I understand that by modifying the content of MYSQLLIBS, I may break some other things (really stupid !), I now use MYSQLLIBSDIR to store the directory;

so maybe this is more correct :

configure 2007-07-23 13:00:26.000000000 +0200 renamed from configure 2006-01-25 12:15:22.000000000 +0100 +1 -1
@@ -1729,6 +1729,7 @@
 
         MYSQLINCLUDES=`$d/mysql_config --include`
         MYSQLLIBS=`$d/mysql_config --libs`
+       MYSQLLIBSDIR=`$d/mysql_config --libs | awk '{ print $1 }' | cut
-c3-`
 
        DATABASE_DIR="${DATABASE_DIR} mysql"

@@ -1747,7 +1748,7 @@
echo $ac_n "checking for mysql_real_escape_string support""...
$ac_c" 1>&6
echo "configure:1749: checking for mysql_real_escape_string support" >&5

- MYSQL_FUNCTION_TEST=`strings ${MYSQLLIBS}/libmysqlclient.so |
grep mysql_real_escape_string`
+ MYSQL_FUNCTION_TEST=`strings ${MYSQLLIBSDIR}/libmysqlclient.so |
grep mysql_real_escape_string`

if test "x$MYSQL_FUNCTION_TEST" = x
then

Tested it on two hosts with different locations for libmysqlclient.so and it give the good path in both case.

Best Regards,

MaNU

#3 lore raw
configure.in +2 -10
Index: ulogd-1.24/configure.in
===================================================================
@@ -60,7 +60,6 @@ then
 else
         AC_DEFINE(HAVE_MYSQL)
         MYSQLINCLUDES=`$d/mysql_config --include`
-        MYSQLLIBS=`$d/mysql_config --libs`
 
 	DATABASE_DIR="${DATABASE_DIR} mysql"
 
@@ -83,15 +82,8 @@ else
 
 	AC_MSG_CHECKING(for mysql_real_escape_string support)
 
-	MYSQL_FUNCTION_TEST=`strings ${MYSQLLIBS}/libmysqlclient.so | grep mysql_real_escape_string`
-
-	if test "x$MYSQL_FUNCTION_TEST" = x
-	then
-                EXTRA_MYSQL_DEF="-DOLD_MYSQL=1 "
-                AC_MSG_RESULT(found old MySQL)
-	else
-		AC_MSG_RESULT(found new MySQL)
-	fi
+	AC_SEARCH_LIBS(mysql_real_escape_string, mysqlclient_r mysqlclient,
+		[EXTRA_MYSQL_DEF="-DOLD_MYSQL=1"])
 
 fi      
 ])      
maintainer Applied
#4 lore raw

Applied, thanks Jan.

Signature · 3 lines
"Países en desarrollo es el nombre con que los expertos designan a los
países arrollados por el desarrollo ajeno" -- Patas Arriba. La Escuela
del Mundo al Revés -- E. Galeano