aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs/cifsacl.c
diff options
context:
space:
mode:
authorShirish Pargaonkar <shirishpargaonkar@gmail.com>2011-05-06 03:35:00 -0400
committerSteve French <sfrench@us.ibm.com>2011-05-19 10:10:56 -0400
commitc4aca0c09f80ca40dbcecb2370af9594fbe9051d (patch)
tree27390f82234bf8ee4376bbececfc8a247fa0299e /fs/cifs/cifsacl.c
parentf14bcf71d1b802f6042b6c70a0c37120e47a0876 (diff)
cifs: Change key name to cifs.idmap, misc. clean-up
Change idmap key name from cifs.cifs_idmap to cifs.idmap. Removed unused structure wksidarr and function match_sid(). Handle errors correctly in function init_cifs(). Signed-off-by: Shirish Pargaonkar <shirishpargaonkar@gmail.com> Reviewed-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Steve French <sfrench@us.ibm.com>
Diffstat (limited to 'fs/cifs/cifsacl.c')
-rw-r--r--fs/cifs/cifsacl.c59
1 files changed, 1 insertions, 58 deletions
diff --git a/fs/cifs/cifsacl.c b/fs/cifs/cifsacl.c
index bfb5ba5a271b..f3c6fb9942ac 100644
--- a/fs/cifs/cifsacl.c
+++ b/fs/cifs/cifsacl.c
@@ -33,18 +33,6 @@
33#include "cifsproto.h" 33#include "cifsproto.h"
34#include "cifs_debug.h" 34#include "cifs_debug.h"
35 35
36
37static struct cifs_wksid wksidarr[NUM_WK_SIDS] = {
38 {{1, 0, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0} }, "null user"},
39 {{1, 1, {0, 0, 0, 0, 0, 1}, {0, 0, 0, 0, 0} }, "nobody"},
40 {{1, 1, {0, 0, 0, 0, 0, 5}, {__constant_cpu_to_le32(11), 0, 0, 0, 0} }, "net-users"},
41 {{1, 1, {0, 0, 0, 0, 0, 5}, {__constant_cpu_to_le32(18), 0, 0, 0, 0} }, "sys"},
42 {{1, 2, {0, 0, 0, 0, 0, 5}, {__constant_cpu_to_le32(32), __constant_cpu_to_le32(544), 0, 0, 0} }, "root"},
43 {{1, 2, {0, 0, 0, 0, 0, 5}, {__constant_cpu_to_le32(32), __constant_cpu_to_le32(545), 0, 0, 0} }, "users"},
44 {{1, 2, {0, 0, 0, 0, 0, 5}, {__constant_cpu_to_le32(32), __constant_cpu_to_le32(546), 0, 0, 0} }, "guest"} }
45;
46
47
48/* security id for everyone/world system group */ 36/* security id for everyone/world system group */
49static const struct cifs_sid sid_everyone = { 37static const struct cifs_sid sid_everyone = {
50 1, 1, {0, 0, 0, 0, 0, 1}, {0} }; 38 1, 1, {0, 0, 0, 0, 0, 1}, {0} };
@@ -131,7 +119,7 @@ cifs_idmap_key_destroy(struct key *key)
131} 119}
132 120
133struct key_type cifs_idmap_key_type = { 121struct key_type cifs_idmap_key_type = {
134 .name = "cifs.cifs_idmap", 122 .name = "cifs.idmap",
135 .instantiate = cifs_idmap_key_instantiate, 123 .instantiate = cifs_idmap_key_instantiate,
136 .destroy = cifs_idmap_key_destroy, 124 .destroy = cifs_idmap_key_destroy,
137 .describe = user_describe, 125 .describe = user_describe,
@@ -435,51 +423,6 @@ cifs_destroy_idmaptrees(void)
435 spin_unlock(&sidgidlock); 423 spin_unlock(&sidgidlock);
436} 424}
437 425
438int match_sid(struct cifs_sid *ctsid)
439{
440 int i, j;
441 int num_subauth, num_sat, num_saw;
442 struct cifs_sid *cwsid;
443
444 if (!ctsid)
445 return -1;
446
447 for (i = 0; i < NUM_WK_SIDS; ++i) {
448 cwsid = &(wksidarr[i].cifssid);
449
450 /* compare the revision */
451 if (ctsid->revision != cwsid->revision)
452 continue;
453
454 /* compare all of the six auth values */
455 for (j = 0; j < 6; ++j) {
456 if (ctsid->authority[j] != cwsid->authority[j])
457 break;
458 }
459 if (j < 6)
460 continue; /* all of the auth values did not match */
461
462 /* compare all of the subauth values if any */
463 num_sat = ctsid->num_subauth;
464 num_saw = cwsid->num_subauth;
465 num_subauth = num_sat < num_saw ? num_sat : num_saw;
466 if (num_subauth) {
467 for (j = 0; j < num_subauth; ++j) {
468 if (ctsid->sub_auth[j] != cwsid->sub_auth[j])
469 break;
470 }
471 if (j < num_subauth)
472 continue; /* all sub_auth values do not match */
473 }
474
475 cFYI(1, "matching sid: %s\n", wksidarr[i].sidname);
476 return 0; /* sids compare/match */
477 }
478
479 cFYI(1, "No matching sid");
480 return -1;
481}
482
483/* if the two SIDs (roughly equivalent to a UUID for a user or group) are 426/* if the two SIDs (roughly equivalent to a UUID for a user or group) are
484 the same returns 1, if they do not match returns 0 */ 427 the same returns 1, if they do not match returns 0 */
485int compare_sids(const struct cifs_sid *ctsid, const struct cifs_sid *cwsid) 428int compare_sids(const struct cifs_sid *ctsid, const struct cifs_sid *cwsid)