diff options
-rw-r--r-- | fs/nfs/internal.h | 3 | ||||
-rw-r--r-- | fs/nfs/namespace.c | 29 | ||||
-rw-r--r-- | fs/nfs/nfs4_fs.h | 1 | ||||
-rw-r--r-- | fs/nfs/nfs4namespace.c | 29 | ||||
-rw-r--r-- | fs/nfs/nfs4proc.c | 1 | ||||
-rw-r--r-- | include/linux/nfs_xdr.h | 1 |
6 files changed, 30 insertions, 34 deletions
diff --git a/fs/nfs/internal.h b/fs/nfs/internal.h index d68810f61869..d6994443f285 100644 --- a/fs/nfs/internal.h +++ b/fs/nfs/internal.h | |||
@@ -286,9 +286,6 @@ extern void nfs_sb_deactive(struct super_block *sb); | |||
286 | extern char *nfs_path(char **p, struct dentry *dentry, | 286 | extern char *nfs_path(char **p, struct dentry *dentry, |
287 | char *buffer, ssize_t buflen); | 287 | char *buffer, ssize_t buflen); |
288 | extern struct vfsmount *nfs_d_automount(struct path *path); | 288 | extern struct vfsmount *nfs_d_automount(struct path *path); |
289 | #ifdef CONFIG_NFS_V4 | ||
290 | rpc_authflavor_t nfs_find_best_sec(struct nfs4_secinfo_flavors *); | ||
291 | #endif | ||
292 | 289 | ||
293 | /* getroot.c */ | 290 | /* getroot.c */ |
294 | extern struct dentry *nfs_get_root(struct super_block *, struct nfs_fh *, | 291 | extern struct dentry *nfs_get_root(struct super_block *, struct nfs_fh *, |
diff --git a/fs/nfs/namespace.c b/fs/nfs/namespace.c index d51868e5683c..2a9591b0b150 100644 --- a/fs/nfs/namespace.c +++ b/fs/nfs/namespace.c | |||
@@ -119,35 +119,6 @@ Elong: | |||
119 | } | 119 | } |
120 | 120 | ||
121 | #ifdef CONFIG_NFS_V4 | 121 | #ifdef CONFIG_NFS_V4 |
122 | rpc_authflavor_t nfs_find_best_sec(struct nfs4_secinfo_flavors *flavors) | ||
123 | { | ||
124 | struct gss_api_mech *mech; | ||
125 | struct xdr_netobj oid; | ||
126 | int i; | ||
127 | rpc_authflavor_t pseudoflavor = RPC_AUTH_UNIX; | ||
128 | |||
129 | for (i = 0; i < flavors->num_flavors; i++) { | ||
130 | struct nfs4_secinfo_flavor *flavor; | ||
131 | flavor = &flavors->flavors[i]; | ||
132 | |||
133 | if (flavor->flavor == RPC_AUTH_NULL || flavor->flavor == RPC_AUTH_UNIX) { | ||
134 | pseudoflavor = flavor->flavor; | ||
135 | break; | ||
136 | } else if (flavor->flavor == RPC_AUTH_GSS) { | ||
137 | oid.len = flavor->gss.sec_oid4.len; | ||
138 | oid.data = flavor->gss.sec_oid4.data; | ||
139 | mech = gss_mech_get_by_OID(&oid); | ||
140 | if (!mech) | ||
141 | continue; | ||
142 | pseudoflavor = gss_svc_to_pseudoflavor(mech, flavor->gss.service); | ||
143 | gss_mech_put(mech); | ||
144 | break; | ||
145 | } | ||
146 | } | ||
147 | |||
148 | return pseudoflavor; | ||
149 | } | ||
150 | |||
151 | static struct rpc_clnt *nfs_lookup_mountpoint(struct inode *dir, | 122 | static struct rpc_clnt *nfs_lookup_mountpoint(struct inode *dir, |
152 | struct qstr *name, | 123 | struct qstr *name, |
153 | struct nfs_fh *fh, | 124 | struct nfs_fh *fh, |
diff --git a/fs/nfs/nfs4_fs.h b/fs/nfs/nfs4_fs.h index 8d75021020b3..53a487ee9867 100644 --- a/fs/nfs/nfs4_fs.h +++ b/fs/nfs/nfs4_fs.h | |||
@@ -206,6 +206,7 @@ extern const struct dentry_operations nfs4_dentry_operations; | |||
206 | extern const struct inode_operations nfs4_dir_inode_operations; | 206 | extern const struct inode_operations nfs4_dir_inode_operations; |
207 | 207 | ||
208 | /* nfs4namespace.c */ | 208 | /* nfs4namespace.c */ |
209 | rpc_authflavor_t nfs_find_best_sec(struct nfs4_secinfo_flavors *); | ||
209 | struct rpc_clnt *nfs4_create_sec_client(struct rpc_clnt *, struct inode *, struct qstr *); | 210 | struct rpc_clnt *nfs4_create_sec_client(struct rpc_clnt *, struct inode *, struct qstr *); |
210 | 211 | ||
211 | /* nfs4proc.c */ | 212 | /* nfs4proc.c */ |
diff --git a/fs/nfs/nfs4namespace.c b/fs/nfs/nfs4namespace.c index a7f3dedc4ec7..a69ee3952bbe 100644 --- a/fs/nfs/nfs4namespace.c +++ b/fs/nfs/nfs4namespace.c | |||
@@ -132,6 +132,35 @@ static size_t nfs_parse_server_name(char *string, size_t len, | |||
132 | return ret; | 132 | return ret; |
133 | } | 133 | } |
134 | 134 | ||
135 | rpc_authflavor_t nfs_find_best_sec(struct nfs4_secinfo_flavors *flavors) | ||
136 | { | ||
137 | struct gss_api_mech *mech; | ||
138 | struct xdr_netobj oid; | ||
139 | int i; | ||
140 | rpc_authflavor_t pseudoflavor = RPC_AUTH_UNIX; | ||
141 | |||
142 | for (i = 0; i < flavors->num_flavors; i++) { | ||
143 | struct nfs4_secinfo_flavor *flavor; | ||
144 | flavor = &flavors->flavors[i]; | ||
145 | |||
146 | if (flavor->flavor == RPC_AUTH_NULL || flavor->flavor == RPC_AUTH_UNIX) { | ||
147 | pseudoflavor = flavor->flavor; | ||
148 | break; | ||
149 | } else if (flavor->flavor == RPC_AUTH_GSS) { | ||
150 | oid.len = flavor->gss.sec_oid4.len; | ||
151 | oid.data = flavor->gss.sec_oid4.data; | ||
152 | mech = gss_mech_get_by_OID(&oid); | ||
153 | if (!mech) | ||
154 | continue; | ||
155 | pseudoflavor = gss_svc_to_pseudoflavor(mech, flavor->gss.service); | ||
156 | gss_mech_put(mech); | ||
157 | break; | ||
158 | } | ||
159 | } | ||
160 | |||
161 | return pseudoflavor; | ||
162 | } | ||
163 | |||
135 | static rpc_authflavor_t nfs4_negotiate_security(struct inode *inode, struct qstr *name) | 164 | static rpc_authflavor_t nfs4_negotiate_security(struct inode *inode, struct qstr *name) |
136 | { | 165 | { |
137 | struct page *page; | 166 | struct page *page; |
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index 87af80d28a82..fa661b91e57c 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c | |||
@@ -6610,7 +6610,6 @@ const struct nfs_rpc_ops nfs_v4_clientops = { | |||
6610 | .close_context = nfs4_close_context, | 6610 | .close_context = nfs4_close_context, |
6611 | .open_context = nfs4_atomic_open, | 6611 | .open_context = nfs4_atomic_open, |
6612 | .init_client = nfs4_init_client, | 6612 | .init_client = nfs4_init_client, |
6613 | .secinfo = nfs4_proc_secinfo, | ||
6614 | }; | 6613 | }; |
6615 | 6614 | ||
6616 | static const struct xattr_handler nfs4_xattr_nfs4_acl_handler = { | 6615 | static const struct xattr_handler nfs4_xattr_nfs4_acl_handler = { |
diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h index 5f563bd113e8..eb1f143042f4 100644 --- a/include/linux/nfs_xdr.h +++ b/include/linux/nfs_xdr.h | |||
@@ -1397,7 +1397,6 @@ struct nfs_rpc_ops { | |||
1397 | struct iattr *iattr); | 1397 | struct iattr *iattr); |
1398 | int (*init_client) (struct nfs_client *, const struct rpc_timeout *, | 1398 | int (*init_client) (struct nfs_client *, const struct rpc_timeout *, |
1399 | const char *, rpc_authflavor_t, int); | 1399 | const char *, rpc_authflavor_t, int); |
1400 | int (*secinfo)(struct inode *, const struct qstr *, struct nfs4_secinfo_flavors *); | ||
1401 | }; | 1400 | }; |
1402 | 1401 | ||
1403 | /* | 1402 | /* |