linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Steve Dickson <steved@redhat.com>
To: Linux NFS Mailing list <linux-nfs@vger.kernel.org>
Subject: [PATCH 1/5] Fixed warnings in src/g_canon_name.c
Date: Wed, 24 Oct 2012 14:08:40 -0400	[thread overview]
Message-ID: <1351102124-24036-2-git-send-email-steved@redhat.com> (raw)
In-Reply-To: <1351102124-24036-1-git-send-email-steved@redhat.com>

From: Yao Zhao <yao.zhao@windriver.com>

g_canon_name.c:125:5: warning: passing argument 2 of
'__gss_copy_namebuf' from incompatible pointer type [enabled by default]

the 2nd argument of __gss_copy_namebuf should be address of
*gss_buffer_t, but a *gss_buffer_t is assigned.

what __gss_copy_namebuf does is to alloc memory for a gss_buffer_desc
and copy from src and return its address.

if following code failed, gss_release_name will free
union_canon_name->external_name.value if it is not NULL.

Signed-off-by: Steve Dickson <steved@redhat.com>
Signed-off-by: Yao Zhao <yao.zhao@windriver.com>
---
 src/g_canon_name.c | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/src/g_canon_name.c b/src/g_canon_name.c
index 11a6b21..080befe 100644
--- a/src/g_canon_name.c
+++ b/src/g_canon_name.c
@@ -121,11 +121,17 @@ gss_canonicalize_name (OM_uint32 *minor_status,
 
     union_canon_name->mech_name = mech_name;
 
-    status = __gss_copy_namebuf(&union_input_name->external_name,
-				&union_canon_name->external_name);
-    if (status != GSS_S_COMPLETE)
-	goto failure;
-
+    union_canon_name->external_name.value = (void*) malloc(
+                      union_input_name->external_name.length + 1);
+    if (!union_canon_name->external_name.value)
+        goto failure;
+
+    memcpy(union_canon_name->external_name.value, 
+           union_input_name->external_name.value, 
+           union_input_name->external_name.length);
+    union_canon_name->external_name.length = 
+                      union_input_name->external_name.length; 
+   
     if (union_input_name->name_type != GSS_C_NO_OID) {
 	status = generic_gss_copy_oid(minor_status,
 				      union_input_name->name_type,
-- 
1.7.11.7


  reply	other threads:[~2012-10-24 18:11 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-24 18:08 [PATCH 0/5] libgssglue clean up Steve Dickson
2012-10-24 18:08 ` Steve Dickson [this message]
2012-10-24 18:08 ` [PATCH 2/5] Fixed warnings in src/g_initialize.c Steve Dickson
2012-10-24 18:08 ` [PATCH 3/5] Fixed warnings in src/g_inq_cred.c Steve Dickson
2012-10-24 18:08 ` [PATCH 4/5] Fixed warnings in src/g_mit_krb5_mech.c Steve Dickson
2012-10-24 18:08 ` [PATCH 5/5] Fixed warnings in src/g_unseal.c and src/g_verify.c Steve Dickson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1351102124-24036-2-git-send-email-steved@redhat.com \
    --to=steved@redhat.com \
    --cc=linux-nfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).