|
@@ -94,6 +94,7 @@ sid_to_key_str(struct cifs_sid *sidptr, unsigned int type)
|
|
|
int i, len;
|
|
|
unsigned int saval;
|
|
|
char *sidstr, *strptr;
|
|
|
+ unsigned long long id_auth_val;
|
|
|
|
|
|
/* 3 bytes for prefix */
|
|
|
sidstr = kmalloc(3 + SID_STRING_BASE_SIZE +
|
|
@@ -107,12 +108,24 @@ sid_to_key_str(struct cifs_sid *sidptr, unsigned int type)
|
|
|
sidptr->revision);
|
|
|
strptr += len;
|
|
|
|
|
|
- for (i = 0; i < NUM_AUTHS; ++i) {
|
|
|
- if (sidptr->authority[i]) {
|
|
|
- len = sprintf(strptr, "-%hhu", sidptr->authority[i]);
|
|
|
- strptr += len;
|
|
|
- }
|
|
|
- }
|
|
|
+ /* The authority field is a single 48-bit number */
|
|
|
+ id_auth_val = (unsigned long long)sidptr->authority[5];
|
|
|
+ id_auth_val |= (unsigned long long)sidptr->authority[4] << 8;
|
|
|
+ id_auth_val |= (unsigned long long)sidptr->authority[3] << 16;
|
|
|
+ id_auth_val |= (unsigned long long)sidptr->authority[2] << 24;
|
|
|
+ id_auth_val |= (unsigned long long)sidptr->authority[1] << 32;
|
|
|
+ id_auth_val |= (unsigned long long)sidptr->authority[0] << 48;
|
|
|
+
|
|
|
+ /*
|
|
|
+ * MS-DTYP states that if the authority is >= 2^32, then it should be
|
|
|
+ * expressed as a hex value.
|
|
|
+ */
|
|
|
+ if (id_auth_val <= UINT_MAX)
|
|
|
+ len = sprintf(strptr, "-%llu", id_auth_val);
|
|
|
+ else
|
|
|
+ len = sprintf(strptr, "-0x%llx", id_auth_val);
|
|
|
+
|
|
|
+ strptr += len;
|
|
|
|
|
|
for (i = 0; i < sidptr->num_subauth; ++i) {
|
|
|
saval = le32_to_cpu(sidptr->sub_auth[i]);
|