]> git.proxmox.com Git - mirror_spl-debian.git/commitdiff
Add crgetfsuid()/crgetfsgid() helpers
authorBrian Behlendorf <behlendorf1@llnl.gov>
Tue, 22 Mar 2011 18:18:15 +0000 (11:18 -0700)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Tue, 22 Mar 2011 19:18:44 +0000 (12:18 -0700)
Solaris credentials don't have an fsuid/fsguid field but Linux
credentials do.  To handle this case the Solaris API is being
modestly extended to include the crgetfsuid()/crgetfsgid()
helper functions.

Addititionally, because the crget*() helpers are implemented
identically regardless of HAVE_CRED_STRUCT they have been
moved outside the #ifdef to common code.  This simplification
means we only have one version of the helper to keep to to date.

include/sys/cred.h
module/spl/spl-cred.c

index 6f4cde73cf0b8b9bf326b62696289e9525ea2de6..778d0525517c6deae3a4346e5791f941146e8c35 100644 (file)
@@ -50,9 +50,11 @@ extern void crfree(cred_t *cr);
 extern uid_t crgetuid(const cred_t *cr);
 extern uid_t crgetruid(const cred_t *cr);
 extern uid_t crgetsuid(const cred_t *cr);
+extern uid_t crgetfsuid(const cred_t *cr);
 extern gid_t crgetgid(const cred_t *cr);
 extern gid_t crgetrgid(const cred_t *cr);
 extern gid_t crgetsgid(const cred_t *cr);
+extern gid_t crgetfsgid(const cred_t *cr);
 extern int crgetngroups(const cred_t *cr);
 extern gid_t * crgetgroups(const cred_t *cr);
 extern int groupmember(gid_t gid, const cred_t *cr);
index dd5d9da01eb9e15e1e6c6374c74ba3ef28104283..ce3425d320eeea9181eb44f74916c816f77ab64e 100644 (file)
@@ -84,48 +84,6 @@ crfree(cred_t *cr)
        put_cred((const cred_t *)cr);
 }
 
-/* Return the effective user id */
-uid_t
-crgetuid(const cred_t *cr)
-{
-       return cr->euid;
-}
-
-/* Return the real user id */
-uid_t
-crgetruid(const cred_t *cr)
-{
-       return cr->uid;
-}
-
-/* Return the saved user id */
-uid_t
-crgetsuid(const cred_t *cr)
-{
-       return cr->suid;
-}
-
-/* Return the effective group id */
-gid_t
-crgetgid(const cred_t *cr)
-{
-       return cr->egid;
-}
-
-/* Return the real group id */
-gid_t
-crgetrgid(const cred_t *cr)
-{
-       return cr->gid;
-}
-
-/* Return the saved group id */
-gid_t
-crgetsgid(const cred_t *cr)
-{
-       return cr->sgid;
-}
-
 /* Return the number of supplemental groups */
 int
 crgetngroups(const cred_t *cr)
@@ -186,42 +144,6 @@ void crhold(cred_t *cr) { }
 /* Free a reference on the credential and group info */
 void crfree(cred_t *cr) { }
 
-/* Return the effective user id */
-uid_t
-crgetuid(const cred_t *cr) {
-       return cr->euid;
-}
-
-/* Return the effective real id */
-uid_t
-crgetruid(const cred_t *cr) {
-       return cr->uid;
-}
-
-/* Return the effective saved id */
-uid_t
-crgetsuid(const cred_t *cr) {
-       return cr->suid;
-}
-
-/* Return the effective group id */
-gid_t
-crgetgid(const cred_t *cr) {
-       return cr->egid;
-}
-
-/* Return the real group id */
-gid_t
-crgetrgid(const cred_t *cr) {
-       return cr->gid;
-}
-
-/* Return the saved group id */
-gid_t
-crgetsgid(const cred_t *cr) {
-       return cr->sgid;
-}
-
 /* Return the number of supplemental groups */
 int
 crgetngroups(const cred_t *cr)
@@ -289,14 +211,72 @@ groupmember(gid_t gid, const cred_t *cr)
 
 #endif /* HAVE_CRED_STRUCT */
 
+/* Return the effective user id */
+uid_t
+crgetuid(const cred_t *cr)
+{
+       return cr->euid;
+}
+
+/* Return the real user id */
+uid_t
+crgetruid(const cred_t *cr)
+{
+       return cr->uid;
+}
+
+/* Return the saved user id */
+uid_t
+crgetsuid(const cred_t *cr)
+{
+       return cr->suid;
+}
+
+/* Return the filesystem user id */
+uid_t
+crgetfsuid(const cred_t *cr)
+{
+       return cr->fsuid;
+}
+
+/* Return the effective group id */
+gid_t
+crgetgid(const cred_t *cr)
+{
+       return cr->egid;
+}
+
+/* Return the real group id */
+gid_t
+crgetrgid(const cred_t *cr)
+{
+       return cr->gid;
+}
+
+/* Return the saved group id */
+gid_t
+crgetsgid(const cred_t *cr)
+{
+       return cr->sgid;
+}
+
+/* Return the filesystem group id */
+gid_t
+crgetfsgid(const cred_t *cr)
+{
+       return cr->fsgid;
+}
+
 EXPORT_SYMBOL(crhold);
 EXPORT_SYMBOL(crfree);
 EXPORT_SYMBOL(crgetuid);
 EXPORT_SYMBOL(crgetruid);
 EXPORT_SYMBOL(crgetsuid);
+EXPORT_SYMBOL(crgetfsuid);
 EXPORT_SYMBOL(crgetgid);
 EXPORT_SYMBOL(crgetrgid);
 EXPORT_SYMBOL(crgetsgid);
+EXPORT_SYMBOL(crgetfsgid);
 EXPORT_SYMBOL(crgetngroups);
 EXPORT_SYMBOL(crgetgroups);
 EXPORT_SYMBOL(groupmember);