diff options
-rw-r--r-- | fs/nfsd/nfs4xdr.c | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c index a885e97dc5f4..6cd86e0fe450 100644 --- a/fs/nfsd/nfs4xdr.c +++ b/fs/nfsd/nfs4xdr.c | |||
@@ -3085,10 +3085,11 @@ static __be32 | |||
3085 | nfsd4_do_encode_secinfo(struct nfsd4_compoundres *resp, | 3085 | nfsd4_do_encode_secinfo(struct nfsd4_compoundres *resp, |
3086 | __be32 nfserr, struct svc_export *exp) | 3086 | __be32 nfserr, struct svc_export *exp) |
3087 | { | 3087 | { |
3088 | u32 i, nflavs; | 3088 | u32 i, nflavs, supported; |
3089 | struct exp_flavor_info *flavs; | 3089 | struct exp_flavor_info *flavs; |
3090 | struct exp_flavor_info def_flavs[2]; | 3090 | struct exp_flavor_info def_flavs[2]; |
3091 | __be32 *p; | 3091 | __be32 *p, *flavorsp; |
3092 | static bool report = true; | ||
3092 | 3093 | ||
3093 | if (nfserr) | 3094 | if (nfserr) |
3094 | goto out; | 3095 | goto out; |
@@ -3112,13 +3113,17 @@ nfsd4_do_encode_secinfo(struct nfsd4_compoundres *resp, | |||
3112 | } | 3113 | } |
3113 | } | 3114 | } |
3114 | 3115 | ||
3116 | supported = 0; | ||
3115 | RESERVE_SPACE(4); | 3117 | RESERVE_SPACE(4); |
3116 | WRITE32(nflavs); | 3118 | flavorsp = p++; /* to be backfilled later */ |
3117 | ADJUST_ARGS(); | 3119 | ADJUST_ARGS(); |
3120 | |||
3118 | for (i = 0; i < nflavs; i++) { | 3121 | for (i = 0; i < nflavs; i++) { |
3122 | rpc_authflavor_t pf = flavs[i].pseudoflavor; | ||
3119 | struct rpcsec_gss_info info; | 3123 | struct rpcsec_gss_info info; |
3120 | 3124 | ||
3121 | if (rpcauth_get_gssinfo(flavs[i].pseudoflavor, &info) == 0) { | 3125 | if (rpcauth_get_gssinfo(pf, &info) == 0) { |
3126 | supported++; | ||
3122 | RESERVE_SPACE(4 + 4 + info.oid.len + 4 + 4); | 3127 | RESERVE_SPACE(4 + 4 + info.oid.len + 4 + 4); |
3123 | WRITE32(RPC_AUTH_GSS); | 3128 | WRITE32(RPC_AUTH_GSS); |
3124 | WRITE32(info.oid.len); | 3129 | WRITE32(info.oid.len); |
@@ -3126,13 +3131,22 @@ nfsd4_do_encode_secinfo(struct nfsd4_compoundres *resp, | |||
3126 | WRITE32(info.qop); | 3131 | WRITE32(info.qop); |
3127 | WRITE32(info.service); | 3132 | WRITE32(info.service); |
3128 | ADJUST_ARGS(); | 3133 | ADJUST_ARGS(); |
3129 | } else { | 3134 | } else if (pf < RPC_AUTH_MAXFLAVOR) { |
3135 | supported++; | ||
3130 | RESERVE_SPACE(4); | 3136 | RESERVE_SPACE(4); |
3131 | WRITE32(flavs[i].pseudoflavor); | 3137 | WRITE32(pf); |
3132 | ADJUST_ARGS(); | 3138 | ADJUST_ARGS(); |
3139 | } else { | ||
3140 | if (report) | ||
3141 | pr_warn("NFS: SECINFO: security flavor %u " | ||
3142 | "is not supported\n", pf); | ||
3133 | } | 3143 | } |
3134 | } | 3144 | } |
3135 | 3145 | ||
3146 | if (nflavs != supported) | ||
3147 | report = false; | ||
3148 | *flavorsp = htonl(supported); | ||
3149 | |||
3136 | out: | 3150 | out: |
3137 | if (exp) | 3151 | if (exp) |
3138 | exp_put(exp); | 3152 | exp_put(exp); |