Commit 44234063 authored by J. Bruce Fields's avatar J. Bruce Fields

svcrpc: introduce init_svc_cred

Common helper to zero out fields of the svc_cred.
Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
parent 0de93493
...@@ -25,6 +25,13 @@ struct svc_cred { ...@@ -25,6 +25,13 @@ struct svc_cred {
char *cr_principal; /* for gss */ char *cr_principal; /* for gss */
}; };
static inline void init_svc_cred(struct svc_cred *cred)
{
cred->cr_group_info = NULL;
cred->cr_principal = NULL;
cred->cr_gss_mech = NULL;
}
static inline void free_svc_cred(struct svc_cred *cred) static inline void free_svc_cred(struct svc_cred *cred)
{ {
if (cred->cr_group_info) if (cred->cr_group_info)
......
...@@ -377,8 +377,7 @@ rsc_init(struct cache_head *cnew, struct cache_head *ctmp) ...@@ -377,8 +377,7 @@ rsc_init(struct cache_head *cnew, struct cache_head *ctmp)
new->handle.data = tmp->handle.data; new->handle.data = tmp->handle.data;
tmp->handle.data = NULL; tmp->handle.data = NULL;
new->mechctx = NULL; new->mechctx = NULL;
new->cred.cr_group_info = NULL; init_svc_cred(&new->cred);
new->cred.cr_principal = NULL;
} }
static void static void
...@@ -392,9 +391,8 @@ update_rsc(struct cache_head *cnew, struct cache_head *ctmp) ...@@ -392,9 +391,8 @@ update_rsc(struct cache_head *cnew, struct cache_head *ctmp)
memset(&new->seqdata, 0, sizeof(new->seqdata)); memset(&new->seqdata, 0, sizeof(new->seqdata));
spin_lock_init(&new->seqdata.sd_lock); spin_lock_init(&new->seqdata.sd_lock);
new->cred = tmp->cred; new->cred = tmp->cred;
tmp->cred.cr_group_info = NULL;
new->cred.cr_principal = tmp->cred.cr_principal; new->cred.cr_principal = tmp->cred.cr_principal;
tmp->cred.cr_principal = NULL; init_svc_cred(&tmp->cred);
} }
static struct cache_head * static struct cache_head *
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment