Hi There appears to be a small bug in Samba concerning the use of DFS on AIX. In msdfs.c, the char array 'link_target_buf' is defined with size 7 (size of "msdfs:" + 1). Since the DFS link is larger than that, the readlink() system call on AIX returns ERANGE. In order to resolve this issue, the array should be of size PATH_MAX (defined in /usr/include/sys/limits.h). A proposed patch --- msdfs.c 2009-05-06 08:36:00.000000000 +0200 +++ msdfs.new.c 2009-05-06 08:36:44.000000000 +0200 @@ -400,11 +400,15 @@ char **pp_link_target, SMB_STRUCT_STAT *sbufp) { SMB_STRUCT_STAT st; int referral_len = 0; +#ifdef AIX + char link_target_buf[PATH_MAX]; +#else char link_target_buf[7]; +#endif size_t bufsize = 0; char *link_target = NULL; if (pp_link_target) { bufsize = 1024;
According to our recent discussion on samba-technical@samba.org, this seems to be a correct workaround for an AIX bug. Before this goes in, I think someone (me??) needs to write a configure test for this broken behaviour and not make this depend on the AIX #define. This might only apply to certain versions of AIX, and this bug might also happen on different OSes. Volker
Volker I've been doing some research and so far I found out that AIX is the only OS that complains if the size of the buffer is too small (and returns ERANGE). Other OSes (SunOS,HP-UX,Linux,BSD) don't show this behaviour.
So IMHO the patch should be #ifdef BROKEN_READLINK_CALL, not #ifdef AIX, and the real meat of the patch is in a configure test that would set this. I can try and come up with this later this week. Jeremy.
Created attachment 4131 [details] Proposed patch. Can you test this patch please. It adds the feature test (which passes on Linux and should fail on AIX). Should apply to 3.3.x and 3.4.x. Thanks, Jeremy.
Hi Jeremy Patch works fine! Thanks!
I think this will also work for 3.3. Volker, do you want to review for possible 3.3 inclusion ? Jeremy.
Looks good to me. Karolin, please put this in for 3.3.5. Thanks, Volker
Will be included in 3.3.5. Closing out bug report. Thanks for reporting!