Re: [Exim] very strange problem with NIS and localuser

Page principale
Supprimer ce message
Répondre à ce message
Auteur: Philip Hazel
Date:  
À: KOEN BREUGELMANS
CC: exim-users, kbr
Sujet: Re: [Exim] very strange problem with NIS and localuser
On Fri, 12 Nov 1999, KOEN BREUGELMANS wrote:

> For local delivery, exim looks up the user using the getpwnam()
> function (at least this is what I read in the documentation).


Yes!

> The
> programm I used to show wheter NIS works, also uses getpwnam().
> So I assume there is no difference...


There shouldn't be!

> localuser director failed for test: no such user


Weird!

I do not understand this at all. It should just be calling getpwnam().

To find out what is happening, I'm afraid you are going to have to make
some modifications to the code to insert additional debugging
statements. Luckily you are a C programmer. :-) If you look in the
source module direct.c you will find (around line 581) a function called

BOOL
direct_finduser(char *s, struct passwd **pw, uid_t *return_uid)

It is in this short function that the call to getpwnam() occurs. It is
called with the third argument NULL in this case. All it is doing is
caching the last call (for efficiency) and doing the getpwnam() a few
times before failing, to cope with NIS delays.

I suggest you insert the statement

debug_printf("called with s=%s\n", s);

at the start, to check it is getting passed the right string, and then
stick some more debug_printf() statements throughout the function to
print out various things. Then run your -d9 test again. (Actually, you
don't need to do a delivery: just try "exim -d9 -bt <test address>".)

Sorry that I can't suggest anything easier.

[Oh, one further thought: did you try running your getpwnam() test as
root? Exim will be running as root when directing. It shouldn't make any
difference, but ...]

-- 
Philip Hazel            University of Cambridge Computing Service,
ph10@???      Cambridge, England. Phone: +44 1223 334714.