]> git.sur5r.net Git - bacula/bacula/commitdiff
Added some handling of EPERM and EOPNOTSUPP which seem to be returned when you try to
authorMarco van Wieringen <mvw@planets.elm.net>
Sat, 26 Dec 2009 10:22:26 +0000 (11:22 +0100)
committerMarco van Wieringen <mvw@planets.elm.net>
Sat, 26 Dec 2009 10:22:26 +0000 (11:22 +0100)
retrieve the system extended attributes a non root user.

bacula/src/filed/xattr.c

index ae25def26b23f525aaf56e2fd29f153254d18d72..2611c7a6263a57ee637653dd5f53a5114b7fe192 100644 (file)
@@ -676,6 +676,10 @@ static bxattr_exit_code bsd_build_xattr_streams(JCR *jcr, FF_PKT *ff_pkt)
 
       /*
        * First get the length of the available list with extended attributes.
+       * If we get EPERM on system namespace, don't return error.
+       * This is expected for normal users trying to archive the system
+       * namespace on FreeBSD 6.2 and later. On NetBSD 3.1 and later,
+       * they've decided to return EOPNOTSUPP instead.
        */
       xattr_list_len = extattr_list_link(jcr->last_fname, attrnamespace, NULL, 0);
       if (xattr_list_len < 0) {
@@ -683,6 +687,18 @@ static bxattr_exit_code bsd_build_xattr_streams(JCR *jcr, FF_PKT *ff_pkt)
          case ENOENT:
             retval = bxattr_exit_ok;
             goto bail_out;
+#if defined(EOPNOTSUPP)
+         case EOPNOTSUPP:
+#endif
+         case EPERM:
+            if (attrnamespace == EXTATTR_NAMESPACE_SYSTEM) {
+               actuallyfree(current_attrnamespace);
+               current_attrnamespace = NULL;
+               continue;
+            }
+            /*
+             * FALLTHROUGH
+             */
          default:
             Mmsg2(jcr->errmsg, _("extattr_list_link error on file \"%s\": ERR=%s\n"),
                   jcr->last_fname, be.bstrerror());