+2003-01-09 Corinna Vinschen <corinna@vinschen.de>
+
+ * security.cc (get_nt_attribute): Always return -1 when read_sd()
+ fails.
+ (get_file_attribute): Set permissions to 0 and owner/group to -1
+ if security descriptor is unreadable.
+
2003-01-09 Christopher Faylor <cgf@redhat.com>
Use isdirsep rather than SLASH_P throughout.
if ((ret = read_sd (file, psd, &sd_size)) <= 0)
{
debug_printf ("read_sd %E");
- return ret;
+ return -1;
}
PSID owner_sid;
if (use_ntsec && allow_ntsec)
{
res = get_nt_attribute (file, attribute, uidret, gidret);
- if (attribute && (*attribute & S_IFLNK) == S_IFLNK)
+ if (res)
+ {
+ /* If reading the security descriptor failed, treat the file
+ as unreadable. */
+ *attribute &= ~(S_IRWXU | S_IRWXG | S_IRWXO);
+ if (uidret)
+ *uidret = ILLEGAL_UID;
+ if (gidret)
+ *gidret = ILLEGAL_GID;
+ }
+ else if (attribute && (*attribute & S_IFLNK) == S_IFLNK)
*attribute |= S_IRWXU | S_IRWXG | S_IRWXO;
- return res;
+ return 0;
}
if (uidret)