| .. | .. |
|---|
| 60 | 60 | const size_t hostname_len; /* it's length */ |
|---|
| 61 | 61 | const int noresvport; /* use non-priv port */ |
|---|
| 62 | 62 | struct net *net; /* network namespace to bind */ |
|---|
| 63 | + const struct cred *cred; |
|---|
| 63 | 64 | }; |
|---|
| 64 | 65 | |
|---|
| 65 | 66 | /* |
|---|
| .. | .. |
|---|
| 162 | 163 | host->h_nsmhandle = nsm; |
|---|
| 163 | 164 | host->h_addrbuf = nsm->sm_addrbuf; |
|---|
| 164 | 165 | host->net = ni->net; |
|---|
| 166 | + host->h_cred = get_cred(ni->cred), |
|---|
| 165 | 167 | strlcpy(host->nodename, utsname()->nodename, sizeof(host->nodename)); |
|---|
| 166 | 168 | |
|---|
| 167 | 169 | out: |
|---|
| .. | .. |
|---|
| 188 | 190 | clnt = host->h_rpcclnt; |
|---|
| 189 | 191 | if (clnt != NULL) |
|---|
| 190 | 192 | rpc_shutdown_client(clnt); |
|---|
| 193 | + put_cred(host->h_cred); |
|---|
| 191 | 194 | kfree(host); |
|---|
| 192 | 195 | |
|---|
| 193 | 196 | ln->nrhosts--; |
|---|
| .. | .. |
|---|
| 202 | 205 | * @version: NLM protocol version |
|---|
| 203 | 206 | * @hostname: '\0'-terminated hostname of server |
|---|
| 204 | 207 | * @noresvport: 1 if non-privileged port should be used |
|---|
| 208 | + * @net: pointer to net namespace |
|---|
| 209 | + * @cred: pointer to cred |
|---|
| 205 | 210 | * |
|---|
| 206 | 211 | * Returns an nlm_host structure that matches the passed-in |
|---|
| 207 | 212 | * [server address, transport protocol, NLM version, server hostname]. |
|---|
| .. | .. |
|---|
| 214 | 219 | const u32 version, |
|---|
| 215 | 220 | const char *hostname, |
|---|
| 216 | 221 | int noresvport, |
|---|
| 217 | | - struct net *net) |
|---|
| 222 | + struct net *net, |
|---|
| 223 | + const struct cred *cred) |
|---|
| 218 | 224 | { |
|---|
| 219 | 225 | struct nlm_lookup_host_info ni = { |
|---|
| 220 | 226 | .server = 0, |
|---|
| .. | .. |
|---|
| 226 | 232 | .hostname_len = strlen(hostname), |
|---|
| 227 | 233 | .noresvport = noresvport, |
|---|
| 228 | 234 | .net = net, |
|---|
| 235 | + .cred = cred, |
|---|
| 229 | 236 | }; |
|---|
| 230 | 237 | struct hlist_head *chain; |
|---|
| 231 | 238 | struct nlm_host *host; |
|---|
| .. | .. |
|---|
| 452 | 459 | .version = host->h_version, |
|---|
| 453 | 460 | .authflavor = RPC_AUTH_UNIX, |
|---|
| 454 | 461 | .flags = (RPC_CLNT_CREATE_NOPING | |
|---|
| 455 | | - RPC_CLNT_CREATE_AUTOBIND), |
|---|
| 462 | + RPC_CLNT_CREATE_AUTOBIND | |
|---|
| 463 | + RPC_CLNT_CREATE_REUSEPORT), |
|---|
| 464 | + .cred = host->h_cred, |
|---|
| 456 | 465 | }; |
|---|
| 457 | 466 | |
|---|
| 458 | 467 | /* |
|---|