* Apply Wine commit
e57edfea by Paul Vriens: Skip leading spaces when parsing.
* Update the related functions with Wine 1.7.27.
CORE-8540
svn path=/trunk/; revision=65007
LPCWSTR szAcl = *StringAcl;
const ACEFLAG *lpaf = AceType;
LPCWSTR szAcl = *StringAcl;
const ACEFLAG *lpaf = AceType;
+ while (*szAcl == ' ')
+ szAcl++;
+
while (lpaf->wstr &&
(len = strlenW(lpaf->wstr)) &&
strncmpW(lpaf->wstr, szAcl, len))
while (lpaf->wstr &&
(len = strlenW(lpaf->wstr)) &&
strncmpW(lpaf->wstr, szAcl, len))
if (!lpaf->wstr)
return 0;
if (!lpaf->wstr)
return 0;
+ *StringAcl = szAcl + len;
BYTE flags = 0;
LPCWSTR szAcl = *StringAcl;
BYTE flags = 0;
LPCWSTR szAcl = *StringAcl;
+ while (*szAcl == ' ')
+ szAcl++;
+
while (*szAcl != ';')
{
const ACEFLAG *lpaf = AceFlags;
while (*szAcl != ';')
{
const ACEFLAG *lpaf = AceFlags;
if (!lpaf->wstr)
return 0;
if (!lpaf->wstr)
return 0;
DWORD rights = 0;
LPCWSTR szAcl = *StringAcl;
DWORD rights = 0;
LPCWSTR szAcl = *StringAcl;
+ while (*szAcl == ' ')
+ szAcl++;
+
if ((*szAcl == '0') && (*(szAcl + 1) == 'x'))
{
LPCWSTR p = szAcl;
if ((*szAcl == '0') && (*(szAcl + 1) == 'x'))
{
LPCWSTR p = szAcl;
- while (*p && *p != ';')
+ while (*p && *p != ';')
- if (p - szAcl <= 10 /* 8 hex digits + "0x" */ )
- {
- rights = strtoulW(szAcl, NULL, 16);
- szAcl = p;
- }
- else
+ if (p - szAcl <= 10 /* 8 hex digits + "0x" */ )
+ {
+ rights = strtoulW(szAcl, NULL, 16);
+ szAcl = p;
+ }
+ else
WARN("Invalid rights string format: %s\n", debugstr_wn(szAcl, p - szAcl));
}
else
WARN("Invalid rights string format: %s\n", debugstr_wn(szAcl, p - szAcl));
}
else
const ACEFLAG *lpaf = AceRights;
while (lpaf->wstr &&
const ACEFLAG *lpaf = AceRights;
while (lpaf->wstr &&
- (len = strlenW(lpaf->wstr)) &&
- strncmpW(lpaf->wstr, szAcl, len))
- {
- lpaf++;
- }
+ (len = strlenW(lpaf->wstr)) &&
+ strncmpW(lpaf->wstr, szAcl, len))
+ {
+ lpaf++;
+ }
if (!lpaf->wstr)
return 0;
if (!lpaf->wstr)
return 0;
*
* dacl_flags(string_ace1)(string_ace2)... (string_acen)
*/
*
* dacl_flags(string_ace1)(string_ace2)... (string_acen)
*/
-static BOOL
-ParseStringAclToAcl(LPCWSTR StringAcl,
- LPDWORD lpdwFlags,
- PACL pAcl,
- LPDWORD cBytes)
+static BOOL ParseStringAclToAcl(LPCWSTR StringAcl, LPDWORD lpdwFlags,
+ PACL pAcl, LPDWORD cBytes)
{
DWORD val;
DWORD sidlen;
{
DWORD val;
DWORD sidlen;
DWORD acesize = 0;
DWORD acecount = 0;
PACCESS_ALLOWED_ACE pAce = NULL; /* pointer to current ACE */
DWORD acesize = 0;
DWORD acecount = 0;
PACCESS_ALLOWED_ACE pAce = NULL; /* pointer to current ACE */
+ DWORD error = ERROR_INVALID_ACL;
TRACE("%s\n", debugstr_w(StringAcl));
if (!StringAcl)
TRACE("%s\n", debugstr_w(StringAcl));
if (!StringAcl)
if (pAcl) /* pAce is only useful if we're setting values */
pAce = (PACCESS_ALLOWED_ACE) (pAcl + 1);
if (pAcl) /* pAce is only useful if we're setting values */
pAce = (PACCESS_ALLOWED_ACE) (pAcl + 1);
/* Parse ACE type */
val = ParseAceStringType(&StringAcl);
/* Parse ACE type */
val = ParseAceStringType(&StringAcl);
pAce->Header.AceType = (BYTE) val;
if (*StringAcl != ';')
pAce->Header.AceType = (BYTE) val;
if (*StringAcl != ';')
+ {
+ error = RPC_S_INVALID_STRING_UUID;
StringAcl++;
/* Parse ACE flags */
StringAcl++;
/* Parse ACE flags */
- val = ParseAceStringFlags(&StringAcl);
- if (pAce)
+ val = ParseAceStringFlags(&StringAcl);
+ if (pAce)
pAce->Header.AceFlags = (BYTE) val;
if (*StringAcl != ';')
goto lerr;
StringAcl++;
/* Parse ACE rights */
pAce->Header.AceFlags = (BYTE) val;
if (*StringAcl != ';')
goto lerr;
StringAcl++;
/* Parse ACE rights */
- val = ParseAceStringRights(&StringAcl);
- if (pAce)
+ val = ParseAceStringRights(&StringAcl);
+ if (pAce)
pAce->Mask = val;
if (*StringAcl != ';')
goto lerr;
StringAcl++;
/* Parse ACE object guid */
pAce->Mask = val;
if (*StringAcl != ';')
goto lerr;
StringAcl++;
/* Parse ACE object guid */
+ while (*StringAcl == ' ')
+ StringAcl++;
if (*StringAcl != ';')
{
FIXME("Support for *_OBJECT_ACE_TYPE not implemented\n");
if (*StringAcl != ';')
{
FIXME("Support for *_OBJECT_ACE_TYPE not implemented\n");
StringAcl++;
/* Parse ACE inherit object guid */
StringAcl++;
/* Parse ACE inherit object guid */
+ while (*StringAcl == ' ')
+ StringAcl++;
if (*StringAcl != ';')
{
FIXME("Support for *_OBJECT_ACE_TYPE not implemented\n");
if (*StringAcl != ';')
{
FIXME("Support for *_OBJECT_ACE_TYPE not implemented\n");
/* Parse ACE account sid */
if (ParseStringSidToSid(StringAcl, pAce ? &pAce->SidStart : NULL, &sidlen))
/* Parse ACE account sid */
if (ParseStringSidToSid(StringAcl, pAce ? &pAce->SidStart : NULL, &sidlen))
while (*StringAcl && *StringAcl != ')')
StringAcl++;
while (*StringAcl && *StringAcl != ')')
StringAcl++;
if (*StringAcl != ')')
goto lerr;
if (*StringAcl != ')')
goto lerr;
- SetLastError(ERROR_INVALID_ACL);
WARN("Invalid ACE string format\n");
return FALSE;
}
WARN("Invalid ACE string format\n");
return FALSE;
}
/******************************************************************************
* ParseStringSecurityDescriptorToSecurityDescriptor
*/
/******************************************************************************
* ParseStringSecurityDescriptorToSecurityDescriptor
*/
-static BOOL
-ParseStringSecurityDescriptorToSecurityDescriptor(LPCWSTR StringSecurityDescriptor,
- SECURITY_DESCRIPTOR_RELATIVE* SecurityDescriptor,
- LPDWORD cBytes)
+static BOOL ParseStringSecurityDescriptorToSecurityDescriptor(
+ LPCWSTR StringSecurityDescriptor,
+ SECURITY_DESCRIPTOR_RELATIVE* SecurityDescriptor,
+ LPDWORD cBytes)
{
BOOL bret = FALSE;
WCHAR toktype;
{
BOOL bret = FALSE;
WCHAR toktype;
if (SecurityDescriptor)
lpNext = (LPBYTE)(SecurityDescriptor + 1);
if (SecurityDescriptor)
lpNext = (LPBYTE)(SecurityDescriptor + 1);
+ while (*StringSecurityDescriptor == ' ')
+ StringSecurityDescriptor++;
+
while (*StringSecurityDescriptor)
{
toktype = *StringSecurityDescriptor;
while (*StringSecurityDescriptor)
{
toktype = *StringSecurityDescriptor;
- /* Expect char identifier followed by ':' */
- StringSecurityDescriptor++;
+ /* Expect char identifier followed by ':' */
+ StringSecurityDescriptor++;
if (*StringSecurityDescriptor != ':')
{
SetLastError(ERROR_INVALID_PARAMETER);
goto lend;
}
if (*StringSecurityDescriptor != ':')
{
SetLastError(ERROR_INVALID_PARAMETER);
goto lend;
}
- StringSecurityDescriptor++;
+ StringSecurityDescriptor++;
- /* Extract token */
- lptoken = StringSecurityDescriptor;
- while (*lptoken && *lptoken != ':')
+ /* Extract token */
+ lptoken = StringSecurityDescriptor;
+ while (*lptoken && *lptoken != ':')
lptoken--;
len = lptoken - StringSecurityDescriptor;
lptoken--;
len = lptoken - StringSecurityDescriptor;
tok[len] = 0;
switch (toktype)
tok[len] = 0;
switch (toktype)
lpNext += bytes; /* Advance to next token */
}
lpNext += bytes; /* Advance to next token */
}
lpNext += bytes; /* Advance to next token */
}
lpNext += bytes; /* Advance to next token */
}
DWORD flags;
DWORD bytes;
DWORD flags;
DWORD bytes;
SecurityDescriptor->Control |= SE_DACL_PRESENT | flags;
SecurityDescriptor->Dacl = lpNext - (LPBYTE)SecurityDescriptor;
lpNext += bytes; /* Advance to next token */
SecurityDescriptor->Control |= SE_DACL_PRESENT | flags;
SecurityDescriptor->Dacl = lpNext - (LPBYTE)SecurityDescriptor;
lpNext += bytes; /* Advance to next token */
SecurityDescriptor->Control |= SE_SACL_PRESENT | flags;
SecurityDescriptor->Sacl = lpNext - (LPBYTE)SecurityDescriptor;
lpNext += bytes; /* Advance to next token */
SecurityDescriptor->Control |= SE_SACL_PRESENT | flags;
SecurityDescriptor->Sacl = lpNext - (LPBYTE)SecurityDescriptor;
lpNext += bytes; /* Advance to next token */
}
default:
FIXME("Unknown token\n");
SetLastError(ERROR_INVALID_PARAMETER);
}
default:
FIXME("Unknown token\n");
SetLastError(ERROR_INVALID_PARAMETER);
StringSecurityDescriptor = lptoken;
}
StringSecurityDescriptor = lptoken;
}