else if (pc.issymlink ())
{
buf->st_size = pc.get_symlink_length ();
+ get_file_attribute (h, pc, buf->st_mode,
+ &buf->st_uid, &buf->st_gid);
/* symlinks are everything for everyone! */
buf->st_mode = S_IFLNK | S_IRWXU | S_IRWXG | S_IRWXO;
- get_file_attribute (h, pc, NULL,
- &buf->st_uid, &buf->st_gid);
goto done;
}
else if (pc.issocket ())
buf->st_mode = S_IFSOCK;
- if (!get_file_attribute (h, pc, &buf->st_mode, &buf->st_uid, &buf->st_gid))
+ if (!get_file_attribute (h, pc, buf->st_mode, &buf->st_uid, &buf->st_gid))
{
/* If read-only attribute is set, modify ntsec return value */
if (::has_attribute (attributes, FILE_ATTRIBUTE_READONLY)
if (!get_file_sd (get_handle (), pc, sd, false))
{
aclp = (aclent_t *) tp.c_get ();
- if ((nentries = get_posix_access (sd, &attr, &uid, &gid,
+ if ((nentries = get_posix_access (sd, attr, &uid, &gid,
aclp, MAX_ACL_ENTRIES,
&standard_acl)) >= 0)
{
goto out;
aclp = (aclent_t *) tp.c_get ();
- if ((nentries = get_posix_access (sd, &attr, &old_uid, &old_gid,
+ if ((nentries = get_posix_access (sd, attr, &old_uid, &old_gid,
aclp, MAX_ACL_ENTRIES)) < 0)
goto out;
__seterrno_from_nt_status (status);
return NULL;
}
- if (get_file_attribute (get_handle (), pc, &mode, NULL, NULL))
+ if (get_file_attribute (get_handle (), pc, mode, NULL, NULL))
mode = STD_RBITS | STD_WBITS;
return _mqinfo (fsi.EndOfFile.QuadPart, mode, flags, true);
{
/* If requested, check permissions. */
if (buf)
- get_object_attribute (h, &buf->st_uid, &buf->st_gid, &buf->st_mode);
+ get_object_attribute (h, &buf->st_uid, &buf->st_gid, buf->st_mode);
NtClose (h);
return virt_symlink;
}
{
/* If requested, check permissions. */
if (buf)
- get_object_attribute (h, &buf->st_uid, &buf->st_gid, &buf->st_mode);
+ get_object_attribute (h, &buf->st_uid, &buf->st_gid, buf->st_mode);
NtClose (h);
return virt_directory;
}
/* If requested, check permissions. If this is a parent handle from
the above desperate parent check, skip. */
if (buf && !desperate_parent_check)
- get_object_attribute (h, &buf->st_uid, &buf->st_gid, &buf->st_mode);
+ get_object_attribute (h, &buf->st_uid, &buf->st_gid, buf->st_mode);
/* Check for the device type. */
status = NtQueryVolumeInformationFile (h, &io, &ffdi, sizeof ffdi,
st->st_mode = S_IFCHR;
if (!input_available_event
|| get_object_attribute (input_available_event, &st->st_uid, &st->st_gid,
- &st->st_mode))
+ st->st_mode))
{
/* If we can't access the ACL, or if the tty doesn't actually exist,
then fake uid and gid to strict, system-like values. */
if (!input_available_event
|| get_object_sd (input_available_event, sd))
{
- res = get_posix_access (NULL, &attr, NULL, NULL, aclbufp, nentries);
+ res = get_posix_access (NULL, attr, NULL, NULL, aclbufp, nentries);
if (aclbufp && res == MIN_ACL_ENTRIES)
{
aclbufp[0].a_perm = S_IROTH | S_IWOTH;
break;
}
if (cmd == GETACL)
- res = get_posix_access (sd, &attr, NULL, NULL, aclbufp, nentries);
+ res = get_posix_access (sd, attr, NULL, NULL, aclbufp, nentries);
else
- res = get_posix_access (sd, &attr, NULL, NULL, NULL, 0);
+ res = get_posix_access (sd, attr, NULL, NULL, NULL, 0);
break;
default:
set_errno (EINVAL);
}
sd.malloc (sizeof (SECURITY_DESCRIPTOR));
RtlCreateSecurityDescriptor (sd, SECURITY_DESCRIPTOR_REVISION);
- if (!get_object_attribute (input_available_event, &uid, &gid, &orig_mode)
+ if (!get_object_attribute (input_available_event, &uid, &gid, orig_mode)
&& !create_object_sd_from_attribute (uid, gid, S_IFCHR | mode, sd))
ret = fch_set_sd (sd, false);
errout:
}
sd.malloc (sizeof (SECURITY_DESCRIPTOR));
RtlCreateSecurityDescriptor (sd, SECURITY_DESCRIPTOR_REVISION);
- if (!get_object_attribute (input_available_event, &o_uid, &o_gid, &mode))
+ if (!get_object_attribute (input_available_event, &o_uid, &o_gid, mode))
{
if (uid == ILLEGAL_UID)
uid = o_uid;
}
uid_t uid;
gid_t gid;
- if (get_reg_attribute (hKey, &buf->st_mode, &uid, &gid) == 0)
+ if (get_reg_attribute (hKey, buf->st_mode, &uid, &gid) == 0)
{
buf->st_uid = uid;
buf->st_gid = gid;
class path_conv;
/* File manipulation */
-int get_file_attribute (HANDLE, path_conv &, mode_t *,
+int get_file_attribute (HANDLE, path_conv &, mode_t &,
uid_t *, gid_t *);
int set_created_file_access (HANDLE, path_conv &, mode_t);
int get_object_sd (HANDLE, security_descriptor &);
-int get_object_attribute (HANDLE, uid_t *, gid_t *, mode_t *);
+int get_object_attribute (HANDLE, uid_t *, gid_t *, mode_t &);
int set_object_attribute (HANDLE, uid_t, gid_t, mode_t);
int create_object_sd_from_attribute (uid_t, gid_t, mode_t,
security_descriptor &);
int set_object_sd (HANDLE, security_descriptor &, bool);
-int get_reg_attribute (HKEY hkey, mode_t *, uid_t *, gid_t *);
+int get_reg_attribute (HKEY hkey, mode_t &, uid_t *, gid_t *);
LONG get_file_sd (HANDLE fh, path_conv &, security_descriptor &, bool);
LONG set_file_sd (HANDLE fh, path_conv &, security_descriptor &, bool);
bool add_access_allowed_ace (PACL, DWORD, PSID, size_t &, DWORD);
int searchace (struct acl *, int, int, uid_t id = ILLEGAL_UID);
PSECURITY_DESCRIPTOR set_posix_access (mode_t, uid_t, gid_t, struct acl *, int,
security_descriptor &, bool);
-int get_posix_access (PSECURITY_DESCRIPTOR, mode_t *, uid_t *, gid_t *,
+int get_posix_access (PSECURITY_DESCRIPTOR, mode_t &, uid_t *, gid_t *,
struct acl *, int, bool * = NULL);
int getacl (HANDLE, path_conv &, int, struct acl *);
int setacl (HANDLE, path_conv &, int, struct acl *, bool &);
if (get_file_sd (handle, pc, sd, false))
return -1;
- if (get_posix_access (sd, &attr, &uid, &gid, NULL, 0) < 0)
+ if (get_posix_access (sd, attr, &uid, &gid, NULL, 0) < 0)
return -1;
if (!set_posix_access (attr, uid, gid, aclbufp, nentries,
sd_ret, pc.fs_is_samba ()))
stock POSIX perms even if Administrators and SYSTEM is in the ACE. */
int
get_posix_access (PSECURITY_DESCRIPTOR psd,
- mode_t *attr_ret, uid_t *uid_ret, gid_t *gid_ret,
+ mode_t &attr_ret, uid_t *uid_ret, gid_t *gid_ret,
aclent_t *aclbufp, int nentries, bool *std_acl)
{
tmp_pathbuf tp;
unreadable. */
if (!psd)
{
- if (attr_ret)
- *attr_ret &= S_IFMT;
+ attr_ret &= S_IFMT;
if (uid_ret)
*uid_ret = ACL_UNDEFINED_ID;
if (gid_ret)
/* Set uidret, gidret, and initalize attributes. */
uid = owner_sid.get_uid (&cldap);
gid = group_sid.get_gid (&cldap);
- if (attr_ret)
- {
- attr = *attr_ret & S_IFMT;
- just_created = *attr_ret & S_JUSTCREATED;
- }
+ attr = attr_ret & S_IFMT;
+ just_created = attr_ret & S_JUSTCREATED;
/* Remember the fact that owner and group are the same account. */
owner_eq_group = owner_sid == group_sid;
*uid_ret = uid;
if (gid_ret)
*gid_ret = gid;
- if (attr_ret)
- *attr_ret = attr;
+ attr_ret = attr;
if (aclbufp)
{
if (pos > nentries)
if (get_file_sd (handle, pc, sd, false))
return -1;
- int pos = get_posix_access (sd, &attr, NULL, NULL, aclbufp, nentries);
+ int pos = get_posix_access (sd, attr, NULL, NULL, aclbufp, nentries);
syscall_printf ("%R = getacl(%S)", pos, pc.get_nt_native_path ());
return pos;
}
}
int
-get_reg_attribute (HKEY hkey, mode_t *attribute, uid_t *uidret,
+get_reg_attribute (HKEY hkey, mode_t &attribute, uid_t *uidret,
gid_t *gidret)
{
security_descriptor sd;
int
get_file_attribute (HANDLE handle, path_conv &pc,
- mode_t *attribute, uid_t *uidret, gid_t *gidret)
+ mode_t &attribute, uid_t *uidret, gid_t *gidret)
{
if (pc.has_acls ())
{
int
get_object_attribute (HANDLE handle, uid_t *uidret, gid_t *gidret,
- mode_t *attribute)
+ mode_t &attribute)
{
security_descriptor sd;
attr |= S_IFDIR;
attr_rd = attr;
aclp = (aclent_t *) tp.c_get ();
- if ((nentries = get_posix_access (sd, &attr_rd, &uid, &gid, aclp,
+ if ((nentries = get_posix_access (sd, attr_rd, &uid, &gid, aclp,
MAX_ACL_ENTRIES, &std_acl)) >= 0)
{
if (S_ISLNK (attr))