-/*
- * Initializations before calling ntfs_get_file_security()
- * ntfs_set_file_security() and ntfs_read_directory()
- *
- * Returns an (obscured) struct SECURITY_API* needed for further calls
- * NULL if device is mounted (EBUSY)
- */
-
-static struct SECURITY_API *_ntfs_initialize_file_security(const char *device,
- unsigned long flags)
-{
- ntfs_volume *vol;
- unsigned long mntflag;
- int mnt;
- struct SECURITY_API *scapi;
- struct SECURITY_CONTEXT *scx;
-
- scapi = (struct SECURITY_API*)NULL;
- mnt = ntfs_check_if_mounted(device, &mntflag);
- if (!mnt && !(mntflag & NTFS_MF_MOUNTED)) {
- vol = ntfs_mount(device, flags);
- if (vol) {
- scapi = (struct SECURITY_API*)
- ntfs_malloc(sizeof(struct SECURITY_API));
- if (!ntfs_volume_get_free_space(vol)
- && scapi) {
- scapi->magic = MAGIC_API;
- scapi->seccache = (struct PERMISSIONS_CACHE*)NULL;
- scx = &scapi->security;
- scx->vol = vol;
- scx->uid = 0;
- scx->gid = 0;
- scx->pseccache = &scapi->seccache;
- scx->vol->secure_flags = (1 << SECURITY_DEFAULT) |
- (1 << SECURITY_RAW);
- ntfs_open_secure(vol);
- ntfs_build_mapping(scx,(const char*)NULL,TRUE);
- } else {
- if (scapi)
- free(scapi);
- else
- errno = ENOMEM;
- mnt = ntfs_umount(vol,FALSE);
- scapi = (struct SECURITY_API*)NULL;
- }
- }
- } else
- errno = EBUSY;
- return (scapi);
-}
-
-/*
- * JPA NTFS constants or structs
- * should be moved to layout.h
- */
-
-#define ALIGN_SDS_BLOCK 0x40000 /* Alignment for a $SDS block */
-#define ALIGN_SDS_ENTRY 16 /* Alignment for a $SDS entry */
-#define STUFFSZ 0x4000 /* unitary stuffing size for $SDS */
-#define FIRST_SECURITY_ID 0x100 /* Lowest security id */
- /* Mask for attributes which can be forced */
-#define FILE_ATTR_SETTABLE ( FILE_ATTR_READONLY \
- | FILE_ATTR_HIDDEN \
- | FILE_ATTR_SYSTEM \
- | FILE_ATTR_ARCHIVE \
- | FILE_ATTR_TEMPORARY \
- | FILE_ATTR_OFFLINE \
- | FILE_ATTR_NOT_CONTENT_INDEXED )
-
-
-
-#if 0
-#endif
-