Getent removing slashes on Ub 1604

Bug #1652260 reported by J S Halfpenny on 2016-12-23
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
LTSP
Undecided
Unassigned

Bug Description

As discussed on the ltsp-discussions mailing list (mail included below) with a solution proposed from Alkis Georgopoulos.

Problem:

 getent passwd user

Returns a windows path with backslashes removed on LTSP client but works fine on LTSP server.

Solution:

open ($CHROOT)/usr/share/ldm/rc.d/X01-localapps
find 2 "read" commands in lines 36 and 46 and replace them with "read -r" so that it doesn't interpret the backslashes.

i.e.:

IFS=':' read -r LDM_USERNAME dummy pw_uid pw_gid pw_gecos LDM_HOME
pw_shell <<EOF

and:
while IFS=':' read -r gr_name dummy gr_gid dummy; do

Full email:

We've been running LTSP for a while now on Ubuntu 14.04, and I'm in the process of upgrading to 16.04.

Our server connects to Windows using kerberos, samba and nslcd to map attributes to their unix counterparts. This works well, and allows me to login to a client using Windows credentials and map the drive locally.

However, on Ub1404, to map the home directory I run a script which uses getent, and the returned string is, e.g. \\server\share\share\username

But on Ub1604, getent does not return this properly, but instead removes the slashes, e.g. \servershareshareusername

If I run getent on the LTSP server, it works, but not on the client.

I've never seen this before. When I strace getent from the client, it doesn't even seem to query nsswitch, whereas it does from the server.

e.g. from client:

$ strace -e open getent passwd testac
open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
open("/lib/x86_64-linux-gnu/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
open("/usr/lib/locale/locale-archive", O_RDONLY|O_CLOEXEC) = 3
testac:x:2660:513:<email address hidden>,,,\servershareshareusername:/opt/ltsphome/testac:/bin/bash
+++ exited with 0 +++

But from the server it seems more comprehensive:

$ strace -e open getent passwd testac
open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
open("/lib/x86_64-linux-gnu/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
open("/usr/lib/locale/locale-archive", O_RDONLY|O_CLOEXEC) = 3
open("/etc/nsswitch.conf", O_RDONLY|O_CLOEXEC) = 3
open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
open("/lib/x86_64-linux-gnu/libnss_files.so.2", O_RDONLY|O_CLOEXEC) = 3
open("/etc/passwd&
quot;, O_RDONLY|O_CLOEXEC) = 3
open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
open("/lib/x86_64-linux-gnu/libnss_ldap.so.2", O_RDONLY|O_CLOEXEC) = 3
testac:x:2660:513:<email address hidden>,,,\\server\share\share\username:/opt/ltsphome/testac:/bin/bash
+++ exited with 0 +++

I know authentication can be one of those tricky subjects, but I don't personally feel that this is the issue here, whereas the weird behaviour of getent is. If anyone has any clues or pointers I'd be very grateful, everything else seems to be working fine.

Best Wishes
John

Solution email:

Hi John,

open ($CHROOT)/usr/share/ldm/rc.d/X01-localapps
find 2 "read" commands in lines 36 and 46
and replace them with "read -r" so that it doesn't interpret the
backslashes.

I.e.:
IFS=':' read -r LDM_USERNAME dummy pw_uid pw_gid pw_gecos LDM_HOME
pw_shell <<EOF
and:
while IFS=':' read -r gr_name dummy gr_gid dummy; do

If that works, file a bug report in https://bugs.launchpad.net/ltsp/ so
that I can commit the fix.

Cheers,
Alkis Georgopoulos
LTSP developer

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers