Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 21 Jun 2005 10:47:35 GMT
From:      Oliver Dumat <odumat@netkom-sachsen.de>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   ports/82476: libnss-mysql does not lookup over tcp to a other database server but it works over the local socket
Message-ID:  <200506211047.j5LAlZOC012533@www.freebsd.org>
Resent-Message-ID: <200506211050.j5LAoSnO030919@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         82476
>Category:       ports
>Synopsis:       libnss-mysql does not lookup over tcp to a other database server but it works over the local socket
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Jun 21 10:50:27 GMT 2005
>Closed-Date:
>Last-Modified:
>Originator:     Oliver Dumat
>Release:        5.4-RELEASE
>Organization:
NetKom GmbH (www.netkom-sachsen.de)
>Environment:
FreeBSD hal 5.4-RELEASE FreeBSD 5.4-RELEASE #0: Sun May  8 10:21:06 UTC 2005     root@harlow.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC  i386
>Description:
Using libnss-mysql-1.4 for looking up on a database server doesn't work.
I verify the following:
- no firewall blockes the connection on the database server
- mysql on the database server is correctly configured and the permissions for the database and the user are set correctly ( the console mysqlclient works perfectly )
- querying through a socket on the local mysql database works 

as you can see in the debug log the mysql connection attempts return a NSS_UNAVAIL .
maybe it helps: ive tested the same thing on a linux machine (querys adapted to fit the passwd entrys of linux but the same databaseserver and the same database) and it works without problems.

i sniffed the connection between my freebsd server and the database server - the connection will established and then reseted from the freebsd machine - no data is exchanged (not even the version from the database server).




some debug logs:

/var/log/messages:

Jun 21 12:19:07 hal id: libnss-mysql: Connection to server 'db.databaseserver.local' failed: Can't connect to MySQL server on 'db.databaseserver.local' (22)

libnss-mysql-debug-log:

[5159]: _nss_mysql_load_config: ENTER
[5159]: _nss_mysql_load_config_file: ENTER
[5159]: _nss_mysql_load_config_file: Attempting to load: /etc/libnss-mysql.cfg
[5159]: _nss_mysql_load_config_file: fopen() successful
[5159]: _nss_mysql_next_key: ENTER
[5159]: _nss_mysql_next_key: Found: getpwnam -> SELECT domain,'*',sys_user_id + 2000,webspace,'','0','0','World Wide Web Owner',CONCAT('/www/hostings/',domain),'/bin/false' FROM access WHERE domain='%1$s' LIMIT 1 
[5159]: _nss_mysql_next_key: EXIT (TRUE)
[5159]: _nss_mysql_next_key: ENTER
[5159]: _nss_mysql_next_key: Found: getpwuid -> SELECT domain,'*',sys_user_id + 2000,webspace,'','0','0','World Wide Web Owner',CONCAT('/www/hostings/',domain),'/bin/false' FROM access WHERE sys_user_id + 2000 ='%1$s' LIMIT 1
[5159]: _nss_mysql_next_key: EXIT (TRUE)
[5159]: _nss_mysql_next_key: ENTER
[5159]: _nss_mysql_next_key: Found: getpwent -> SELECT domain,'*',sys_user_id + 2000,webspace,'','0','0','World Wide Web Owner',CONCAT('/www/hostings/',domain),'/bin/false' FROM access
[5159]: _nss_mysql_next_key: EXIT (TRUE)
[5159]: _nss_mysql_next_key: ENTER
[5159]: _nss_mysql_next_key: Found: getgrnam -> SELECT domain,pass,webspace FROM access WHERE domain='%1$s' LIMIT 1
[5159]: _nss_mysql_next_key: EXIT (TRUE)
[5159]: _nss_mysql_next_key: ENTER
[5159]: _nss_mysql_next_key: Found: getgrgid -> SELECT groupname,'*',gid FROM groups WHERE gid='%1$u' LIMIT 1
[5159]: _nss_mysql_next_key: EXIT (TRUE)
[5159]: _nss_mysql_next_key: ENTER
[5159]: _nss_mysql_next_key: Found: getgrent -> SELECT domain,pass,webspace FROM access
[5159]: _nss_mysql_next_key: EXIT (TRUE)
[5159]: _nss_mysql_next_key: ENTER
[5159]: _nss_mysql_next_key: Found: memsbygid -> SELECT domain FROM access WHERE webspace='%1$u'
[5159]: _nss_mysql_next_key: EXIT (TRUE)
[5159]: _nss_mysql_next_key: ENTER
[5159]: _nss_mysql_next_key: Found: gidsbymem -> SELECT webspace FROM access WHERE domain='%1$s'
[5159]: _nss_mysql_next_key: EXIT (TRUE)
[5159]: _nss_mysql_next_key: ENTER
[5159]: _nss_mysql_next_key: Found: host -> db.databaseserver.local
[5159]: _nss_mysql_next_key: EXIT (TRUE)
[5159]: _nss_mysql_next_key: ENTER
[5159]: _nss_mysql_next_key: Found: database -> testdb
[5159]: _nss_mysql_next_key: EXIT (TRUE)
[5159]: _nss_mysql_next_key: ENTER
[5159]: _nss_mysql_next_key: Found: username -> username
[5159]: _nss_mysql_next_key: EXIT (TRUE)
[5159]: _nss_mysql_next_key: ENTER
[5159]: _nss_mysql_next_key: Found: password -> password
[5159]: _nss_mysql_next_key: EXIT (TRUE)
[5159]: _nss_mysql_next_key: ENTER
[5159]: _nss_mysql_next_key: Found: port -> 3306
[5159]: _nss_mysql_next_key: EXIT (TRUE)
[5159]: _nss_mysql_next_key: ENTER
[5159]: _nss_mysql_next_key: EXIT (FALSE)
[5159]: _nss_mysql_load_config_file: EXIT
[5159]: _nss_mysql_load_config_file: ENTER
[5159]: _nss_mysql_load_config_file: Attempting to load: /etc/libnss-mysql-root.cfg
[5159]: _nss_mysql_load_config_file: fopen() successful
[5159]: _nss_mysql_next_key: ENTER
[5159]: _nss_mysql_next_key: Found: getpwnam -> SELECT domain,'*',sys_user_id + 2000,webspace,'','0','0','1World Wide Web Owner',CONCAT('/www/hostings/',domain),'/bin/false' FROM access WHERE domain='%1$s' LIMIT 1
[5159]: _nss_mysql_next_key: EXIT (TRUE)
[5159]: _nss_mysql_next_key: ENTER
[5159]: _nss_mysql_next_key: Found: getpwuid -> SELECT domain,'*',sys_user_id + 2000,webspace,'','0','0','2World Wide Web Owner',CONCAT('/www/hostings/',domain),'/bin/false' FROM access WHERE sys_user_id + 2000 ='%1$u' LIMIT 1
[5159]: _nss_mysql_next_key: EXIT (TRUE)
[5159]: _nss_mysql_next_key: ENTER
[5159]: _nss_mysql_next_key: Found: getpwent -> SELECT domain,'*',sys_user_id + 2000,webspace,'','0','0','3World Wide Web Owner',CONCAT('/www/hostings/',domain),'/bin/false' FROM access
[5159]: _nss_mysql_next_key: EXIT (TRUE)
[5159]: _nss_mysql_next_key: ENTER
[5159]: _nss_mysql_next_key: Found: host -> db.databaseserver.local
[5159]: _nss_mysql_next_key: EXIT (TRUE)
[5159]: _nss_mysql_next_key: ENTER
[5159]: _nss_mysql_next_key: Found: database -> testdb
[5159]: _nss_mysql_next_key: EXIT (TRUE)
[5159]: _nss_mysql_next_key: ENTER
[5159]: _nss_mysql_next_key: Found: username -> username
[5159]: _nss_mysql_next_key: EXIT (TRUE)
[5159]: _nss_mysql_next_key: ENTER
[5159]: _nss_mysql_next_key: Found: password -> password
[5159]: _nss_mysql_next_key: EXIT (TRUE)
[5159]: _nss_mysql_next_key: ENTER
[5159]: _nss_mysql_next_key: Found: port -> 3306
[5159]: _nss_mysql_next_key: EXIT (TRUE)
[5159]: _nss_mysql_next_key: ENTER
[5159]: _nss_mysql_next_key: EXIT (FALSE)
[5159]: _nss_mysql_load_config_file: EXIT
[5159]: _nss_mysql_validate_config: ENTER
[5159]: _nss_mysql_validate_config: EXIT (TRUE)
[5159]: _nss_mysql_load_config: EXIT (NSS_SUCCESS)
[5159]: _nss_mysql_init: EXIT (NSS_SUCCESS)
[5159]: _nss_mysql_load_config: ENTER
[5159]: _nss_mysql_load_config: EXIT (NSS_SUCCESS)
[5159]: _nss_mysql_build_query: ENTER
[5159]: _nss_mysql_build_query: BYNAME, name = 'username'
[5159]: _nss_mysql_escape_string: ENTER
[5159]: _nss_mysql_connect_sql: ENTER
[5159]: _nss_mysql_check_existing_connection: ENTER
[5159]: _nss_mysql_check_existing_connection: EXIT (FALSE)
[5159]: _nss_mysql_load_config: ENTER
[5159]: _nss_mysql_load_config: EXIT (NSS_SUCCESS)
[5159]: _nss_mysql_set_options: ENTER
[5159]: _nss_mysql_set_options: EXIT
[5159]: _nss_mysql_connect_sql: Connecting to db.databaseserver.local
[5159]: _nss_mysql_connect_sql: EXIT (NSS_UNAVAIL)
[5159]: _nss_mysql_escape_string: EXIT (NSS_UNAVAIL)
[5159]: _nss_mysql_build_query: EXIT (NSS_UNAVAIL)
[5159]: _nss_mysql_lookup: EXIT (NSS_UNAVAIL)
[5159]: _nss_mysql_getpwnam_r: EXIT (NSS_UNAVAIL)
[5159]: _nss_mysql_atexit_handler: ENTER
[5159]: _nss_mysql_close_sql: ENTER
[5159]: _nss_mysql_close_result: ENTER
[5159]: _nss_mysql_close_result: EXIT
[5159]: _nss_mysql_close_sql: EXIT (NSS_SUCCESS)
[5159]: _nss_mysql_safe_memset: ENTER
[5159]: _nss_mysql_safe_memset: EXIT (0x2815ab84)
[5159]: _nss_mysql_atexit_handler: EXIT



>How-To-Repeat:
setup the shiped sample database on a database host (not localhost).
i don't have the posibility to try it with another 5.4-RELEASE system so i cant proof that it can repeated on it but i hope ;)
>Fix:
i dont know where but i think the problem can be located in the context of libmysqlclient12 and maybe libpthread (i assume that but im not sure).
>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200506211047.j5LAlZOC012533>