#endif
#ifdef HAVE_ACL
+ /*** FIXME ***/
/* ACL stream */
if (ff_pkt->flags & FO_ACL) {
- POOLMEM *msgsave;
- char *acl_text;
+ char *acl_text = NULL;
+ char *aclDef_text = NULL;
+
/* Read ACLs for files, dirs and links */
if (ff_pkt->type == FT_DIREND) {
- /* Directory: Try for default ACL*/
- acl_t myAcl = acl_get_file(ff_pkt->fname, ACL_TYPE_DEFAULT);
- if (!myAcl) {
- Dmsg1(200, "No default ACL defined for directory: %s!\n", ff_pkt->fname);
- /* If there is no default ACL get standard ACL */
- myAcl = acl_get_file(ff_pkt->fname, ACL_TYPE_ACCESS);
- if (!myAcl) {
- Jmsg1(jcr, M_WARNING, 0, "Error while trying to get ACL of directory: %s!\n", ff_pkt->fname);
- }
- }
- acl_text = acl_to_any_text(myAcl, NULL, ',', TEXT_ABBREVIATE);
- /* Free memory */
- acl_free(myAcl);
+ /* Directory: Check for default ACL*/
+ acl_t myDefAcl = acl_get_file(ff_pkt->fname, ACL_TYPE_DEFAULT);
+ /* Check for Access ACL */
+ acl_t myAccAcl = acl_get_file(ff_pkt->fname, ACL_TYPE_ACCESS);
+ if (!myDefAcl || !myAccAcl) {
+ Jmsg1(jcr, M_WARNING, 0, "Error while trying to get ACL of directory: %s!\n", ff_pkt->fname);
+ }
+ if(myDefAcl){
+ aclDef_text = acl_to_any_text(myDefAcl, NULL, ',', TEXT_ABBREVIATE);
+ acl_free(myDefAcl);
+ }
+ if(myAccAcl){
+ acl_text = acl_to_any_text(myAccAcl, NULL, ',', TEXT_ABBREVIATE);
+ acl_free(myAccAcl);
+ }
} else {
/* Files or links */
- acl_t myAcl = acl_get_file(ff_pkt->fname, ACL_TYPE_ACCESS);
+ acl_t myAcl = acl_get_file(ff_pkt->fname, ACL_TYPE_ACCESS);
if (!myAcl) {
Jmsg1(jcr, M_WARNING, 0, "Error while trying to get ACL of file: %s!\n", ff_pkt->fname);
acl_free(myAcl);
acl_text = acl_to_any_text(myAcl, NULL, ',', TEXT_ABBREVIATE);
acl_free(myAcl);
}
-
+
+ POOLMEM *msgsave;
+
/* If there is an ACL, send it to the Storage daemon */
- if (acl_text) {
+ if (acl_text != NULL) {
sd = jcr->store_bsock;
pm_strcpy(&jcr->last_fname, ff_pkt->fname);
-
- /*
- * Send ACL header
- *
- */
- if (!bnet_fsend(sd, "%ld %d 0", jcr->JobFiles, STREAM_UNIX_ATTRIBUTES_ACL)) {
+
+
+ // Send ACL header
+ if (!bnet_fsend(sd, "%ld %d 0", jcr->JobFiles, STREAM_UNIX_ATTRIBUTES_ACCESS_ACL)) {
berrno be;
Jmsg1(jcr, M_FATAL, 0, _("Network send error to SD. ERR=%s\n"),
bnet_strerror(sd));
return 0;
}
-
+
/* Send the buffer to the storage deamon */
msgsave = sd->msg;
sd->msg = acl_text;
}
}
}
- }
+ /* If there is an Default ACL, send it to the Storage daemon */
+ if (aclDef_text != NULL) {
+ sd = jcr->store_bsock;
+ pm_strcpy(&jcr->last_fname, ff_pkt->fname);
+
+
+ // Send ACL header
+ if (!bnet_fsend(sd, "%ld %d 0", jcr->JobFiles, STREAM_UNIX_ATTRIBUTES_DEFAULT_ACL)) {
+ berrno be;
+ Jmsg1(jcr, M_FATAL, 0, _("Network send error to SD. ERR=%s\n"),
+ bnet_strerror(sd));
+ return 0;
+ }
+
+ // Send the buffer to the storage deamon
+ msgsave = sd->msg;
+ sd->msg = aclDef_text;
+ sd->msglen = strlen(aclDef_text) + 1;
+ if (!bnet_send(sd)) {
+ berrno be;
+ sd->msg = msgsave;
+ sd->msglen = 0;
+ Jmsg1(jcr, M_FATAL, 0, _("Network send error to SD. ERR=%s\n"),
+ bnet_strerror(sd));
+ } else {
+ jcr->JobBytes += sd->msglen;
+ sd->msg = msgsave;
+ if (!bnet_sig(sd, BNET_EOD)) {
+ berrno be;
+ Jmsg1(jcr, M_FATAL, 0, _("Network send error to SD. ERR=%s\n"),
+ bnet_strerror(sd));
+ } else {
+ Dmsg1(200, "ACL of file: %s successfully backed up!\n", ff_pkt->fname);
+ }
+ }
+ }
+ }
#endif
/* Terminate any signature and send it to Storage daemon and the Director */
#else
non_support_finfo++;
#endif
-
- case STREAM_UNIX_ATTRIBUTES_ACL:
+/*** FIXME ***/
+case STREAM_UNIX_ATTRIBUTES_ACCESS_ACL:
#ifdef HAVE_ACL
- /* Recover ACL from stream and check it */
+ /* Recover Acess ACL from stream and check it */
acl = acl_from_text(sd->msg);
if (acl_valid(acl) != 0) {
Jmsg1(jcr, M_WARNING, 0, "Failure in the ACL of %s! FD is not able to restore it!\n", jcr->last_fname);
/* Try to restore ACL */
if (attr->type == FT_DIREND) {
/* Directory */
- if (acl_set_file(jcr->last_fname, ACL_TYPE_DEFAULT, acl) != 0 &&
- acl_set_file(jcr->last_fname, ACL_TYPE_ACCESS, acl) != 0) {
+ if (acl_set_file(jcr->last_fname, ACL_TYPE_ACCESS, acl) != 0) {
Jmsg1(jcr, M_WARNING, 0, "Error! Can't restore ACL of directory: %s! Maybe system does not support ACLs!\n", jcr->last_fname);
}
/* File or Link */
#else
non_support_acl++;
break; /* unconfigured, ignore */
-#endif
+#endif
+ case STREAM_UNIX_ATTRIBUTES_DEFAULT_ACL:
+#ifdef HAVE_ACL
+ /* Recover Default ACL from stream and check it */
+ acl = acl_from_text(sd->msg);
+ if (acl_valid(acl) != 0) {
+ Jmsg1(jcr, M_WARNING, 0, "Failure in the Default ACL of %s! FD is not able to restore it!\n", jcr->last_fname);
+ acl_free(acl);
+ }
+
+ /* Try to restore ACL */
+ if (attr->type == FT_DIREND) {
+ /* Directory */
+ if (acl_set_file(jcr->last_fname, ACL_TYPE_DEFAULT, acl) != 0) {
+ Jmsg1(jcr, M_WARNING, 0, "Error! Can't restore Default ACL of directory: %s! Maybe system does not support ACLs!\n", jcr->last_fname);
+ }
+ }
+ acl_free(acl);
+ Dmsg1(200, "Default ACL of file: %s successfully restored!", jcr->last_fname);
+ break;
+#else
+ non_support_acl++;
+ break; /* unconfigured, ignore */
+#endif
+/*** FIXME ***/
case STREAM_MD5_SIGNATURE:
case STREAM_SHA1_SIGNATURE: