From 05e8cd9412bdb85ffd57ff78a13899194f70a65e Mon Sep 17 00:00:00 2001 From: Jeff Layton Date: Sun, 25 Nov 2012 08:00:36 -0500 Subject: [PATCH] --- yaml --- r: 339455 b: refs/heads/master c: 436bb435fcbe2d52678ec7e2abc45fd1938601ce h: refs/heads/master i: 339453: 9be167cb869bc997ae261e4e24c0a8f318f529d4 339451: 76db9c8ff5beced778cf7390e1a01f2340103213 339447: 648d036011154b103003eb10af105db25f0f835e 339439: cac050503f675495832d36873e2f4d3d7e54f074 339423: 7f6378901b4b1da88107c976f2f563d2da5cd734 339391: 09614331ddef07b3b73a6ddef8f1b8bc95655bff 339327: 03f752cf0bbd1a86c612368f05a76eb40cb19f87 339199: d3d26d0fd0caffe06f3251d48d59103eaca731b6 338943: a8b5b06a001d4d6d40a154b41e6ff722d71aa1d9 v: v3 --- [refs] | 2 +- trunk/fs/cifs/cifsacl.c | 98 +++++++++++++++++++++-------------------- trunk/fs/cifs/cifsacl.h | 2 - 3 files changed, 51 insertions(+), 51 deletions(-) diff --git a/[refs] b/[refs] index ad4a9d1b70a2..cce72dcc2c6c 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 852e22950dc47e774bb602b16f55fed42afac5fb +refs/heads/master: 436bb435fcbe2d52678ec7e2abc45fd1938601ce diff --git a/trunk/fs/cifs/cifsacl.c b/trunk/fs/cifs/cifsacl.c index 18437c5561fe..5a312eb45a92 100644 --- a/trunk/fs/cifs/cifsacl.c +++ b/trunk/fs/cifs/cifsacl.c @@ -224,6 +224,56 @@ sid_to_str(struct cifs_sid *sidptr, char *sidstr) } } +/* + * if the two SIDs (roughly equivalent to a UUID for a user or group) are + * the same returns zero, if they do not match returns non-zero. + */ +static int +compare_sids(const struct cifs_sid *ctsid, const struct cifs_sid *cwsid) +{ + int i; + int num_subauth, num_sat, num_saw; + + if ((!ctsid) || (!cwsid)) + return 1; + + /* compare the revision */ + if (ctsid->revision != cwsid->revision) { + if (ctsid->revision > cwsid->revision) + return 1; + else + return -1; + } + + /* compare all of the six auth values */ + for (i = 0; i < NUM_AUTHS; ++i) { + if (ctsid->authority[i] != cwsid->authority[i]) { + if (ctsid->authority[i] > cwsid->authority[i]) + return 1; + else + return -1; + } + } + + /* compare all of the subauth values if any */ + num_sat = ctsid->num_subauth; + num_saw = cwsid->num_subauth; + num_subauth = num_sat < num_saw ? num_sat : num_saw; + if (num_subauth) { + for (i = 0; i < num_subauth; ++i) { + if (ctsid->sub_auth[i] != cwsid->sub_auth[i]) { + if (le32_to_cpu(ctsid->sub_auth[i]) > + le32_to_cpu(cwsid->sub_auth[i])) + return 1; + else + return -1; + } + } + } + + return 0; /* sids compare/match */ +} + static void cifs_copy_sid(struct cifs_sid *dst, const struct cifs_sid *src) { @@ -630,54 +680,6 @@ cifs_destroy_idmaptrees(void) spin_unlock(&gidsidlock); } -/* if the two SIDs (roughly equivalent to a UUID for a user or group) are - the same returns 1, if they do not match returns 0 */ -int compare_sids(const struct cifs_sid *ctsid, const struct cifs_sid *cwsid) -{ - int i; - int num_subauth, num_sat, num_saw; - - if ((!ctsid) || (!cwsid)) - return 1; - - /* compare the revision */ - if (ctsid->revision != cwsid->revision) { - if (ctsid->revision > cwsid->revision) - return 1; - else - return -1; - } - - /* compare all of the six auth values */ - for (i = 0; i < NUM_AUTHS; ++i) { - if (ctsid->authority[i] != cwsid->authority[i]) { - if (ctsid->authority[i] > cwsid->authority[i]) - return 1; - else - return -1; - } - } - - /* compare all of the subauth values if any */ - num_sat = ctsid->num_subauth; - num_saw = cwsid->num_subauth; - num_subauth = num_sat < num_saw ? num_sat : num_saw; - if (num_subauth) { - for (i = 0; i < num_subauth; ++i) { - if (ctsid->sub_auth[i] != cwsid->sub_auth[i]) { - if (le32_to_cpu(ctsid->sub_auth[i]) > - le32_to_cpu(cwsid->sub_auth[i])) - return 1; - else - return -1; - } - } - } - - return 0; /* sids compare/match */ -} - - /* copy ntsd, owner sid, and group sid from a security descriptor to another */ static void copy_sec_desc(const struct cifs_ntsd *pntsd, struct cifs_ntsd *pnntsd, __u32 sidsoffset) diff --git a/trunk/fs/cifs/cifsacl.h b/trunk/fs/cifs/cifsacl.h index 80e0d66a403d..18c7521273a7 100644 --- a/trunk/fs/cifs/cifsacl.h +++ b/trunk/fs/cifs/cifsacl.h @@ -98,6 +98,4 @@ extern struct key_type cifs_idmap_key_type; extern const struct cred *root_cred; #endif /* KERNEL */ -extern int compare_sids(const struct cifs_sid *, const struct cifs_sid *); - #endif /* _CIFSACL_H */