]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/filed/acl.c
- Turn on new bsnprintf() code.
[bacula/bacula] / bacula / src / filed / acl.c
index 284b777814d4e5a292f156997d48d3caed01980a..cd7270162517bfdd6ddef3cbfa75db4f0774ece0 100644 (file)
@@ -167,6 +167,11 @@ int bacl_get(JCR *jcr, int acltype)
          acl_free(acl_text);
          return len;
       }
+      berrno be;
+      Jmsg2(jcr, M_ERROR, 0, _("acl_to_text error on file \"%s\": ERR=%s\n"),
+         jcr->last_fname, be.strerror());
+      Dmsg3(100, "acl_to_text error acl=%s file=%s ERR=%s\n",  
+         jcr->acl_text, jcr->last_fname, be.strerror());
       acl_free(acl);
 #ifndef HAVE_OSF1_OS          /* BACL_ENOTSUP not defined for OSF1 */
    } else if (errno == BACL_ENOTSUP) {
@@ -213,12 +218,21 @@ int bacl_set(JCR *jcr, int acltype)
     */
 #ifndef HAVE_FREEBSD_OS
    if (acl_valid(acl) != 0) {
+      berrno be;
+      Jmsg2(jcr, M_ERROR, 0, _("ac_valid error on file \"%s\": ERR=%s\n"),
+         jcr->last_fname, be.strerror());
+      Dmsg3(100, "acl_valid error acl=%s file=%s ERR=%s\n",  
+         jcr->acl_text, jcr->last_fname, be.strerror());
       acl_free(acl);
       return -1;
    }
 #endif
 
-   if (acl_set_file(jcr->last_fname, ostype, acl) != 0) {
+   /*
+    * Restore the ACLs, but don't complain about links which really should
+    * not have attributes, and the file it is linked to may not yet be restored.
+    */
+   if (acl_set_file(jcr->last_fname, ostype, acl) != 0 && jcr->last_type != FT_LNK) {
       berrno be;
       Jmsg2(jcr, M_ERROR, 0, _("acl_set_file error on file \"%s\": ERR=%s\n"),
          jcr->last_fname, be.strerror());
@@ -253,6 +267,12 @@ int bacl_get(JCR *jcr, int acltype)
          actuallyfree(acl_text);
          return len;
       }
+      berrno be;
+      Jmsg2(jcr, M_ERROR, 0, _("acltostr error on file \"%s\": ERR=%s\n"),
+         jcr->last_fname, be.strerror());
+      Dmsg3(100, "acltostr error acl=%s file=%s ERR=%s\n",  
+         jcr->acl_text, jcr->last_fname, be.strerror());
+      return -1;
    }
    return -1;
 }
@@ -264,12 +284,31 @@ int bacl_set(JCR *jcr, int acltype)
 
    n = strtoacl(jcr->acl_text, 0, NACLENTRIES, acls, ACL_FILEOWNER, ACL_FILEGROUP);
    if (n <= 0) {
+      berrno be;
+      Jmsg2(jcr, M_ERROR, 0, _("strtoacl error on file \"%s\": ERR=%s\n"),
+         jcr->last_fname, be.strerror());
+      Dmsg3(100, "strtoacl error acl=%s file=%s ERR=%s\n",  
+         jcr->acl_text, jcr->last_fname, be.strerror());
       return -1;
    }
    if (strtoacl(jcr->acl_text, n, NACLENTRIES, acls, ACL_FILEOWNER, ACL_FILEGROUP) != n) {
+      berrno be;
+      Jmsg2(jcr, M_ERROR, 0, _("strtoacl error on file \"%s\": ERR=%s\n"),
+         jcr->last_fname, be.strerror());
+      Dmsg3(100, "strtoacl error acl=%s file=%s ERR=%s\n",  
+         jcr->acl_text, jcr->last_fname, be.strerror());
       return -1;
    }
-   if (setacl(jcr->last_fname, n, acls) != 0) {
+   /*
+    * Restore the ACLs, but don't complain about links which really should
+    * not have attributes, and the file it is linked to may not yet be restored.
+    */
+   if (setacl(jcr->last_fname, n, acls) != 0 && jcr->last_type != FT_LNK) {
+      berrno be;
+      Jmsg2(jcr, M_ERROR, 0, _("setacl error on file \"%s\": ERR=%s\n"),
+         jcr->last_fname, be.strerror());
+      Dmsg3(100, "setacl error acl=%s file=%s ERR=%s\n",  
+         jcr->acl_text, jcr->last_fname, be.strerror());
       return -1;
    }
    return 0;
@@ -301,6 +340,11 @@ int bacl_get(JCR *jcr, int acltype)
          free(acls);
          return len;
       }
+      berrno be;
+      Jmsg2(jcr, M_ERROR, 0, _("acltotext error on file \"%s\": ERR=%s\n"),
+         jcr->last_fname, be.strerror());
+      Dmsg3(100, "acltotext error acl=%s file=%s ERR=%s\n",  
+         jcr->acl_text, jcr->last_fname, be.strerror());
    }
    free(acls);
    return -1;
@@ -313,9 +357,23 @@ int bacl_set(JCR *jcr, int acltype)
 
    acls = aclfromtext(jcr->acl_text, &n);
    if (!acls) {
+      berrno be;
+      Jmsg2(jcr, M_ERROR, 0, _("aclfromtext error on file \"%s\": ERR=%s\n"),
+         jcr->last_fname, be.strerror());
+      Dmsg3(100, "aclfromtext error acl=%s file=%s ERR=%s\n",  
+         jcr->acl_text, jcr->last_fname, be.strerror());
       return -1;
    }
-   if (acl(jcr->last_fname, SETACL, n, acls) == -1) {
+   /*
+    * Restore the ACLs, but don't complain about links which really should
+    * not have attributes, and the file it is linked to may not yet be restored.
+    */
+   if (acl(jcr->last_fname, SETACL, n, acls) == -1 && jcr->last_type != FT_LNK) {
+      berrno be;
+      Jmsg2(jcr, M_ERROR, 0, _("acl(SETACL) error on file \"%s\": ERR=%s\n"),
+         jcr->last_fname, be.strerror());
+      Dmsg3(100, "acl(SETACL) error acl=%s file=%s ERR=%s\n",  
+         jcr->acl_text, jcr->last_fname, be.strerror());
       actuallyfree(acls);
       return -1;
    }