woensdag 6 mei 2009

Samba : DFS does not work on AIX

Introduction:
Currently, there is a minor bug in Samba which makes DFS unusable on AIX.

Impacted:
- Samba <= 3.3.4

Details:
The issue is caused by the behaviour of the readlink system call on AIX. If the size of the buffer cannot contain the entire symbolic link, the ERANGE error is returned. Other UNIX and Linux distributions will never return an error if the size of the buffer is too small. Instead, only a part of the symbolic link will be written in the buffer.

In msdfs.c, the character 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 looks like:

--- 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;


Resolution:
- Bugzilla item # 6330 was created to address this issue.

Geen opmerkingen:

Een reactie posten