Package: ldapscripts
Version: 2.0.1-1
uname output: Linux 3.2.0-4-amd64 #1 SMP Debian 3.2.41-2+deb7u2 x86_64 GNU/Linux

Description:

Comment: The following description uses ldapid which is one of the many scripts 
that are part of the
ldapscripts package. This behaviour can be replicated with any of the scripts 
from this package.

Consider the following one line bash script:

#!/bin/bash
ldapid

This works fine when run from the shell (bash in my case). As soon as it is 
made a cron job, the error message
"Could not guess user" is thrown.

I had a similar problem earlier, consider the following bash script:

#!/bin/bash
ldapid
while read line
do
  ldapid
done <"Some file"
The first ldapid always worked but the second one threw the same error Could 
not guess user.

This eventually turned out to be a file descriptor problem and was solved by 
using the following snippet:

while read line <&3
do
  ldapid
done 3< "Some file"

With cron, there is absolutely no way to get around this problem, any parameter 
passed is ignored!

My actual usage inside a script: The exact command, right at the beginning of 
my script and where the whole thing
fails with the error "cannot guess user" is description=$(ldapfinger "$user" 
|grep description |cut -d: -f2) with
$user defined one line before. Replacing $user with a harcoded username does 
not help either. Seems that any input,
 implicitly or explicity passed as a parameter, is just ignored when run as a 
cron job with the error
"Cannot guess user". On the other hand, when I manually run the same script, 
everything works as intended.
(And note, this was a working script before some update with ldapscripts).

Many thanks in advance
Laks


Reply via email to