Reverted back relay for free() and consequences on const ptrs
parent
44326c40b7
commit
a8a33f0bc3
|
@ -37,7 +37,7 @@ typedef struct _ntfs_attr_search_ctx ntfs_attr_search_ctx;
|
|||
#include "logging.h"
|
||||
|
||||
extern ntfschar AT_UNNAMED[];
|
||||
extern const ntfschar STREAM_SDS[];
|
||||
extern ntfschar STREAM_SDS[];
|
||||
|
||||
/**
|
||||
* enum ntfs_lcn_special_values - special return values for ntfs_*_vcn_to_lcn()
|
||||
|
@ -173,7 +173,7 @@ struct _ntfs_attr {
|
|||
runlist_element *rl;
|
||||
ntfs_inode *ni;
|
||||
ATTR_TYPES type;
|
||||
const ntfschar *name;
|
||||
ntfschar *name;
|
||||
u32 name_len;
|
||||
unsigned long state;
|
||||
s64 allocated_size;
|
||||
|
@ -262,10 +262,11 @@ extern void ntfs_attr_init(ntfs_attr *na, const BOOL non_resident,
|
|||
const s64 allocated_size, const s64 data_size,
|
||||
const s64 initialized_size, const s64 compressed_size,
|
||||
const u8 compression_unit);
|
||||
/* warning : in the following "name" has to be freeable */
|
||||
/* or one of constants AT_UNNAMED, NTFS_INDEX_I30 or STREAM_SDS */
|
||||
|
||||
/* warning : in the following "name" has to be freeable */
|
||||
/* or one of constants AT_UNNAMED, NTFS_INDEX_I30 or STREAM_SDS */
|
||||
extern ntfs_attr *ntfs_attr_open(ntfs_inode *ni, const ATTR_TYPES type,
|
||||
const ntfschar *name, u32 name_len);
|
||||
ntfschar *name, u32 name_len);
|
||||
extern void ntfs_attr_close(ntfs_attr *na);
|
||||
|
||||
extern s64 ntfs_attr_pread(ntfs_attr *na, const s64 pos, s64 count,
|
||||
|
@ -274,7 +275,7 @@ extern s64 ntfs_attr_pwrite(ntfs_attr *na, const s64 pos, s64 count,
|
|||
const void *b);
|
||||
|
||||
extern void *ntfs_attr_readall(ntfs_inode *ni, const ATTR_TYPES type,
|
||||
const ntfschar *name, u32 name_len, s64 *data_size);
|
||||
ntfschar *name, u32 name_len, s64 *data_size);
|
||||
|
||||
extern s64 ntfs_attr_mst_pread(ntfs_attr *na, const s64 pos,
|
||||
const s64 bk_cnt, const u32 bk_size, void *dst);
|
||||
|
@ -297,15 +298,15 @@ extern int ntfs_attr_can_be_resident(const ntfs_volume *vol,
|
|||
extern int ntfs_make_room_for_attr(MFT_RECORD *m, u8 *pos, u32 size);
|
||||
|
||||
extern int ntfs_resident_attr_record_add(ntfs_inode *ni, ATTR_TYPES type,
|
||||
const ntfschar *name, u8 name_len, const u8 *val, u32 size,
|
||||
ntfschar *name, u8 name_len, u8 *val, u32 size,
|
||||
ATTR_FLAGS flags);
|
||||
extern int ntfs_non_resident_attr_record_add(ntfs_inode *ni, ATTR_TYPES type,
|
||||
const ntfschar *name, u8 name_len, VCN lowest_vcn,
|
||||
int dataruns_size, ATTR_FLAGS flags);
|
||||
ntfschar *name, u8 name_len, VCN lowest_vcn, int dataruns_size,
|
||||
ATTR_FLAGS flags);
|
||||
extern int ntfs_attr_record_rm(ntfs_attr_search_ctx *ctx);
|
||||
|
||||
extern int ntfs_attr_add(ntfs_inode *ni, ATTR_TYPES type,
|
||||
const ntfschar *name, u8 name_len, const u8 *val, s64 size);
|
||||
ntfschar *name, u8 name_len, u8 *val, s64 size);
|
||||
extern int ntfs_attr_rm(ntfs_attr *na);
|
||||
|
||||
extern int ntfs_attr_record_resize(MFT_RECORD *m, ATTR_RECORD *a, u32 new_size);
|
||||
|
@ -354,9 +355,9 @@ extern s64 ntfs_get_attribute_value(const ntfs_volume *vol,
|
|||
extern void ntfs_attr_name_free(char **name);
|
||||
extern char *ntfs_attr_name_get(const ntfschar *uname, const int uname_len);
|
||||
extern int ntfs_attr_exist(ntfs_inode *ni, const ATTR_TYPES type,
|
||||
const ntfschar *name, u32 name_len);
|
||||
ntfschar *name, u32 name_len);
|
||||
extern int ntfs_attr_remove(ntfs_inode *ni, const ATTR_TYPES type,
|
||||
const ntfschar *name, u32 name_len);
|
||||
ntfschar *name, u32 name_len);
|
||||
|
||||
#endif /* defined _NTFS_ATTRIB_H */
|
||||
|
||||
|
|
|
@ -84,7 +84,7 @@
|
|||
*/
|
||||
typedef struct {
|
||||
ntfs_inode *ni;
|
||||
const ntfschar *name;
|
||||
ntfschar *name;
|
||||
u32 name_len;
|
||||
INDEX_ENTRY *entry;
|
||||
void *data;
|
||||
|
@ -106,7 +106,7 @@ typedef struct {
|
|||
} ntfs_index_context;
|
||||
|
||||
extern ntfs_index_context *ntfs_index_ctx_get(ntfs_inode *ni,
|
||||
const ntfschar *name, u32 name_len);
|
||||
ntfschar *name, u32 name_len);
|
||||
extern void ntfs_index_ctx_put(ntfs_index_context *ictx);
|
||||
extern void ntfs_index_ctx_reinit(ntfs_index_context *ictx);
|
||||
|
||||
|
@ -129,7 +129,7 @@ extern void ntfs_ih_filename_dump(INDEX_HEADER *ih);
|
|||
|
||||
/* the following were added by JPA for temporary use in security.c */
|
||||
extern INDEX_ENTRY *ntfs_ie_get_by_pos(INDEX_HEADER *ih, int pos);
|
||||
extern INDEX_ROOT *ntfs_ir_lookup(ntfs_inode *ni, const ntfschar *name,
|
||||
extern INDEX_ROOT *ntfs_ir_lookup(ntfs_inode *ni, ntfschar *name,
|
||||
u32 name_len, ntfs_attr_search_ctx **ctx);
|
||||
extern int ntfs_ie_add(ntfs_index_context *icx, INDEX_ENTRY *ie);
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
struct MAPPING {
|
||||
struct MAPPING *next;
|
||||
int xid; /* linux id : uid or gid */
|
||||
const SID *sid; /* Windows id : usid or gsid */
|
||||
SID *sid; /* Windows id : usid or gsid */
|
||||
};
|
||||
|
||||
/*
|
||||
|
|
|
@ -59,11 +59,11 @@
|
|||
#include "misc.h"
|
||||
|
||||
ntfschar AT_UNNAMED[] = { const_cpu_to_le16('\0') };
|
||||
const ntfschar STREAM_SDS[] = { const_cpu_to_le16('$'),
|
||||
const_cpu_to_le16('S'),
|
||||
const_cpu_to_le16('D'),
|
||||
const_cpu_to_le16('S'),
|
||||
const_cpu_to_le16('\0') };
|
||||
ntfschar STREAM_SDS[] = { const_cpu_to_le16('$'),
|
||||
const_cpu_to_le16('S'),
|
||||
const_cpu_to_le16('D'),
|
||||
const_cpu_to_le16('S'),
|
||||
const_cpu_to_le16('\0') };
|
||||
|
||||
/**
|
||||
* ntfs_get_attribute_value_length - Find the length of an attribute
|
||||
|
@ -270,13 +270,11 @@ s64 ntfs_get_attribute_value(const ntfs_volume *vol,
|
|||
* Initialize the ntfs attribute @na with @ni, @type, @name, and @name_len.
|
||||
*/
|
||||
static void __ntfs_attr_init(ntfs_attr *na, ntfs_inode *ni,
|
||||
const ATTR_TYPES type, const ntfschar *name, const u32 name_len)
|
||||
const ATTR_TYPES type, ntfschar *name, const u32 name_len)
|
||||
{
|
||||
na->rl = NULL;
|
||||
na->ni = ni;
|
||||
na->type = type;
|
||||
/* JPA should warn against feeing the name */
|
||||
/* before closing the struct */
|
||||
na->name = name;
|
||||
if (name)
|
||||
na->name_len = name_len;
|
||||
|
@ -347,7 +345,7 @@ void ntfs_attr_init(ntfs_attr *na, const BOOL non_resident,
|
|||
* both those cases @name_len is not used at all.
|
||||
*/
|
||||
ntfs_attr *ntfs_attr_open(ntfs_inode *ni, const ATTR_TYPES type,
|
||||
const ntfschar *name, u32 name_len)
|
||||
ntfschar *name, u32 name_len)
|
||||
{
|
||||
ntfs_attr_search_ctx *ctx;
|
||||
ntfs_attr *na;
|
||||
|
@ -447,8 +445,8 @@ void ntfs_attr_close(ntfs_attr *na)
|
|||
free(na->rl);
|
||||
/* Don't release if using an internal constant. */
|
||||
if (na->name != AT_UNNAMED && na->name != NTFS_INDEX_I30
|
||||
&& na->name != STREAM_SDS)
|
||||
ntfs_free(na->name);
|
||||
&& na->name != STREAM_SDS)
|
||||
free(na->name);
|
||||
free(na);
|
||||
}
|
||||
|
||||
|
@ -1297,9 +1295,9 @@ retry:
|
|||
if (!NVolReadOnly(vol)) {
|
||||
|
||||
s64 wpos = (rl->lcn << vol->cluster_size_bits) + ofs;
|
||||
u32 bsize = vol->cluster_size;
|
||||
s64 wend = (rl->vcn << vol->cluster_size_bits) + ofs + to_write;
|
||||
s64 rounded = ((wend + bsize - 1) & ~(s64)(bsize - 1)) - wend;
|
||||
u32 bsize = vol->cluster_size;
|
||||
s64 rounded = ((wend + bsize - 1) & ~(s64)(bsize - 1)) - wend;
|
||||
|
||||
/*
|
||||
* Zero fill to cluster boundary if we're writing to an
|
||||
|
@ -2614,8 +2612,8 @@ int ntfs_make_room_for_attr(MFT_RECORD *m, u8 *pos, u32 size)
|
|||
* EIO - I/O error occurred or damaged filesystem.
|
||||
*/
|
||||
int ntfs_resident_attr_record_add(ntfs_inode *ni, ATTR_TYPES type,
|
||||
const ntfschar *name, u8 name_len, const u8 *val,
|
||||
u32 size, ATTR_FLAGS flags)
|
||||
ntfschar *name, u8 name_len, u8 *val, u32 size,
|
||||
ATTR_FLAGS flags)
|
||||
{
|
||||
ntfs_attr_search_ctx *ctx;
|
||||
u32 length;
|
||||
|
@ -2737,8 +2735,8 @@ put_err_out:
|
|||
* EIO - I/O error occurred or damaged filesystem.
|
||||
*/
|
||||
int ntfs_non_resident_attr_record_add(ntfs_inode *ni, ATTR_TYPES type,
|
||||
const ntfschar *name, u8 name_len, VCN lowest_vcn,
|
||||
int dataruns_size, ATTR_FLAGS flags)
|
||||
ntfschar *name, u8 name_len, VCN lowest_vcn, int dataruns_size,
|
||||
ATTR_FLAGS flags)
|
||||
{
|
||||
ntfs_attr_search_ctx *ctx;
|
||||
u32 length;
|
||||
|
@ -3020,7 +3018,7 @@ int ntfs_attr_record_rm(ntfs_attr_search_ctx *ctx)
|
|||
* On success return 0. On error return -1 with errno set to the error code.
|
||||
*/
|
||||
int ntfs_attr_add(ntfs_inode *ni, ATTR_TYPES type,
|
||||
const ntfschar *name, u8 name_len, const u8 *val, s64 size)
|
||||
ntfschar *name, u8 name_len, u8 *val, s64 size)
|
||||
{
|
||||
u32 attr_rec_size;
|
||||
int err, i, offset;
|
||||
|
@ -4745,8 +4743,8 @@ static int ntfs_non_resident_attr_expand(ntfs_attr *na, const s64 newsize)
|
|||
ntfs_log_perror("Cluster allocation failed "
|
||||
"(%lld)",
|
||||
(long long)first_free_vcn -
|
||||
((long long)na->allocated_size >>
|
||||
vol->cluster_size_bits));
|
||||
((long long)na->allocated_size
|
||||
>> vol->cluster_size_bits));
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
@ -4936,7 +4934,7 @@ int ntfs_attr_truncate(ntfs_attr *na, const s64 newsize)
|
|||
* On error NULL is returned with errno set to the error code.
|
||||
*/
|
||||
void *ntfs_attr_readall(ntfs_inode *ni, const ATTR_TYPES type,
|
||||
const ntfschar *name, u32 name_len, s64 *data_size)
|
||||
ntfschar *name, u32 name_len, s64 *data_size)
|
||||
{
|
||||
ntfs_attr *na;
|
||||
void *data, *ret = NULL;
|
||||
|
@ -4969,8 +4967,8 @@ out:
|
|||
|
||||
|
||||
|
||||
int ntfs_attr_exist(ntfs_inode *ni, const ATTR_TYPES type,
|
||||
const ntfschar *name, u32 name_len)
|
||||
int ntfs_attr_exist(ntfs_inode *ni, const ATTR_TYPES type, ntfschar *name,
|
||||
u32 name_len)
|
||||
{
|
||||
ntfs_attr_search_ctx *ctx;
|
||||
int ret;
|
||||
|
@ -4989,8 +4987,8 @@ int ntfs_attr_exist(ntfs_inode *ni, const ATTR_TYPES type,
|
|||
return !ret;
|
||||
}
|
||||
|
||||
int ntfs_attr_remove(ntfs_inode *ni, const ATTR_TYPES type,
|
||||
const ntfschar *name, u32 name_len)
|
||||
int ntfs_attr_remove(ntfs_inode *ni, const ATTR_TYPES type, ntfschar *name,
|
||||
u32 name_len)
|
||||
{
|
||||
ntfs_attr *na;
|
||||
int ret;
|
||||
|
|
|
@ -115,7 +115,7 @@ static int ntfs_icx_ib_write(ntfs_index_context *icx)
|
|||
* Return NULL if allocation failed.
|
||||
*/
|
||||
ntfs_index_context *ntfs_index_ctx_get(ntfs_inode *ni,
|
||||
const ntfschar *name, u32 name_len)
|
||||
ntfschar *name, u32 name_len)
|
||||
{
|
||||
ntfs_index_context *icx;
|
||||
|
||||
|
@ -426,7 +426,7 @@ static int ntfs_ia_check(ntfs_index_context *icx, INDEX_BLOCK *ib, VCN vcn)
|
|||
}
|
||||
|
||||
/* static JPA removed for use in security.c */
|
||||
INDEX_ROOT *ntfs_ir_lookup(ntfs_inode *ni, const ntfschar *name,
|
||||
INDEX_ROOT *ntfs_ir_lookup(ntfs_inode *ni, ntfschar *name,
|
||||
u32 name_len, ntfs_attr_search_ctx **ctx)
|
||||
{
|
||||
ATTR_RECORD *a;
|
||||
|
@ -458,8 +458,7 @@ err_out:
|
|||
return ir;
|
||||
}
|
||||
|
||||
static INDEX_ROOT *ntfs_ir_lookup2(ntfs_inode *ni, const ntfschar *name,
|
||||
u32 len)
|
||||
static INDEX_ROOT *ntfs_ir_lookup2(ntfs_inode *ni, ntfschar *name, u32 len)
|
||||
{
|
||||
ntfs_attr_search_ctx *ctx;
|
||||
INDEX_ROOT *ir;
|
||||
|
|
|
@ -34,7 +34,3 @@ void *ntfs_malloc(size_t size)
|
|||
return p;
|
||||
}
|
||||
|
||||
void ntfs_free(const void *ptr) {
|
||||
free((void*)ptr);
|
||||
}
|
||||
|
||||
|
|
|
@ -181,8 +181,8 @@ struct MAPLIST {
|
|||
* A few useful constants
|
||||
*/
|
||||
|
||||
static const ntfschar sii_stream[] = { '$', 'S', 'I', 'I', 0 };
|
||||
static const ntfschar sdh_stream[] = { '$', 'S', 'D', 'H', 0 };
|
||||
static ntfschar sii_stream[] = { '$', 'S', 'I', 'I', 0 };
|
||||
static ntfschar sdh_stream[] = { '$', 'S', 'D', 'H', 0 };
|
||||
static const char mapping_name[] = MAPPINGFILE;
|
||||
|
||||
/*
|
||||
|
@ -285,7 +285,7 @@ char *ntfs_guid_to_mbs(const GUID *guid, char *guid_str)
|
|||
if (res == 36)
|
||||
return _guid_str;
|
||||
if (!guid_str)
|
||||
ntfs_free(_guid_str);
|
||||
free(_guid_str);
|
||||
errno = EINVAL;
|
||||
return NULL;
|
||||
}
|
||||
|
@ -430,7 +430,7 @@ err_out:
|
|||
else
|
||||
i = errno;
|
||||
if (!sid_str_size)
|
||||
ntfs_free(sid_str);
|
||||
free(sid_str);
|
||||
errno = i;
|
||||
return NULL;
|
||||
}
|
||||
|
@ -704,7 +704,7 @@ static SID *encodesid(const char *sidstr)
|
|||
*/
|
||||
|
||||
static int ntfs_local_read(ntfs_inode *ni,
|
||||
const ntfschar *stream_name, int stream_name_len,
|
||||
ntfschar *stream_name, int stream_name_len,
|
||||
char *buf, size_t size, off_t offset)
|
||||
{
|
||||
ntfs_attr *na = NULL;
|
||||
|
@ -746,7 +746,7 @@ exit:
|
|||
*/
|
||||
|
||||
static int ntfs_local_write(ntfs_inode *ni,
|
||||
const ntfschar *stream_name, int stream_name_len,
|
||||
ntfschar *stream_name, int stream_name_len,
|
||||
char *buf, size_t size, off_t offset)
|
||||
{
|
||||
ntfs_attr *na = NULL;
|
||||
|
@ -929,8 +929,8 @@ static struct SECURITY_CACHE *create_caches(struct SECURITY_CONTEXT *scx,
|
|||
|
||||
static void free_caches(struct SECURITY_CONTEXT *scx)
|
||||
{
|
||||
ntfs_free((*scx->pseccache)->head.first_securid);
|
||||
ntfs_free(*scx->pseccache);
|
||||
free((*scx->pseccache)->head.first_securid);
|
||||
free(*scx->pseccache);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1078,7 +1078,7 @@ static struct CACHED_PERMISSIONS *resize_cache(
|
|||
memcpy(newcache,oldcache,
|
||||
sizeof(struct SECURITY_CACHE)
|
||||
+ (oldcnt - 1)*sizeof(struct CACHED_PERMISSIONS));
|
||||
ntfs_free(oldcache);
|
||||
free(oldcache);
|
||||
#endif
|
||||
if (newcache) {
|
||||
/* mark new entries as not valid */
|
||||
|
@ -1108,7 +1108,7 @@ static struct CACHED_PERMISSIONS *resize_cache(
|
|||
oldcache->cachetable,
|
||||
oldcnt*sizeof(struct CACHED_PERMISSIONS));
|
||||
*scx->pseccache = newcache;
|
||||
ntfs_free(oldcache);
|
||||
free(oldcache);
|
||||
cacheentry = &newcache->cachetable[0];
|
||||
}
|
||||
}
|
||||
|
@ -1260,7 +1260,7 @@ static char *retrievesecurityattr(struct SECURITY_CONTEXT *scx, SII_INDEX_KEY id
|
|||
|| !valid_securattr(securattr,
|
||||
rdsize)) {
|
||||
/* error logged by caller */
|
||||
ntfs_free(securattr);
|
||||
free(securattr);
|
||||
securattr = (char*)NULL;
|
||||
}
|
||||
}
|
||||
|
@ -1644,7 +1644,7 @@ static char *build_secur_descr(mode_t mode,
|
|||
cpu_to_le32(sizeof(SECURITY_DESCRIPTOR_RELATIVE));
|
||||
} else {
|
||||
/* hope error was detected before overflowing */
|
||||
ntfs_free(newattr);
|
||||
free(newattr);
|
||||
newattr = (char*)NULL;
|
||||
ntfs_log_error("Security descriptor is longer than expected\n");
|
||||
errno = EIO;
|
||||
|
@ -1694,7 +1694,7 @@ static char *getsecurityattr(struct SECURITY_CONTEXT *scx,
|
|||
if (securattr && !valid_securattr(securattr, readallsz)) {
|
||||
ntfs_log_error("Bad security descriptor for %s\n",
|
||||
path);
|
||||
ntfs_free(securattr);
|
||||
free(securattr);
|
||||
securattr = (char*)NULL;
|
||||
}
|
||||
}
|
||||
|
@ -2055,7 +2055,7 @@ static int ntfs_get_perm(struct SECURITY_CONTEXT *scx,
|
|||
{
|
||||
const SECURITY_DESCRIPTOR_RELATIVE *phead;
|
||||
const struct CACHED_PERMISSIONS *cached;
|
||||
const char *securattr;
|
||||
char *securattr;
|
||||
const SID *usid; /* owner of file/directory */
|
||||
const SID *gsid; /* group of file/directory */
|
||||
uid_t uid;
|
||||
|
@ -2090,7 +2090,7 @@ static int ntfs_get_perm(struct SECURITY_CONTEXT *scx,
|
|||
enter_cache(scx, ni, uid,
|
||||
gid, perm);
|
||||
}
|
||||
ntfs_free(securattr);
|
||||
free(securattr);
|
||||
} else
|
||||
perm = -1;
|
||||
uid = gid = 0;
|
||||
|
@ -2118,7 +2118,7 @@ int ntfs_get_owner_mode(struct SECURITY_CONTEXT *scx,
|
|||
struct stat *stbuf)
|
||||
{
|
||||
const SECURITY_DESCRIPTOR_RELATIVE *phead;
|
||||
const char *securattr;
|
||||
char *securattr;
|
||||
const SID *usid; /* owner of file/directory */
|
||||
const SID *gsid; /* group of file/directory */
|
||||
const struct CACHED_PERMISSIONS *cached;
|
||||
|
@ -2154,7 +2154,7 @@ int ntfs_get_owner_mode(struct SECURITY_CONTEXT *scx,
|
|||
enter_cache(scx, ni, stbuf->st_uid,
|
||||
stbuf->st_gid, perm);
|
||||
}
|
||||
ntfs_free(securattr);
|
||||
free(securattr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2251,7 +2251,7 @@ INDEX_ENTRY *ntfs_index_next(INDEX_ENTRY *ie, ntfs_index_context *xc,
|
|||
do {
|
||||
xc->pindex--;
|
||||
if (!xc->pindex) {
|
||||
ntfs_free(xc->ib);
|
||||
free(xc->ib);
|
||||
xc->ib = (INDEX_BLOCK*)NULL;
|
||||
xc->ir = ntfs_ir_lookup(xc->ni,
|
||||
xc->name, xc->name_len,
|
||||
|
@ -2320,7 +2320,7 @@ static int entersecurity_data(ntfs_volume *vol,
|
|||
res = 0;
|
||||
else
|
||||
errno = ENOMEM;
|
||||
ntfs_free(fullattr);
|
||||
free(fullattr);
|
||||
}
|
||||
return (res);
|
||||
}
|
||||
|
@ -2574,7 +2574,7 @@ static le32 setsecurityattr(ntfs_volume *vol,
|
|||
oldattr, size, offs);
|
||||
found = (rdsize == size)
|
||||
&& !memcmp(oldattr,attr,size);
|
||||
ntfs_free(oldattr);
|
||||
free(oldattr);
|
||||
/* if the records do not compare */
|
||||
/* (hash collision), try next one */
|
||||
if (!found) {
|
||||
|
@ -2611,7 +2611,7 @@ static le32 setsecurityattr(ntfs_volume *vol,
|
|||
*/
|
||||
|
||||
static int update_secur_descr(ntfs_volume *vol,
|
||||
const char *newattr, ntfs_inode *ni)
|
||||
char *newattr, ntfs_inode *ni)
|
||||
{
|
||||
int newattrsz;
|
||||
int written;
|
||||
|
@ -2667,7 +2667,7 @@ static int update_secur_descr(ntfs_volume *vol,
|
|||
* were none
|
||||
*/
|
||||
res = ntfs_attr_add(ni, AT_SECURITY_DESCRIPTOR,
|
||||
AT_UNNAMED, 0, (const u8*)newattr,
|
||||
AT_UNNAMED, 0, (u8*)newattr,
|
||||
(s64) newattrsz);
|
||||
}
|
||||
#if !FORCE_FORMAT_v1x
|
||||
|
@ -2728,7 +2728,7 @@ int ntfs_set_owner_mode(struct SECURITY_CONTEXT *scx, ntfs_inode *ni,
|
|||
{
|
||||
int res;
|
||||
const struct CACHED_SECURID *cached;
|
||||
const char *newattr;
|
||||
char *newattr;
|
||||
const SID *usid;
|
||||
const SID *gsid;
|
||||
BOOL isdir;
|
||||
|
@ -2771,7 +2771,7 @@ int ntfs_set_owner_mode(struct SECURITY_CONTEXT *scx, ntfs_inode *ni,
|
|||
gid, mode,
|
||||
ni->security_id);
|
||||
}
|
||||
ntfs_free(newattr);
|
||||
free(newattr);
|
||||
} else {
|
||||
/* could not build new security attribute */
|
||||
errno = EIO;
|
||||
|
@ -2802,7 +2802,7 @@ int ntfs_set_mode(struct SECURITY_CONTEXT *scx,
|
|||
{
|
||||
const SECURITY_DESCRIPTOR_RELATIVE *phead;
|
||||
const struct CACHED_PERMISSIONS *cached;
|
||||
const char *oldattr;
|
||||
char *oldattr;
|
||||
const SID *usid;
|
||||
const SID *gsid;
|
||||
uid_t uid;
|
||||
|
@ -2825,7 +2825,7 @@ int ntfs_set_mode(struct SECURITY_CONTEXT *scx,
|
|||
gsid = (const SID*)&oldattr[le32_to_cpu(phead->group)];
|
||||
fileuid = findowner(scx,usid);
|
||||
filegid = findowner(scx,gsid);
|
||||
ntfs_free(oldattr);
|
||||
free(oldattr);
|
||||
} else
|
||||
res = -1;
|
||||
}
|
||||
|
@ -2912,7 +2912,7 @@ int ntfs_sd_add_everyone(ntfs_inode *ni)
|
|||
if (ret)
|
||||
ntfs_log_perror("Failed to add initial SECURITY_DESCRIPTOR\n");
|
||||
|
||||
ntfs_free(sd);
|
||||
free(sd);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -2999,7 +2999,7 @@ BOOL ntfs_allowed_dir_access(struct SECURITY_CONTEXT *scx,
|
|||
dir_ni, accesstype);
|
||||
ntfs_inode_close(dir_ni);
|
||||
}
|
||||
ntfs_free(dirpath);
|
||||
free(dirpath);
|
||||
}
|
||||
return (allow); /* errno is set if not allowed */
|
||||
}
|
||||
|
@ -3015,7 +3015,7 @@ int ntfs_set_owner(struct SECURITY_CONTEXT *scx,
|
|||
{
|
||||
const SECURITY_DESCRIPTOR_RELATIVE *phead;
|
||||
const struct CACHED_PERMISSIONS *cached;
|
||||
const char *oldattr;
|
||||
char *oldattr;
|
||||
const SID *usid;
|
||||
const SID *gsid;
|
||||
uid_t fileuid;
|
||||
|
@ -3050,7 +3050,7 @@ int ntfs_set_owner(struct SECURITY_CONTEXT *scx,
|
|||
filegid = findowner(scx,gsid);
|
||||
} else
|
||||
res = -1;
|
||||
ntfs_free(oldattr);
|
||||
free(oldattr);
|
||||
} else
|
||||
res = -1;
|
||||
}
|
||||
|
@ -3143,11 +3143,11 @@ static struct MAPLIST *getmappingitem(
|
|||
} else
|
||||
p = (char*)NULL; /* bad line, stop */
|
||||
if (!p) {
|
||||
ntfs_free(item);
|
||||
free(item);
|
||||
item = (struct MAPLIST*)NULL;
|
||||
}
|
||||
} else {
|
||||
ntfs_free(item); /* free unused item */
|
||||
free(item); /* free unused item */
|
||||
item = (struct MAPLIST*)NULL;
|
||||
}
|
||||
}
|
||||
|
@ -3221,18 +3221,18 @@ static void free_mapping(struct SECURITY_CONTEXT *scx)
|
|||
while (group && (group->sid != user->sid))
|
||||
group = group->next;
|
||||
if (!group)
|
||||
ntfs_free(user->sid);
|
||||
free(user->sid);
|
||||
/* unchain item and free */
|
||||
scx->usermapping = user->next;
|
||||
ntfs_free(user);
|
||||
free(user);
|
||||
}
|
||||
/* free group mappings */
|
||||
while (scx->groupmapping) {
|
||||
group = scx->groupmapping;
|
||||
ntfs_free(group->sid);
|
||||
free(group->sid);
|
||||
/* unchain item and free */
|
||||
scx->groupmapping = group->next;
|
||||
ntfs_free(group);
|
||||
free(group);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3372,6 +3372,8 @@ static int ntfs_do_default_mapping(struct SECURITY_CONTEXT *scx,
|
|||
* we had rather be safe until the consequences are understood
|
||||
*/
|
||||
|
||||
#if 0 /* not activated for now */
|
||||
|
||||
static BOOL check_mapping(const struct MAPPING *usermapping,
|
||||
const struct MAPPING *groupmapping)
|
||||
{
|
||||
|
@ -3401,6 +3403,8 @@ static BOOL check_mapping(const struct MAPPING *usermapping,
|
|||
return (ambiguous);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Try and apply default single user mapping
|
||||
* returns zero if successful
|
||||
|
@ -3423,7 +3427,7 @@ static int ntfs_default_mapping(struct SECURITY_CONTEXT *scx)
|
|||
usid = (SID*)&securattr[le32_to_cpu(phead->owner)];
|
||||
if (is_user_sid(usid))
|
||||
res = ntfs_do_default_mapping(scx,usid);
|
||||
ntfs_free(securattr);
|
||||
free(securattr);
|
||||
}
|
||||
ntfs_inode_close(ni);
|
||||
}
|
||||
|
@ -3466,7 +3470,7 @@ int ntfs_build_mapping(struct SECURITY_CONTEXT *scx)
|
|||
/* and rely on internal representation */
|
||||
while (firstitem) {
|
||||
item = firstitem->next;
|
||||
ntfs_free(firstitem);
|
||||
free(firstitem);
|
||||
firstitem = item;
|
||||
}
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue