> > I think that run-windows-in-a-vm is a better idea than using BartPE, now if > Bacula can restore acl stream from BackupWrite/Read, i would be very happy > too! >
The patch tacked onto the end of this email accomplishes this, with the following (serious) restrictions/bugs: . Doesn't seem to work on directories. I assume that this is because when directories get restored, processWin32BackupAPIBlock is never called at any point... does that sound right? Any suggestions as to how to work around it? . Some other type of file is failing to apply ACL's... can I get the filename from the jcr? Or any other way? . I'm restoring the Extended Attributes too, but haven't yet tested if they actually do anything . Needs the current 'Advanced' version of ntfs-3g . The patch as it stands assumes that you are restoring to a filesystem mounted with the 'Advanced' version of ntfs-3g. If you were to try and restore to any other filesystem you would fill your logs with errors about failing to set attributes. . Alternate Data Streams are not restored. Easy enough to add I think, but ntfs-3g has a few different ways of allowing access to them and I don't know which is best at this point. . If a win32 backup stream (other than the normal data) crossed a bacula buffer boundary then it won't work. The alternative is to read the stream into a memory buffer and only set the xattr when it is completely read into memory. I haven't seen that happen yet but I'm pretty sure that it could. . Reparse points aren't restored, but I think that's just another 3 lines of code. . Needs the attr libraries . Assumes that you are restoring onto the same endianness as you backed up on. Windows is and has always been little-endian only so I don't think this is a problem. To make it endian independent would be a nightmare. James diff --git a/bacula/src/findlib/bfile.c b/bacula/src/findlib/bfile.c index 3a98480..4950e93 100644 --- a/bacula/src/findlib/bfile.c +++ b/bacula/src/findlib/bfile.c @@ -38,6 +38,7 @@ #include "bacula.h" #include "find.h" +#include <attr/xattr.h> const int dbglvl = 200; @@ -244,6 +245,10 @@ bool processWin32BackupAPIBlock (BFILE *bfd, void *pBuffer, ssize_t dwSize) */ int32_t dwSizeHeader = 20; + if (pContext->bIsInData && pContext->header_stream.dwStreamId != WIN32_BACKUP_DATA) { + Jmsg(bfd->jcr, M_WARNING, 0, _("WIN32_BACKUP_%d split across buffers\n"), pContext->header_stream.dwStreamId); + } + do { if (pContext->liNextHeader >= dwSize) { dwDataLen = dwSize-dwDataOffset; @@ -256,8 +261,21 @@ bool processWin32BackupAPIBlock (BFILE *bfd, void *pBuffer, ssize_t dwSize) /* flush */ /* copy block of real DATA */ if (pContext->bIsInData) { - if (bwrite(bfd, ((char *)pBuffer)+dwDataOffset, dwDataLen) != (ssize_t)dwDataLen) - return false; + switch (pContext->header_stream.dwStreamId) + { + case WIN32_BACKUP_DATA: + if (bwrite(bfd, ((char *)pBuffer)+dwDataOffset, dwDataLen) != (ssize_t)dwDataLen) + return false; + break; + case WIN32_BACKUP_EA_DATA: + if (fsetxattr(bfd->fid, "system.ntfs_attrib", ((char *)pBuffer)+dwDataOffset, dwDataLen, 0) != 0) + Jmsg(bfd->jcr, M_WARNING, 0, _("failed to set EA on fd %d length %d for '%s' - %s\n"), bfd->fid, dwDataLen, "somefile", strerror(errno)); + break; + case WIN32_BACKUP_SECURITY_DATA: + if (fsetxattr(bfd->fid, "system.ntfs_acl", ((char *)pBuffer)+dwDataOffset, dwDataLen, 0) != 0) + Jmsg(bfd->jcr, M_WARNING, 0, _("failed to set ACL on fd %d length %d for '%s' - %s\n"), bfd->fid, dwDataLen, "somefile", strerror(errno)); + break; + } } if (pContext->liNextHeader < dwSize) {/* is a header in this block ? */ @@ -304,7 +322,7 @@ bool processWin32BackupAPIBlock (BFILE *bfd, void *pBuffer, ssize_t dwSize) int64_LE2BE (&(pContext->liNextHeader), pContext->header_stream.Size); pContext->liNextHeader += dwDataOffset; - pContext->bIsInData = pContext->header_stream.dwStreamId == WIN32_BACKUP_DATA; + pContext->bIsInData = true; if (dwDataOffset == dwSize) bContinue = false; } else { diff --git a/bacula/src/findlib/bfile.h b/bacula/src/findlib/bfile.h index b22d50c..9575147 100644 --- a/bacula/src/findlib/bfile.h +++ b/bacula/src/findlib/bfile.h @@ -43,6 +43,8 @@ */ #define WIN32_BACKUP_DATA 1 +#define WIN32_BACKUP_EA_DATA 2 +#define WIN32_BACKUP_SECURITY_DATA 3 typedef struct _BWIN32_STREAM_ID { int32_t dwStreamId; ------------------------------------------------------------------------------ Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference _______________________________________________ Bacula-devel mailing list Bacula-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/bacula-devel