Fixed apparent const violation in secaudit.c for Windows (cosmetic)

The prototype for SetFileSecurityW() does not exhibit a const attribute
for the second attribute, thus triggering a compiler warning.
This warning can be silenced by copying the argument.
edge.strict_endians
Jean-Pierre André 2014-06-23 10:53:23 +02:00
parent 952917bccf
commit 19d71c6c9e
1 changed files with 10 additions and 4 deletions

View File

@ -207,9 +207,11 @@
* Sep 2013, version 1.4.1 * Sep 2013, version 1.4.1
* - silenced an aliasing warning by gcc >= 4.8 * - silenced an aliasing warning by gcc >= 4.8
* *
* May 2014, version 1.4.2
* - decoded GENERIC_ALL permissions * - decoded GENERIC_ALL permissions
* - decoded more "well-known" and generic SIDs * - decoded more "well-known" and generic SIDs
* - showed Windows ownership in verbose situations * - showed Windows ownership in verbose situations
* - fixed apparent const violations
*/ */
/* /*
@ -233,7 +235,7 @@
* General parameters which may have to be adapted to needs * General parameters which may have to be adapted to needs
*/ */
#define AUDT_VERSION "1.4.1" #define AUDT_VERSION "1.4.2"
#define GET_FILE_SECURITY "ntfs_get_file_security" #define GET_FILE_SECURITY "ntfs_get_file_security"
#define SET_FILE_SECURITY "ntfs_set_file_security" #define SET_FILE_SECURITY "ntfs_set_file_security"
@ -2397,7 +2399,7 @@ int local_build_mapping(struct MAPPING *mapping[], const char *usermap_path)
#ifdef WIN32 #ifdef WIN32
/* TODO : check whether the device can store acls */ /* TODO : check whether the device can store acls */
strcpy(mapfile,"x:\\" MAPDIR "\\" MAPFILE); strcpy(mapfile,"x:\\" MAPDIR "\\" MAPFILE);
if (((le16*)usermap_path)[1] == ':') if (((const le16*)usermap_path)[1] == ':')
mapfile[0] = usermap_path[0]; mapfile[0] = usermap_path[0];
else { else {
GetModuleFileName(NULL, currpath, 261); GetModuleFileName(NULL, currpath, 261);
@ -2745,8 +2747,9 @@ BOOL applyattr(const char *fullname, const char *attr,
} }
} }
} }
/* const missing from stupid prototype */
bad = !SetFileSecurityW((LPCWSTR)fullname, bad = !SetFileSecurityW((LPCWSTR)fullname,
selection, (char*)curattr); selection, (PSECURITY_DESCRIPTOR)(LONG_PTR)curattr);
if (bad) if (bad)
switch (GetLastError()) { switch (GetLastError()) {
case 1307 : case 1307 :
@ -2755,9 +2758,12 @@ BOOL applyattr(const char *fullname, const char *attr,
printname(stdout,fullname); printname(stdout,fullname);
printf(", retrying with no owner or SACL setting\n"); printf(", retrying with no owner or SACL setting\n");
warnings++; warnings++;
/* const missing from stupid prototype */
bad = !SetFileSecurityW((LPCWSTR)fullname, bad = !SetFileSecurityW((LPCWSTR)fullname,
selection & ~OWNER_SECURITY_INFORMATION selection & ~OWNER_SECURITY_INFORMATION
& ~SACL_SECURITY_INFORMATION, (char*)curattr); & ~SACL_SECURITY_INFORMATION,
(PSECURITY_DESCRIPTOR)
(LONG_PTR)curattr);
break; break;
default : default :
break; break;