I'm trying to make authentication system using central DataBase. It's works perfectly with libnss-mysql (but I don't like it). I've tried libnss-pgsql and created simle database. When I type id with correct user name it hangs (for egsample: 'id qwe'). When I type username that isn't in postgresql DB it works corectly. -SQL------------------ CREATE SEQUENCE group_id MINVALUE 1000 MAXVALUE 2147483647 NO CYCLE; CREATE SEQUENCE user_id MINVALUE 1000 MAXVALUE 2147483647 NO CYCLE; CREATE TABLE "group_table" ( "gid" int4 NOT NULL DEFAULT nextval('group_id'), "groupname" character varying(16) NOT NULL, "descr" character varying, "passwd" character varying(20), PRIMARY KEY ("gid") ); CREATE TABLE "passwd_table" ( "username" character varying(64) NOT NULL, "passwd" character varying(128) NOT NULL, "uid" int4 NOT NULL DEFAULT nextval('user_id'), "gid" int4 NOT NULL, "gecos" character varying(128), "homedir" character varying(256) NOT NULL, "shell" character varying DEFAULT '/bin/bash' NOT NULL, PRIMARY KEY ("username") ); CREATE TABLE "usergroups" ( "gid" int4 NOT NULL, "uid" int4 NOT NULL, PRIMARY KEY ("gid", "uid"), CONSTRAINT "ug_gid_fkey" FOREIGN KEY ("gid") REFERENCES "groups"("gid"), CONSTRAINT "ug_uid_fkey" FOREIGN KEY ("uid") REFERENCES "accounts"("uid") ); CREATE TABLE "shadow_table" ( "username" character varying(64) NOT NULL, "passwd" character varying(128) NOT NULL, "lastchange" int4 NOT NULL, "min" int4 NOT NULL, "max" int4 NOT NULL, "warn" int4 NOT NULL, "inact" int4 NOT NULL, "expire" int4 NOT NULL, "flag" int4 NOT NULL, PRIMARY KEY ("username") ); INSERT into passwd_table (gecos,gid,homedir,passwd,shell,uid,username) VALUES ( 'kermit',10000,'/home/test/','x','/bin/bash',10000,'qwe'); --nsswitch.conf------------ passwd: compat pgsql --nss-pgsql.conf----------- connectionstring = hostaddr=127.0.0.1 dbname=hosting user=kermit connect_timeout=1 # you can use anything postgres accepts as table expression getgroupmembersbygid = SELECT username FROM passwd_table WHERE gid = $1 getpwnam = SELECT username, passwd, gecos, homedir, shell, uid, gid FROM passwd_table WHERE username = $1 getpwuid = SELECT username, passwd, gecos, homedir, shell, uid, gid FROM passwd_table WHERE uid = $1 allusers = SELECT username, passwd, gecos, homedir, shell, uid, gid FROM passwd_table getgrnam = SELECT groupname, passwd, gid FROM group_table WHERE groupname = $1 getgrgid = SELECT groupname, passwd, gid FROM group_table WHERE gid = $1 groups_dyn = SELECT ug.gid FROM passwd_table JOIN usergroups USING (uid) where username = $1 and ug.gid <> $2 allgroups = SELECT groupname, passwd, gid FROM group_table --------------------------- $ psql -V psql (PostgreSQL) 8.1.3 $ emerge --info Portage 2.1.1_pre1-r1 (default-linux/x86/2005.1, gcc-3.4.6, glibc-2.4-r3, 2.6.15-suspend2-r8 i686) ================================================================= System uname: 2.6.15-suspend2-r8 i686 Intel(R) Celeron(R) CPU 2.66GHz Gentoo Base System version 1.12.1 dev-lang/python: 2.3.5-r2, 2.4.3-r1 dev-python/pycrypto: 2.0.1-r5 dev-util/ccache: [Not Present] dev-util/confcache: [Not Present] sys-apps/sandbox: 1.2.18.1 sys-devel/autoconf: 2.13, 2.59-r7 sys-devel/automake: 1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r2 sys-devel/binutils: 2.16.1-r2 sys-devel/gcc-config: 1.3.13-r2 sys-devel/libtool: 1.5.22 virtual/os-headers: 2.6.11-r5 ACCEPT_KEYWORDS="x86 ~x86" AUTOCLEAN="yes" CBUILD="i686-pc-linux-gnu" CFLAGS="-Os -march=pentium4 -pipe -fomit-frame-pointer" CHOST="i686-pc-linux-gnu" CONFIG_PROTECT="/etc" CONFIG_PROTECT_MASK="/etc/env.d /etc/gconf /etc/revdep-rebuild /etc/splash /etc/terminfo" CXXFLAGS="-Os -march=pentium4 -pipe -fomit-frame-pointer" DISTDIR="/usr/portage/distfiles" FEATURES="autoconfig distlocks metadata-transfer sandbox sfperms strict" GENTOO_MIRRORS="http://gentoo.prz.rzeszow.pl/ http://distfiles.gentoo.org/" LANG="pl_PL" LC_ALL="pl_PL" LINGUAS="pl" PKGDIR="/usr/portage/packages" PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --delete-after --stats --timeout=180 --exclude='/distfiles' --exclude='/local' --exclude='/packages'" PORTAGE_TMPDIR="/var/tmp" PORTDIR="/usr/portage" PORTDIR_OVERLAY="/usr/local/portage" SYNC="rsync://gentoo.prz.rzeszow.pl/gentoo-portage" USE="x86 alsa apm avi berkdb bitmap-fonts cddb cli crypt dri eds emboss encode foomaticdb fortran gdbm gif gpm imlib ipv6 isdnlog jpeg libg++ libwww mad mikmod mmx motif mp3 mpeg ncurses nls nptl nptlonly ogg oggvorbis opengl pam pcre pdflib perl png pppd python qt quicktime readline reflection session spell spl sse sse2 ssl tcpd threads truetype truetype-fonts type1-fonts vorbis xml2 xorg xv zlib elibc_glibc kernel_linux linguas_pl userland_GNU video_cards_nvidia" Unset: CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LDFLAGS, MAKEOPTS, PORTAGE_RSYNC_EXTRA_OPTS
Well, there seems to be a bug in the dbschema.sql file. I don't have a clue how the queries succeeded on your database. Anyway, I've basically rewritten the ebuild and added a patch for the schema. It works perfectly here with the newest version of postgresql-8.1.