[PATCH 1/5] Fixed warnings in src/g_canon_name.c

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Yao Zhao <yao.zhao@xxxxxxxxxxxxx>

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@xxxxxxxxxx>
Signed-off-by: Yao Zhao <yao.zhao@xxxxxxxxxxxxx>
---
 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

--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux