Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 77095 - Migration tools fail when empty lines exist in input files.
Summary: Migration tools fail when empty lines exist in input files.
Status: RESOLVED INVALID
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: High normal
Assignee: Robin Johnson
URL: http://www.gentoo.org/doc/en/ldap-how...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-01-07 18:01 UTC by Jesse
Modified: 2005-01-09 18:25 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jesse 2005-01-07 18:01:30 UTC
There are a couple of issues here muddled together that I hope I can straighten out. First off, going by the gentoo ldap howto, running the commands in codeblock 3.2 doesn't perform sanity checks on the data it parses. for example, if you have an empty line between two entries in the /etc/passwd file:

[snip]
rpc:x:111:111:added by portage for portmap:/dev/null:/bin/false

jamie:x:1020:100::/home/jamie:/bin/bash
[/snip]


./migrate_passwd.pl /etc/passwd /tmp/passwd.ldif
 produces an entry that looks like this:

[snip]
dn: uid=,ou=People,dc=morgajel,dc=com
uid:
cn:
sn:
objectClass: person
objectClass: organizationalPerson
objectClass: inetOrgPerson
objectClass: account
objectClass: posixAccount
objectClass: top
userPassword: {crypt}
uidNumber:
gidNumber:
homeDirectory:
[/snip]

Notice there is no name in the "uid=" line.

I've tested and found this error in both

Reproducible: Always
Steps to Reproduce:
1.
2.
3.

Actual Results:  
system chokes when trying to run 
ldapadd -D "cn=Manager,dc=example,dc=com" -W -f /tmp/passwd.ldif
when it gets to the empty entry.

Expected Results:  
a sanity check would not allow an empty line to be parsed; there should also be
some error checking allowing the rest of the script to run (perhaps, perhaps not).

this was performed with net-nds/migrationtools-44-r1
Comment 1 Jesse 2005-01-08 07:56:17 UTC
oops, and the ever-lovable emerge info...


Portage 2.0.51-r3 (default-linux/x86/2004.3, gcc-3.3.4, glibc-2.3.4.20040808-r1, 2.6.3-mm4 i686)
=================================================================
System uname: 2.6.3-mm4 i686 Pentium III (Coppermine)
Gentoo Base System version 1.4.16
distcc 2.16 i686-pc-linux-gnu (protocols 1 and 2) (default port 3632) [enabled]
ccache version 2.3 [enabled]
Autoconf: sys-devel/autoconf-2.59-r5
Automake: sys-devel/automake-1.8.5-r1
Binutils: sys-devel/binutils-2.15.90.0.1.1-r3
Headers:  sys-kernel/linux-headers-2.4.19-r1,sys-kernel/linux-headers-2.4.21-r1
Libtools: sys-devel/libtool-1.5.2-r7
ACCEPT_KEYWORDS="x86"
AUTOCLEAN="yes"
CFLAGS="-O3 -mcpu=pentium3 -funroll-loops -pipe"
CHOST="i686-pc-linux-gnu"
COMPILER=""
CONFIG_PROTECT="/etc /usr/kde/2/share/config /usr/kde/3/share/config /usr/share/config /var/qmail/control"
CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d"
CXXFLAGS="-O3 -mcpu=pentium3 -funroll-loops -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoaddcvs autoconfig ccache distcc distlocks sandbox sfperms"
GENTOO_MIRRORS="http://gentoo.oregonstate.edu/"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY=""
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="x86 acl alsa apache1 apm berkdb bitmap-fonts cdr chroot crypt cups doc encode fam fbcon foomaticdb fortran gdbm gif gpm gtk2 imagemagick jpeg kerberos ldap libclamav libwww mad mikmod motif mpeg mysql ncurses nls oggvorbis opengl openssh oss pam pdflib perl png postgres python rage128 readline ruby samba scanner sdl slang snmp spell ssl svga tcpd tiff truetype xml2 xv zlib"

Comment 2 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2005-01-08 18:03:30 UTC
your /etc/passwd is invalid.
it should never contain blank lines. they violate the original POSIX/SUS specifications - which say a blank line should be treated as the end of file.

The glibc base NSS currently accepts it begrudgingly, but it is strongly discouraged.

if you still want migration-tools fixed, attach a patch and reopen this.
Comment 3 Jesse 2005-01-09 18:25:05 UTC
I'm not much of a coder myself, or I would attach a patch.

However, right or wrong, I think some kind of error-catching/warning is in order rather than producing an invalid output.  when it finds the empty like, it should stop according to the posix spec, not produce an invalid LDIF entry and move on.