Date: Thu, 26 Oct 2006 08:32:13 GMT From: Michael Bushkov <bushman@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 108453 for review Message-ID: <200610260832.k9Q8WDf6020565@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=108453 Change 108453 by bushman@bushman_nss_ldap_cached on 2006/10/26 08:31:29 IFC Affected files ... .. //depot/projects/soc2006/nss_ldap_cached/src/etc/pf.os#2 integrate .. //depot/projects/soc2006/nss_ldap_cached/src/etc/rc.d/ppp#2 integrate .. //depot/projects/soc2006/nss_ldap_cached/src/lib/libc/resolv/res_send.c#3 integrate .. //depot/projects/soc2006/nss_ldap_cached/src/lib/libc/stdio/xprintf.c#3 integrate .. //depot/projects/soc2006/nss_ldap_cached/src/lib/nss_ldap/ldap_group.c#12 edit .. //depot/projects/soc2006/nss_ldap_cached/src/lib/nss_ldap/ldap_group.h#11 edit .. //depot/projects/soc2006/nss_ldap_cached/src/lib/nss_ldap/ldap_passwd.c#13 edit .. //depot/projects/soc2006/nss_ldap_cached/src/lib/nss_ldap/ldap_passwd.h#11 edit .. //depot/projects/soc2006/nss_ldap_cached/src/lib/nss_ldap/ldap_serv.c#10 edit .. //depot/projects/soc2006/nss_ldap_cached/src/lib/nss_ldap/ldap_serv.h#7 edit .. //depot/projects/soc2006/nss_ldap_cached/src/lib/nss_ldap/ldapsearch.c#13 edit .. //depot/projects/soc2006/nss_ldap_cached/src/lib/nss_ldap/ldapsearch.h#12 edit .. //depot/projects/soc2006/nss_ldap_cached/src/lib/nss_ldap/ldaputil.c#14 edit .. //depot/projects/soc2006/nss_ldap_cached/src/lib/nss_ldap/ldaputil.h#14 edit .. //depot/projects/soc2006/nss_ldap_cached/src/share/mk/bsd.lib.mk#3 integrate .. //depot/projects/soc2006/nss_ldap_cached/src/usr.sbin/config/config.5#2 integrate .. //depot/projects/soc2006/nss_ldap_cached/src/usr.sbin/config/config.h#2 integrate .. //depot/projects/soc2006/nss_ldap_cached/src/usr.sbin/config/config.y#4 integrate .. //depot/projects/soc2006/nss_ldap_cached/src/usr.sbin/config/main.c#3 integrate .. //depot/projects/soc2006/nss_ldap_cached/src/usr.sbin/config/mkmakefile.c#5 integrate .. //depot/projects/soc2006/nss_ldap_cached/src/usr.sbin/fdcontrol/fdcontrol.8#2 integrate .. //depot/projects/soc2006/nss_ldap_cached/src/usr.sbin/smbmsg/smbmsg.8#2 integrate .. //depot/projects/soc2006/nss_ldap_cached/src/usr.sbin/sysinstall/dist.c#2 integrate .. //depot/projects/soc2006/nss_ldap_cached/src/usr.sbin/sysinstall/install.c#4 integrate .. //depot/projects/soc2006/nss_ldap_cached/src/usr.sbin/sysinstall/sysinstall.h#3 integrate Differences ... ==== //depot/projects/soc2006/nss_ldap_cached/src/etc/pf.os#2 (text+ko) ==== @@ -1,5 +1,5 @@ -# $FreeBSD: src/etc/pf.os,v 1.3 2004/09/14 00:30:14 mlaier Exp $ -# $OpenBSD: pf.os,v 1.17 2004/04/28 01:01:27 deraadt Exp $ +# $FreeBSD: src/etc/pf.os,v 1.4 2006/10/23 05:09:44 delphij Exp $ +# $OpenBSD: pf.os,v 1.21 2006/07/28 21:51:12 david Exp $ # passive OS fingerprinting # ------------------------- # @@ -223,9 +223,10 @@ S4:64:1:60:M1360,S,T,N,W0: Linux:google::Linux (Google crawlbot) S2:64:1:60:M*,S,T,N,W0: Linux:2.4::Linux 2.4 (big boy) -S3:64:1:60:M*,S,T,N,W0: Linux:2.4:18-21:Linux 2.4.18 and newer -S4:64:1:60:M*,S,T,N,W0: Linux:2.4::Linux 2.4/2.6 -S4:64:1:60:M*,S,T,N,W0: Linux:2.6::Linux 2.4/2.6 +S3:64:1:60:M*,S,T,N,W0: Linux:2.4:.18-21:Linux 2.4.18 and newer +S4:64:1:60:M*,S,T,N,W0: Linux:2.4::Linux 2.4/2.6 <= 2.6.7 +S4:64:1:60:M*,S,T,N,W0: Linux:2.6:.1-7:Linux 2.4/2.6 <= 2.6.7 +S4:64:1:60:M*,S,T,N,W7: Linux:2.6:8:Linux 2.6.8 and newer (?) S3:64:1:60:M*,S,T,N,W1: Linux:2.5::Linux 2.5 (sometimes 2.4) S4:64:1:60:M*,S,T,N,W1: Linux:2.5-2.6::Linux 2.5/2.6 @@ -260,27 +261,28 @@ # ----------------- FreeBSD ----------------- -16384:64:1:44:M*: FreeBSD:2.0-2.2::FreeBSD 2.0-4.1 -16384:64:1:44:M*: FreeBSD:3.0-3.5::FreeBSD 2.0-4.1 -16384:64:1:44:M*: FreeBSD:4.0-4.1::FreeBSD 2.0-4.1 +16384:64:1:44:M*: FreeBSD:2.0-2.2::FreeBSD 2.0-4.2 +16384:64:1:44:M*: FreeBSD:3.0-3.5::FreeBSD 2.0-4.2 +16384:64:1:44:M*: FreeBSD:4.0-4.2::FreeBSD 2.0-4.2 16384:64:1:60:M*,N,W0,N,N,T: FreeBSD:4.4::FreeBSD 4.4 1024:64:1:60:M*,N,W0,N,N,T: FreeBSD:4.4::FreeBSD 4.4 57344:64:1:44:M*: FreeBSD:4.6-4.8:noRFC1323:FreeBSD 4.6-4.8 (no RFC1323) -57344:64:1:60:M*,N,W0,N,N,T: FreeBSD:4.6-4.8::FreeBSD 4.6-4.8 +57344:64:1:60:M*,N,W0,N,N,T: FreeBSD:4.6-4.9::FreeBSD 4.6-4.9 -32768:64:1:60:M*,N,W0,N,N,T: FreeBSD:4.8-4.9::FreeBSD 4.8-5.1 (or MacOS X) +32768:64:1:60:M*,N,W0,N,N,T: FreeBSD:4.8-4.11::FreeBSD 4.8-5.1 (or MacOS X) 32768:64:1:60:M*,N,W0,N,N,T: FreeBSD:5.0-5.1::FreeBSD 4.8-5.1 (or MacOS X) -65535:64:1:60:M*,N,W0,N,N,T: FreeBSD:4.8-4.9::FreeBSD 4.8-5.1 (or MacOS X) -65535:64:1:60:M*,N,W0,N,N,T: FreeBSD:5.0-5.1::FreeBSD 4.8-5.1 (or MacOS X) -65535:64:1:60:M*,N,W1,N,N,T: FreeBSD:4.7-4.9::FreeBSD 4.7-5.1 -65535:64:1:60:M*,N,W1,N,N,T: FreeBSD:5.0-5.1::FreeBSD 4.7-5.1 +65535:64:1:60:M*,N,W0,N,N,T: FreeBSD:4.8-4.11::FreeBSD 4.8-5.2 (or MacOS X) +65535:64:1:60:M*,N,W0,N,N,T: FreeBSD:5.0-5.2::FreeBSD 4.8-5.2 (or MacOS X) +65535:64:1:60:M*,N,W1,N,N,T: FreeBSD:4.7-4.11::FreeBSD 4.7-5.2 +65535:64:1:60:M*,N,W1,N,N,T: FreeBSD:5.0-5.2::FreeBSD 4.7-5.2 # XXX need quirks support -# 65535:64:1:60:M*,N,W0,N,N,T:Z:FreeBSD:5.1-current (1) -# 65535:64:1:60:M*,N,W1,N,N,T:Z:FreeBSD:5.1-current (2) -# 65535:64:1:60:M*,N,W2,N,N,T:Z:FreeBSD:5.1-current (3) +# 65535:64:1:60:M*,N,W0,N,N,T:Z:FreeBSD:5.1-5.4::5.1-current (1) +# 65535:64:1:60:M*,N,W1,N,N,T:Z:FreeBSD:5.1-5.4::5.1-current (2) +# 65535:64:1:60:M*,N,W2,N,N,T:Z:FreeBSD:5.1-5.4::5.1-current (3) +# 65535:64:1:44:M*:Z:FreeBSD:5.2::FreeBSD 5.2 (no RFC1323) # 16384:64:1:60:M*,N,N,N,N,N,N,T:FreeBSD:4.4:noTS:FreeBSD 4.4 (w/o timestamps) @@ -297,12 +299,12 @@ # ----------------- OpenBSD ----------------- 16384:64:0:60:M*,N,W0,N,N,T: OpenBSD:2.6::NetBSD 1.3 (or OpenBSD 2.6) -16384:64:1:64:M*,N,N,S,N,W0,N,N,T: OpenBSD:3.0-3.5::OpenBSD 3.0-3.5 -16384:64:0:64:M*,N,N,S,N,W0,N,N,T: OpenBSD:3.0-3.5:no-df:OpenBSD 3.0-3.5 (scrub no-df) -57344:64:1:64:M*,N,N,S,N,W0,N,N,T: OpenBSD:3.3-3.5::OpenBSD 3.3-3.5 -57344:64:0:64:M*,N,N,S,N,W0,N,N,T: OpenBSD:3.3-3.5:no-df:OpenBSD 3.3-3.5 (scrub no-df) +16384:64:1:64:M*,N,N,S,N,W0,N,N,T: OpenBSD:3.0-4.0::OpenBSD 3.0-4.0 +16384:64:0:64:M*,N,N,S,N,W0,N,N,T: OpenBSD:3.0-4.0:no-df:OpenBSD 3.0-4.0 (scrub no-df) +57344:64:1:64:M*,N,N,S,N,W0,N,N,T: OpenBSD:3.3-4.0::OpenBSD 3.3-4.0 +57344:64:0:64:M*,N,N,S,N,W0,N,N,T: OpenBSD:3.3-4.0:no-df:OpenBSD 3.3-4.0 (scrub no-df) -65535:64:1:64:M*,N,N,S,N,W0,N,N,T: OpenBSD:3.0-3.5:opera:OpenBSD 3.0-3.5 (Opera) +65535:64:1:64:M*,N,N,S,N,W0,N,N,T: OpenBSD:3.0-4.0:opera:OpenBSD 3.0-4.0 (Opera) # ----------------- Solaris ----------------- @@ -317,7 +319,8 @@ 4096:64:0:44:M1460: SunOS:4.1::SunOS 4.1.x -S34:64:1:52:M*,N,W0,N,N,S: Solaris:10::Solaris 10 (beta) +S34:64:1:52:M*,N,W0,N,N,S: Solaris:10:beta:Solaris 10 (beta) +32850:64:1:64:M*,N,N,T,N,W1,N,N,S: Solaris:10::Solaris 10 1203 # ----------------- IRIX -------------------- @@ -329,6 +332,9 @@ 61440:64:0:48:M*,N,N,S: IRIX:6.5:12-21:IRIX 6.5.12 - 6.5.21 49152:64:0:48:M*,N,N,S: IRIX:6.5:15-21:IRIX 6.5.15 - 6.5.21 +49152:60:0:64:M*,N,W2,N,N,T,N,N,S: IRIX:6.5:IP27:IRIX 6.5 IP27 + + # ----------------- Tru64 ------------------- 32768:64:1:48:M*,N,W0: Tru64:4.0::Tru64 4.0 (or OS/2 Warp 4) @@ -428,6 +434,11 @@ 16384:128:1:52:M536,N,W0,N,N,S: Windows:2000:ZoneAlarm:Windows 2000 w/ZoneAlarm? 2048:255:0:40:.: Windows:.NET::Windows .NET Enterprise Server +44620:64:0:48:M*,N,N,S: Windows:ME::Windows ME no SP (?) +S6:255:1:48:M536,N,N,S: Windows:95:winsock2:Windows 95 winsock 2 +32768:32:1:52:M1460,N,W0,N,N,S: Windows:2003:AS:Windows 2003 AS + + # No need to be more specific, it passes: # *:128:1:48:M*,N,N,S:U:-Windows:XP/2000 while downloading (leak!) XXX quirk # there is an equiv similar generic sig w/o the quirk @@ -442,7 +453,6 @@ # Whoa. Hardcore WSS. 0:64:0:48:M*,W0,N: HP-UX:B.11.00:A:HP-UX B.11.00 A (RFC1323) - # ----------------- RiscOS ------------------ # We don't yet support the ?12 TCP option @@ -453,6 +463,7 @@ # 4096:64:1:56:M1460,N,N,T:T: RISC OS:3.70:freenet:RISC OS 3.70 freenet 2.00 + # ----------------- BSD/OS ------------------ # Once again, power of two WSS is also shared by MacOS X with DF set @@ -466,6 +477,7 @@ # ---------------- NeXTSTEP ----------------- +S4:64:0:44:M1024: NeXTSTEP:3.3::NeXTSTEP 3.3 S8:64:0:44:M512: NeXTSTEP:3.3::NeXTSTEP 3.3 # ------------------ BeOS ------------------- @@ -501,15 +513,18 @@ # ----------------- SCO ------------------ S3:64:1:60:M1460,N,W0,N,N,T: SCO:UnixWare:7.1:SCO UnixWare 7.1 +S17:64:1:60:M1380,N,W0,N,N,T: SCO:UnixWare:7.1:SCO UnixWare 7.1.3 MP3 S23:64:1:44:M1380: SCO:OpenServer:5.0:SCO OpenServer 5.0 # ------------------- DOS ------------------- 2048:255:0:44:M536: DOS:WATTCP:1.05:DOS Arachne via WATTCP/1.05 +T2:255:0:44:M984: DOS:WATTCP:1.05Arachne:Arachne via WATTCP/1.05 (eepro) # ------------------ OS/2 ------------------- S56:64:0:44:M512: OS/2:4::OS/2 4 +28672:64:0:44:M1460: OS/2:4::OS/2 Warp 4.0 # ----------------- TOPS-20 ----------------- @@ -517,6 +532,10 @@ # XXX QUIRK 0:64:0:44:M1460:A:TOPS-20:version 7 0:64:0:44:M1460: TOPS-20:7::TOPS-20 version 7 +# ----------------- FreeMiNT ---------------- + +S44:255:0:44:M536: FreeMiNT:1:16A:FreeMiNT 1 patch 16A (Atari) + # ------------------ AMIGA ------------------ # XXX TCP option 12 @@ -539,7 +558,6 @@ S12:64:1:44:M1460: @Checkpoint:::Checkpoint (unknown 1) S12:64:1:48:N,N,S,M1460: @Checkpoint:::Checkpoint (unknown 2) 4096:32:0:44:M1460: ExtremeWare:4.x::ExtremeWare 4.x -60352:64:0:52:M1460,N,W2,N,N,S: Clavister:7::Clavister firewall 7.x # XXX TCP option 12 # S32:64:0:68:M512,N,W0,N,N,T,N,N,?12:.:Nokia:IPSO w/Checkpoint NG FP3 @@ -549,6 +567,9 @@ 8192:64:1:44:M1460: Eagle:::Eagle Secure Gateway +S52:128:1:48:M1260,N,N,N,N: LinkSys:WRV54G::LinkSys WRV54G VPN router + + # ------- Switches and other stuff ---------- @@ -581,6 +602,10 @@ 16384:255:0:40:.: Proxyblocker:::Proxyblocker (what's this?) +65535:255:0:48:M*,N,N,S: Redline:::Redline T|X 2200 + +32696:128:0:40:M1460: Spirent:Avalanche::Spirent Web Avalanche HTTP benchmarking engine + # ----------- Embedded systems -------------- S9:255:0:44:M536: PalmOS:Tungsten:C:PalmOS Tungsten C @@ -589,10 +614,15 @@ S4:255:0:44:M536: PalmOS:3:5:PalmOS 3.5 2948:255:0:44:M536: PalmOS:3:5:PalmOS 3.5.3 (Handera) S29:255:0:44:M536: PalmOS:5::PalmOS 5.0 +16384:255:0:44:M1398: PalmOS:5.2:Clie:PalmOS 5.2 (Clie) +S14:255:0:44:M1350: PalmOS:5.2:Treo:PalmOS 5.2.1 (Treo) S23:64:1:64:N,W1,N,N,T,N,N,S,M1460: SymbianOS:7::SymbianOS 7 -8192:255:0:44:M1460: SymbianOS:6048::SymbianOS 6048 (on Nokia 7650?) -8192:255:0:44:M536: SymbianOS:::SymbianOS (on Nokia 9210?) + +8192:255:0:44:M1460: SymbianOS:6048::Symbian OS 6048 (Nokia 7650?) +8192:255:0:44:M536: SymbianOS:9210::Symbian OS (Nokia 9210?) +S22:64:1:56:M1460,T,S: SymbianOS:P800::Symbian OS ? (SE P800?) +S36:64:1:56:M1360,T,S: SymbianOS:6600::Symbian OS 60xx (Nokia 6600?) # Perhaps S4? @@ -608,8 +638,8 @@ S12:64:0:44:M1452: AXIS:5600:v5.64:AXIS Printer Server 5600 v5.64 +3100:32:1:44:M1460: Windows:CE:2.0:Windows CE 2.0 - #################### # Fancy signatures # #################### @@ -619,11 +649,23 @@ 3072:64:0:40:.: *NMAP:syn scan:3:NMAP syn scan (3) 4096:64:0:40:.: *NMAP:syn scan:4:NMAP syn scan (4) +# Requires quirks support +# 1024:64:0:40:.:A:*NMAP:TCP sweep probe (1) +# 2048:64:0:40:.:A:*NMAP:TCP sweep probe (2) +# 3072:64:0:40:.:A:*NMAP:TCP sweep probe (3) +# 4096:64:0:40:.:A:*NMAP:TCP sweep probe (4) + 1024:64:0:60:W10,N,M265,T: *NMAP:OS:1:NMAP OS detection probe (1) 2048:64:0:60:W10,N,M265,T: *NMAP:OS:2:NMAP OS detection probe (2) 3072:64:0:60:W10,N,M265,T: *NMAP:OS:3:NMAP OS detection probe (3) 4096:64:0:60:W10,N,M265,T: *NMAP:OS:4:NMAP OS detection probe (4) +32767:64:0:40:.: *NAST:::NASTsyn scan + +# Requires quirks support +# 12345:255:0:40:.:A:-p0f:sendsyn utility + + ##################################### # Generic signatures - just in case # ##################################### @@ -633,6 +675,8 @@ *:128:1:52:M*,N,W0,N,N,S: @Windows:XP:RFC1323:Windows XP/2000 (RFC1323 no tstamp) *:128:1:52:M*,N,W0,N,N,S: @Windows:2000:RFC1323:Windows XP/2000 (RFC1323 no tstamp) +*:128:1:52:M*,N,W*,N,N,S: @Windows:XP:RFC1323:Windows XP/2000 (RFC1323 no tstamp) +*:128:1:52:M*,N,W*,N,N,S: @Windows:2000:RFC1323:Windows XP/2000 (RFC1323 no tstamp) *:128:1:64:M*,N,W0,N,N,T0,N,N,S: @Windows:XP:RFC1323:Windows XP/2000 (RFC1323) *:128:1:64:M*,N,W0,N,N,T0,N,N,S: @Windows:2000:RFC1323:Windows XP/2000 (RFC1323) *:128:1:64:M*,N,W*,N,N,T0,N,N,S: @Windows:XP:RFC1323:Windows XP (RFC1323, w+) ==== //depot/projects/soc2006/nss_ldap_cached/src/etc/rc.d/ppp#2 (text+ko) ==== @@ -1,6 +1,6 @@ #!/bin/sh # -# $FreeBSD: src/etc/rc.d/ppp,v 1.11 2005/10/29 05:00:25 yar Exp $ +# $FreeBSD: src/etc/rc.d/ppp,v 1.12 2006/10/26 00:29:43 avatar Exp $ # # PROVIDE: ppp @@ -40,9 +40,10 @@ ppp_postcmd() { - # Re-Sync ipfilter so it picks up any new network interfaces + # Re-Sync ipfilter and pf so they pick up any new network interfaces # /etc/rc.d/ipfilter resync + /etc/rc.d/pf resync } load_rc_config $name ==== //depot/projects/soc2006/nss_ldap_cached/src/lib/libc/resolv/res_send.c#3 (text) ==== @@ -70,10 +70,10 @@ #if defined(LIBC_SCCS) && !defined(lint) static const char sccsid[] = "@(#)res_send.c 8.1 (Berkeley) 6/4/93"; -static const char rcsid[] = "$Id: res_send.c,v 1.5.2.2.4.7 2005/08/15 02:04:41 marka Exp $"; +static const char rcsid[] = "$Id: res_send.c,v 1.5.2.2.4.8 2006/03/08 04:13:31 marka Exp $"; #endif /* LIBC_SCCS and not lint */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/lib/libc/resolv/res_send.c,v 1.3 2006/08/04 12:26:07 ume Exp $"); +__FBSDID("$FreeBSD: src/lib/libc/resolv/res_send.c,v 1.4 2006/10/24 14:41:43 ume Exp $"); /* * Send query to name server and wait for reply. @@ -145,7 +145,7 @@ int kq, #endif const u_char *, int, - u_char *, int, int *, int, + u_char *, int, int *, int, int, int *, int *); static void Aerror(const res_state, FILE *, const char *, int, const struct sockaddr *, int); @@ -490,7 +490,7 @@ kq, #endif buf, buflen, ans, anssiz, &terrno, - ns, &v_circuit, &gotsomewhere); + ns, try, &v_circuit, &gotsomewhere); if (n < 0) goto fail; if (n == 0) @@ -812,8 +812,9 @@ #ifdef USE_KQUEUE int kq, #endif - const u_char *buf, int buflen, u_char *ans, int anssiz, - int *terrno, int ns, int *v_circuit, int *gotsomewhere) + const u_char *buf, int buflen, u_char *ans, + int anssiz, int *terrno, int ns, int try, int *v_circuit, + int *gotsomewhere) { const HEADER *hp = (const HEADER *) buf; HEADER *anhp = (HEADER *) ans; @@ -914,7 +915,7 @@ /* * Wait for reply. */ - seconds = (statp->retrans << ns); + seconds = (statp->retrans << try); if (ns > 0) seconds /= statp->nscount; if (seconds <= 0) ==== //depot/projects/soc2006/nss_ldap_cached/src/lib/libc/stdio/xprintf.c#3 (text+ko) ==== @@ -30,7 +30,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: src/lib/libc/stdio/xprintf.c,v 1.4 2006/10/21 11:49:07 kib Exp $ + * $FreeBSD: src/lib/libc/stdio/xprintf.c,v 1.5 2006/10/23 07:25:25 kib Exp $ */ #include <namespace.h> @@ -261,7 +261,7 @@ static int -__v2printf(FILE *fp, const char *fmt0, unsigned pct, const va_list ap1) +__v2printf(FILE *fp, const char *fmt0, unsigned pct, va_list ap) { struct printf_info *pi, *pil; const char *fmt; @@ -274,9 +274,7 @@ int ret = 0; int n; struct __printf_io io; - va_list ap; - va_copy(ap, ap1); __printf_init(&io); io.fp = fp; @@ -563,7 +561,6 @@ errx(1, "render[%c] = NULL", *fmt); } __printf_flush(&io); - va_end(ap); return (ret); } ==== //depot/projects/soc2006/nss_ldap_cached/src/lib/nss_ldap/ldap_group.c#12 (text+ko) ==== @@ -55,12 +55,15 @@ static int nss_ldap_parse_group(struct nss_ldap_parse_context *pctx) { + struct nss_ldap_dn2attr_request dnreq; + char *valid_oc_arr[3]; struct nss_ldap_schema *schema; struct nss_ldap_search_context *sctx; struct group *grp; char *buf; + char **res; size_t buflen; - size_t len, memlen; + size_t len, memlen, res_memlen; int rv; assert(pctx != NULL); @@ -105,18 +108,21 @@ buflen = pctx->bufsize; schema = &sctx->conf->schema; +// printf("__ %s %d\n", __FILE__, __LINE__); rv = __nss_ldap_assign_attr_gid(sctx, _ATM(schema, GROUP, gidNumber), &grp->gr_gid); if (rv != NSS_LDAP_SUCCESS) goto errfin; +// printf("__ %s %d\n", __FILE__, __LINE__); rv = __nss_ldap_assign_rdn_str(sctx, _ATM(schema, GROUP, cn), &grp->gr_name, &len, buf, buflen); if (rv != NSS_LDAP_SUCCESS) goto errfin; +// printf("__ %s %d\n", __FILE__, __LINE__); buflen -= len; buf += len; @@ -128,17 +134,69 @@ buflen -= len; buf += len; + grp->gr_mem = NULL; +// res_size = 0; +// res_bufsize = 0; //rv = __nss_ldap_assign_attr_multi_str(sctx, - rv = __nss_ldap_assign_attr_multi_str_paged(sctx, + rv = __nss_ldap_assign_attr_multi_str_paged_ext(sctx, _ATM(schema, GROUP, memberUid), - &grp->gr_mem, &memlen, &len, buf, buflen); - if (rv != NSS_LDAP_SUCCESS) - goto errfin; - buflen -= len; - buf += len; - + &res, &memlen, &len, buf, buflen, + NSS_LDAP_ATTR_MULTI_STR_END_WITH_PTRS_FLAG | + NSS_LDAP_ATTR_MULTI_STR_DONT_PACK_PTRS_FLAG, NULL, NULL); + if (rv == NSS_LDAP_SUCCESS) { +// char **cp; +// for (cp = res; *cp; ++cp) { +// printf("__ %s %d %p\n", __FILE__, __LINE__, (void *)*cp); +// printf("__ %s %d %s\n", __FILE__, __LINE__, *cp); +// } + + buflen -= len + (buf + buflen - (char *)res); + buf += len; + + grp->gr_mem = res; + } + + memset(&dnreq, 0, sizeof(struct nss_ldap_dn2attr_request)); + dnreq.attr = (char *)_ATM(schema, PASSWD, uid); + valid_oc_arr[0] = (char *)_OC(schema, posixAccount); + valid_oc_arr[1] = (char *)_OC(schema, shadowAccount); + valid_oc_arr[2] = NULL; + dnreq.oc = valid_oc_arr; +// printf("__ %s %d %d %p %s\n", __FILE__, __LINE__, rv, (void *)grp->gr_mem, grp->gr_name); + + if (rv != NSS_LDAP_BUFFER_ERROR) { + res_memlen = memlen; + rv = __nss_ldap_assign_attr_multi_str_paged_ext(sctx, + _ATM(schema, GROUP, uniqueMember), + &res, &memlen, &len, buf, buflen, + 0, __nss_ldap_map_dn2attr_fn, (void *)&dnreq); + if (rv == NSS_LDAP_SUCCESS) { +// printf("__ %s %d %d %d %d\n", __FILE__, __LINE__, memlen, len, buflen); +// char **cp; +// for (cp = res; *cp; ++cp) +// printf("__ %s %d %s\n", __FILE__, __LINE__, *cp); + + if (grp->gr_mem != NULL) + memmove(res + memlen - 1, grp->gr_mem, res_memlen * sizeof(char *)); + grp->gr_mem = res; +// else if (memlen > 1) { +// printf("__ %s %d %p %s\n", __FILE__, __LINE__, (void *)(*(res - 1)), *(res + memlen - 2)); +// printf("__ %s %d %s %s\n", __FILE__, __LINE__, *(res - 1), *(res + memlen - 2)); +// *(res - 1) = *(res + memlen - 2); +// *(res + memlen - 2) = NULL; +// printf("__ %s %d\n", __FILE__, __LINE__); +// } + +// printf("__ %s %d %d %d %d\n", __FILE__, __LINE__, memlen, len, buflen); +// for (cp = res; *cp; ++cp) +// printf("__ %s %d %s\n", __FILE__, __LINE__, *cp); + } + + if ((grp->gr_mem != NULL) && (rv != NSS_LDAP_BUFFER_ERROR)) + rv = NSS_LDAP_SUCCESS; + } errfin: - //printf("__ %s %d %d\n", __FILE__, __LINE__, rv); +// printf("__ %s %d %d %p %s\n", __FILE__, __LINE__, rv, (void *)grp->gr_mem, grp->gr_name); return (rv); } ==== //depot/projects/soc2006/nss_ldap_cached/src/lib/nss_ldap/ldap_group.h#11 (text+ko) ==== ==== //depot/projects/soc2006/nss_ldap_cached/src/lib/nss_ldap/ldap_passwd.c#13 (text+ko) ==== ==== //depot/projects/soc2006/nss_ldap_cached/src/lib/nss_ldap/ldap_passwd.h#11 (text+ko) ==== ==== //depot/projects/soc2006/nss_ldap_cached/src/lib/nss_ldap/ldap_serv.c#10 (text+ko) ==== ==== //depot/projects/soc2006/nss_ldap_cached/src/lib/nss_ldap/ldap_serv.h#7 (text+ko) ==== ==== //depot/projects/soc2006/nss_ldap_cached/src/lib/nss_ldap/ldapsearch.c#13 (text+ko) ==== @@ -43,21 +43,19 @@ #include "ldapconf.h" #include "nss_ldap.h" -#define DO_ASSIGN_ATTR_MULTI_STR_END_WITH_PTRS (1) -#define DO_ASSIGN_ATTR_MULTI_STR_NO_END_NULL (1 << 1) - static int copy_request(struct nss_ldap_search_request *, struct nss_ldap_search_request const *); static void destroy_request(struct nss_ldap_search_request *); static int do_assign_attr_multi_str(struct nss_ldap_search_context *, - char const *, char ***, size_t *, size_t *, char *, size_t, int); + char const *, char ***, size_t *, size_t *, char *, size_t, int, + nss_ldap_multi_str_process_fn, void *); static int do_assign_attr_multi_str_paged(struct nss_ldap_search_context *, char const *, char const *, char ***, size_t *, size_t *, char *, - size_t); + size_t, int, nss_ldap_multi_str_process_fn, void *); static int do_ldap_search_ext(struct nss_ldap_connection *, struct nss_ldap_configuration *, struct nss_ldap_search_request *, - struct nss_ldap_search_context *, int *); + struct nss_ldap_search_context *, int *); static struct nss_ldap_search_context *start_search_def( struct nss_ldap_connection *, struct nss_ldap_configuration *, @@ -89,7 +87,7 @@ if (dest->attributes == NULL) return (NSS_LDAP_MEMORY_ERROR); - for (cp = dest->attributes->sl_str; *cp; ++cp) { + for (cp = src->attributes->sl_str; *cp; ++cp) { s = strdup(*cp); if (s == NULL) return (NSS_LDAP_MEMORY_ERROR); @@ -117,26 +115,31 @@ static int do_assign_attr_multi_str(struct nss_ldap_search_context *ctx, char const *attr, char ***str_array, size_t *str_array_size, - size_t *len, char *buf, size_t bufsize, int flags) + size_t *len, char *buf, size_t bufsize, int flags, + nss_ldap_multi_str_process_fn sp_fn, void *mdata) { - char **values, **viter, **siter, **siter_end; + char **values, **viter, **siter, **siter_end, **new_res_arr; + char *sbuf, *rbuf; size_t size, valsize; int rv; values = (char **)ldap_get_values(ctx->conn->ld, ctx->msg, attr); valsize = values == NULL ? 0 : ldap_count_values(values); *str_array_size = valsize; - if (!(flags & DO_ASSIGN_ATTR_MULTI_STR_NO_END_NULL)) + if (!(flags & NSS_LDAP_ATTR_MULTI_STR_NO_END_NULL_FLAG)) ++*str_array_size; - *len = sizeof(char *) * (*str_array_size); + size = *str_array_size * sizeof(char *); + sbuf = buf; + rbuf = buf + bufsize; + //printf("__ %s %d %d\n", __FILE__, __LINE__, valsize); - if (flags & DO_ASSIGN_ATTR_MULTI_STR_END_WITH_PTRS) { - siter_end = (char **)ALIGN(buf + bufsize); - while ((char *)siter_end > buf + bufsize - sizeof(char *)) + if (flags & NSS_LDAP_ATTR_MULTI_STR_END_WITH_PTRS_FLAG) { + siter_end = (char **)ALIGN(rbuf); + while ((char *)siter_end > rbuf) --siter_end; - siter = siter_end - valsize; + siter = siter_end - *str_array_size; //printf("__ %s %d %p %p\n", __FILE__, __LINE__, (void *)buf, (void *)siter); if ((char *)siter <= buf) { //printf("__ %s %d %d\n", __FILE__, __LINE__, valsize); @@ -147,9 +150,11 @@ //printf("__ %s %d\n", __FILE__, __LINE__); return (NSS_LDAP_BUFFER_ERROR); } + + rbuf = (char *)siter; } else { siter = (char **)ALIGN(buf); - if ((char *)siter + *len > buf + bufsize) { + if ((char *)siter + size >= rbuf) { ldap_value_free(values); __nss_ldap_log(NSS_LDAP_LL_DEBUG_INT, "do_assign_attr_multi_str: " @@ -157,35 +162,51 @@ //printf("__ %s %d\n", __FILE__, __LINE__); return (NSS_LDAP_BUFFER_ERROR); } + + buf = (char *)siter + size; } *str_array = siter; - - if (!(flags & DO_ASSIGN_ATTR_MULTI_STR_END_WITH_PTRS)) - buf = (char *)siter + *len; - bufsize -= *len; if (values != NULL) { for (viter = values; *viter; ++viter, ++siter) { - rv = __nss_ldap_assign_str(*viter, siter, &size, - buf, bufsize); - //printf("__ %s %d %d\n", __FILE__, __LINE__, bufsize); + if (sp_fn == NULL) + rv = __nss_ldap_assign_str(*viter, siter, &size, + buf, rbuf - buf); + else + rv = sp_fn(ctx, *viter, siter, &size, buf, + rbuf - buf, mdata); + if (rv != NSS_LDAP_SUCCESS) { - ldap_value_free(values); - //printf("__ %s %d %d\n", __FILE__, __LINE__, valsize); - goto fin; - } +// printf("__ %s %d %d\n", __FILE__, __LINE__, rv); + ldap_value_free(values); + goto fin; + } buf += size; - *len += size; - bufsize -= size; } - ldap_value_free(values); + ldap_value_free(values); } - if (!(flags & DO_ASSIGN_ATTR_MULTI_STR_NO_END_NULL)) + if (!(flags & NSS_LDAP_ATTR_MULTI_STR_NO_END_NULL_FLAG)) *siter = NULL; + + if (flags && NSS_LDAP_ATTR_MULTI_STR_END_WITH_PTRS_FLAG) { + if (!(flags & NSS_LDAP_ATTR_MULTI_STR_DONT_PACK_PTRS_FLAG)) { + new_res_arr = (char **)ALIGN(buf); + + if (new_res_arr != *str_array) { + memmove(new_res_arr, *str_array, + sizeof(char *) * (*str_array_size)); + *str_array = new_res_arr; + } + + } + } + + *len = buf - sbuf; + //printf("%s %d %d %d %p %p %d %d\n", __FILE__, __LINE__, *len, *str_array_size, (void *)(sbuf + bufsize), (void *)*str_array, (size_t)(sbuf + bufsize - (char *)(*str_array)), (size_t)(sbuf + bufsize - (char *)(*str_array))/ sizeof( char *)); rv = NSS_LDAP_SUCCESS; //printf("__ %s %d %d\n", __FILE__, __LINE__, *str_array_size); @@ -197,13 +218,15 @@ static int do_assign_attr_multi_str_paged(struct nss_ldap_search_context *ctx, char const *attr_model, char const *attr, char ***str_array, - size_t *str_array_size, size_t *len, char *buf, size_t bufsize) + size_t *str_array_size, size_t *len, char *buf, size_t bufsize, + int flags, nss_ldap_multi_str_process_fn sp_fn, void *mdata) { char range_buffer[128]; struct nss_ldap_search_request sreq; struct nss_ldap_search_context *newctx; BerElement *cookie; char **res_arr, **new_res_arr; + char *sbuf, *rbuf; size_t res_arr_size, res_buf_size, res_buf_offset, res_arr_offset; int range_start, range_end, rv, sf; @@ -211,22 +234,26 @@ if (rv != NSS_LDAP_SUCCESS) return (rv); + sbuf = buf; + rbuf = buf + bufsize; res_arr_size = 0; - res_buf_size = 0; sf = 0; do { st: rv = do_assign_attr_multi_str(ctx, attr, - &res_arr, &res_arr_offset, &res_buf_offset, buf, - bufsize, sf == 0 ? - DO_ASSIGN_ATTR_MULTI_STR_END_WITH_PTRS : - DO_ASSIGN_ATTR_MULTI_STR_END_WITH_PTRS | - DO_ASSIGN_ATTR_MULTI_STR_NO_END_NULL); + &res_arr, &res_arr_offset, &res_buf_offset, + buf, rbuf - buf, + (sf == 0 ? NSS_LDAP_ATTR_MULTI_STR_END_WITH_PTRS_FLAG : + NSS_LDAP_ATTR_MULTI_STR_END_WITH_PTRS_FLAG | + NSS_LDAP_ATTR_MULTI_STR_NO_END_NULL_FLAG) | + NSS_LDAP_ATTR_MULTI_STR_DONT_PACK_PTRS_FLAG, + sp_fn, mdata); if (rv != NSS_LDAP_SUCCESS) goto fin; res_arr_size += res_arr_offset; - res_buf_size += res_buf_offset; + buf += res_buf_offset; + rbuf = (char *)res_arr; if (range_end == -1) break; @@ -241,12 +268,20 @@ } sreq.attributes = sl_init(); - rv = __nss_ldap_form_range(range_buffer, sizeof(range_buffer), - range_end + 1, -1); + rv = snprintf(range_buffer, sizeof(range_buffer), "%s;", + attr_model); + if (rv >= sizeof(range_buffer)) { + rv = NSS_LDAP_BUFFER_ERROR; + break; + } + rv = __nss_ldap_form_range(range_buffer + rv, + sizeof(range_buffer) - rv, range_end + 1, -1); if (rv == -1) { rv = NSS_LDAP_GENERIC_ERROR; break; } +// printf("__ %s %d %s %s\n", __FILE__, __LINE__, +// sreq.search_base, range_buffer); rv = sl_add(sreq.attributes, range_buffer); if (rv == -1) { rv = NSS_LDAP_MEMORY_ERROR; @@ -258,9 +293,11 @@ break; } +// printf("__ %s %d\n", __FILE__, __LINE__); newctx = __nss_ldap_start_search(&__nss_ldap_conf->search_method, ctx->conn, ctx->conf, &sreq); - sl_free(sreq.attributes, 1); +// printf("__ %s %d\n", __FILE__, __LINE__); + sl_free(sreq.attributes, 0); ldap_memfree(sreq.search_base); if (newctx == NULL) { rv = NSS_LDAP_CONNECTION_ERROR; @@ -268,25 +305,30 @@ } if (sf != 0) { +// printf("__ %s %d\n", __FILE__, __LINE__); __nss_ldap_end_search(&__nss_ldap_conf->search_method, ctx); attr = NULL; + } else sf = 1; - } ctx = newctx; +// printf("__ %s %d\n", __FILE__, __LINE__); rv = __nss_ldap_search_next(&__nss_ldap_conf->search_method, ctx); if (rv != NSS_LDAP_SUCCESS) break; +// printf("__ %s %d\n", __FILE__, __LINE__); attr = ldap_first_attribute(ctx->conn->ld, ctx->msg, &cookie); ber_free(cookie, 0); +// printf("__ %s %d\n", __FILE__, __LINE__); if (attr == NULL) break; +// printf("__ %s %d\n", __FILE__, __LINE__); rv = __nss_ldap_parse_range(attr, &range_start, &range_end); if (rv != NSS_LDAP_SUCCESS) break; @@ -301,14 +343,28 @@ ldap_memfree((char *)attr); } - - new_res_arr = (char **)ALIGN(buf + res_buf_size - sizeof(char *) * - res_arr_size); - if (new_res_arr != res_arr) - memmove(new_res_arr, res_arr, sizeof(char *) * res_arr_size); +// printf("__ %s %d %d %d %d\n", __FILE__, __LINE__, res_buf_size, +// res_arr_size, (buf + bufsize - (char *)res_arr) / sizeof(char *) ); + +// char **cp; +// for (cp = res_arr; *cp; ++cp) { +// printf("__ %p\n", (void *)*cp); +// printf("__ %s, %d\n", *cp, (buf + bufsize - (char *)cp) / sizeof(char *)); +// } +// printf("__ %s %d %p %p\n", __FILE__, __LINE__, (void *)new_res_arr, +// res_arr); + if (!(flags & NSS_LDAP_ATTR_MULTI_STR_DONT_PACK_PTRS_FLAG)) { + new_res_arr = (char **)ALIGN(buf); + if (new_res_arr != res_arr) { + memmove(new_res_arr, res_arr, sizeof(char *) * + res_arr_size); + res_arr = new_res_arr; + } + } + *len = buf - sbuf; *str_array = res_arr; *str_array_size = res_arr_size; - *len = res_buf_size; + rv = NSS_LDAP_SUCCESS; fin: @@ -351,7 +407,6 @@ return (rv); } - static struct nss_ldap_search_context * start_search_def(struct nss_ldap_connection *conn, struct nss_ldap_configuration *conf, @@ -399,14 +454,17 @@ unsigned long abs_rescount; assert(ctx != NULL); - + +// printf("== %s %d\n", __FILE__, __LINE__); st: if (ctx->msg_first == NULL) { rv = ldap_result( ctx->conn->ld, ctx->msgid, LDAP_MSG_ALL, NULL, &ctx->msg_first); +// printf("== %s %d\n", __FILE__, __LINE__); switch (rv) { case -1: +// printf("== %s %d\n", __FILE__, __LINE__); __nss_ldap_log(NSS_LDAP_LL_ERR_INT, "search_next_def: " "ldap_result failed: search_base='%s', " "scope='%d', filter='%s', rv=%d", @@ -415,6 +473,7 @@ ctx->search_request.filter); return (NSS_LDAP_CONNECTION_ERROR); case 0: +// printf("== %s %d\n", __FILE__, __LINE__); goto st; case LDAP_RES_SEARCH_RESULT: case LDAP_RES_SEARCH_ENTRY: @@ -442,10 +501,13 @@ return (NSS_LDAP_GENERIC_ERROR); } } else { +// printf("== %s %d\n", __FILE__, __LINE__); ctx->msg = ldap_next_message(ctx->conn->ld, ctx->msg); - if (ctx->msg != NULL) + if (ctx->msg != NULL) { +// printf("== %s %d\n", __FILE__, __LINE__); return (NSS_LDAP_SUCCESS); - else { + } else { +// printf("== %s %d\n", __FILE__, __LINE__); rv = ldap_parse_result(ctx->conn->ld, ctx->msg_first, &errcode, &matcheddn, &errmsg, &referrals, &server_controls, @@ -454,24 +516,29 @@ ldap_msgfree(ctx->msg_first); ctx->msg_first = NULL; +// printf("== %s %d\n", __FILE__, __LINE__); if (rv == LDAP_SUCCESS) { +// printf("== %s %d\n", __FILE__, __LINE__); if (server_controls != NULL) { if (ctx->cookie != NULL) { ber_bvfree(ctx->cookie); ctx->cookie = NULL; } +// printf("== %s %d\n", __FILE__, __LINE__); rv = __nss_ldap_parse_page_control( ctx->conn->ld, server_controls, &abs_rescount, &ctx->cookie); if (rv != LDAP_SUCCESS) { +// printf("== %s %d\n", __FILE__, __LINE__); // TODO: write to logs smth scary } ldap_controls_free(server_controls); } - + +// printf("== %s %d\n", __FILE__, __LINE__); if (errmsg != NULL) ldap_memfree(errmsg); if (matcheddn != NULL) @@ -479,6 +546,7 @@ if (referrals != NULL) ldap_value_free(referrals); } else { +// printf("== %s %d\n", __FILE__, __LINE__); // TODO: signal to logs } @@ -487,13 +555,16 @@ rv = do_ldap_search_ext(ctx->conn, ctx->conf, &ctx->search_request, ctx, &ctx->msgid); if (rv != LDAP_SUCCESS) { +// printf("== %s %d\n", __FILE__, __LINE__); /* TODO: check this place */ return (NSS_LDAP_SUCCESS); } goto st; - } else + } else { +// printf("== %s %d\n", __FILE__, __LINE__); return (NSS_LDAP_SUCCESS); + } } } @@ -749,6 +820,18 @@ char const *attr, char ***str_array, size_t *str_array_size, size_t *len, char *buf, size_t bufsize) { + +// printf("__ %s %d\n", __FILE__, __LINE__); + return (__nss_ldap_assign_attr_multi_str_ext(ctx, attr, str_array, + str_array_size, len, buf, bufsize, 0, NULL, NULL)); +} + +int +__nss_ldap_assign_attr_multi_str_ext(struct nss_ldap_search_context *ctx, + char const *attr, char ***str_array, size_t *str_array_size, + size_t *len, char *buf, size_t bufsize, int flags, + nss_ldap_multi_str_process_fn sp_fn, void *mdata) +{ int rv; assert(ctx != NULL); @@ -759,11 +842,11 @@ assert(buf != NULL); rv = do_assign_attr_multi_str(ctx, attr, str_array, str_array_size, - len, buf, bufsize, 0); + len, buf, bufsize, flags, sp_fn, mdata); if (rv != NSS_LDAP_SUCCESS) __nss_ldap_log(NSS_LDAP_LL_DEBUG_INT, - "__nss_ldap_assign_attr_multi_str failed: attr='%s', rv=%d", - attr, rv); + "__nss_ldap_assign_attr_multi_str_ext failed: attr='%s', " + "rv=%d", attr, rv); return (rv); } @@ -773,6 +856,18 @@ >>> TRUNCATED FOR MAIL (1000 lines) <<<
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200610260832.k9Q8WDf6020565>