diff options
author | Shirish Pargaonkar <shirishpargaonkar@gmail.com> | 2011-05-06 03:35:00 -0400 |
---|---|---|
committer | Steve French <sfrench@us.ibm.com> | 2011-05-19 10:10:56 -0400 |
commit | c4aca0c09f80ca40dbcecb2370af9594fbe9051d (patch) | |
tree | 27390f82234bf8ee4376bbececfc8a247fa0299e /fs | |
parent | f14bcf71d1b802f6042b6c70a0c37120e47a0876 (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')
-rw-r--r-- | fs/cifs/cifsacl.c | 59 | ||||
-rw-r--r-- | fs/cifs/cifsacl.h | 1 | ||||
-rw-r--r-- | fs/cifs/cifsfs.c | 8 |
3 files changed, 6 insertions, 62 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 | |||
37 | static 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 */ |
49 | static const struct cifs_sid sid_everyone = { | 37 | static 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 | ||
133 | struct key_type cifs_idmap_key_type = { | 121 | struct 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 | ||
438 | int 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 */ |
485 | int compare_sids(const struct cifs_sid *ctsid, const struct cifs_sid *cwsid) | 428 | int compare_sids(const struct cifs_sid *ctsid, const struct cifs_sid *cwsid) |
diff --git a/fs/cifs/cifsacl.h b/fs/cifs/cifsacl.h index 757cf5aec3ee..5c902c7ce524 100644 --- a/fs/cifs/cifsacl.h +++ b/fs/cifs/cifsacl.h | |||
@@ -98,7 +98,6 @@ extern struct key_type cifs_idmap_key_type; | |||
98 | extern const struct cred *root_cred; | 98 | extern const struct cred *root_cred; |
99 | #endif /* KERNEL */ | 99 | #endif /* KERNEL */ |
100 | 100 | ||
101 | extern int match_sid(struct cifs_sid *); | ||
102 | extern int compare_sids(const struct cifs_sid *, const struct cifs_sid *); | 101 | extern int compare_sids(const struct cifs_sid *, const struct cifs_sid *); |
103 | 102 | ||
104 | #endif /* _CIFSACL_H */ | 103 | #endif /* _CIFSACL_H */ |
diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c index 2b8e47e5e533..ed92c7d36378 100644 --- a/fs/cifs/cifsfs.c +++ b/fs/cifs/cifsfs.c | |||
@@ -1046,21 +1046,23 @@ init_cifs(void) | |||
1046 | #ifdef CONFIG_CIFS_ACL | 1046 | #ifdef CONFIG_CIFS_ACL |
1047 | rc = init_cifs_idmap(); | 1047 | rc = init_cifs_idmap(); |
1048 | if (rc) | 1048 | if (rc) |
1049 | goto out_destroy_request_bufs; | 1049 | goto out_register_key_type; |
1050 | #endif /* CONFIG_CIFS_ACL */ | 1050 | #endif /* CONFIG_CIFS_ACL */ |
1051 | 1051 | ||
1052 | rc = register_filesystem(&cifs_fs_type); | 1052 | rc = register_filesystem(&cifs_fs_type); |
1053 | if (rc) | 1053 | if (rc) |
1054 | goto out_destroy_request_bufs; | 1054 | goto out_init_cifs_idmap; |
1055 | 1055 | ||
1056 | return 0; | 1056 | return 0; |
1057 | 1057 | ||
1058 | out_destroy_request_bufs: | 1058 | out_init_cifs_idmap: |
1059 | #ifdef CONFIG_CIFS_ACL | 1059 | #ifdef CONFIG_CIFS_ACL |
1060 | exit_cifs_idmap(); | 1060 | exit_cifs_idmap(); |
1061 | out_register_key_type: | ||
1061 | #endif | 1062 | #endif |
1062 | #ifdef CONFIG_CIFS_UPCALL | 1063 | #ifdef CONFIG_CIFS_UPCALL |
1063 | unregister_key_type(&cifs_spnego_key_type); | 1064 | unregister_key_type(&cifs_spnego_key_type); |
1065 | out_destroy_request_bufs: | ||
1064 | #endif | 1066 | #endif |
1065 | cifs_destroy_request_bufs(); | 1067 | cifs_destroy_request_bufs(); |
1066 | out_destroy_mids: | 1068 | out_destroy_mids: |