Skip to contentSkip to conversation

libgssglue clean up.

PATCH New Steve Dickson 1 participant 6 messages Oct 24, 2012

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover libgssglue clean up.

These patches, including the ones Yao Zhao posted a while back, remove a number of different types of warnings through out the code.

Steve Dickson (2):
Fixed warnings in src/g_mit_krb5_mech.c Fixed warnings in src/g_unseal.c and src/g_verify.c

Yao Zhao (3):
Fixed warnings in src/g_canon_name.c
Fixed warnings in src/g_initialize.c
Fixed warnings in src/g_inq_cred.c

 src/g_canon_name.c    | 16 +++++++++++-----
 src/g_initialize.c    |  2 ++
 src/g_inq_cred.c      |  6 ++++--
 src/g_mit_krb5_mech.c |  1 -
 src/g_unseal.c        |  2 +-
 src/g_verify.c        |  2 +-
 src/mglueP.h          |  4 ++--
 7 files changed, 21 insertions(+), 12 deletions(-)
Signature · 1 line
1.7.11.7
#1 lore raw

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

From: Yao Zhao <[email protected]>

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.

---
 src/g_canon_name.c | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)
src/g_canon_name.c +11 -5
index 11a6b21..080befe 100644
@@ -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,
Signature · 1 line
1.7.11.7
#2 lore raw

PATCH 2/5 Fixed warnings in src/g_initialize.c

In reply to Steve Dickson

From: Yao Zhao <[email protected]>

g_initialize.c: In function 'linux_initialize':
g_initialize.c:275:5: warning: implicit declaration of function 'getuid' [-Wimplicit-function-declaration]
g_initialize.c:275:5: warning: implicit declaration of function 'geteuid' [-Wimplicit-function-declaration]

---
 src/g_initialize.c | 2 ++
 1 file changed, 2 insertions(+)
src/g_initialize.c +2 -0
index 908398e..d1cb172 100644
@@ -29,6 +29,8 @@
 #include "mglueP.h"
 #include <stdlib.h>
 
+#include <unistd.h>   /*getuid, geteuid */
+#include <sys/types.h>
 #include <stdio.h>
 #include <string.h>
 #include <ctype.h>
Signature · 1 line
1.7.11.7
#3 lore raw

PATCH 3/5 Fixed warnings in src/g_inq_cred.c

In reply to Steve Dickson

From: Yao Zhao <[email protected]>

g_inq_cred.c:161:8: warning: passing argument 3 of 'generic_gss_copy_oid' from incompatible pointer type [enabled by default]

---
 src/g_inq_cred.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
src/g_inq_cred.c +4 -2
index 9f531d8..8367a56 100644
@@ -152,13 +152,15 @@ gss_OID_set *		mechanisms;
 			     union_cred->count);
 	if ((*mechanisms)->elements == NULL) {
 	    *minor_status = ENOMEM;
+	    free(*mechanisms);
+	    *mechanisms = GSS_C_NO_OID_SET;
 	    return (GSS_S_FAILURE);
 	}
 
 	for (i=0; i < union_cred->count; i++) {
-	    status = generic_gss_copy_oid(minor_status,
+	    status = generic_gss_add_oid_set_member(minor_status,
 	    				  &union_cred->mechs_array[i],
-					  &((*mechanisms)->elements[i]));
+					  mechanisms);
 	    if (status != GSS_S_COMPLETE)
 	        break;
 	}
Signature · 1 line
1.7.11.7
#4 lore raw

PATCH 4/5 Fixed warnings in src/g_mit_krb5_mech.c

In reply to Steve Dickson

g_mit_krb5_mech.c:209:1: warning: label 'out' defined but not used [-Wunused-label]

---
 src/g_mit_krb5_mech.c | 1 -
 1 file changed, 1 deletion(-)
src/g_mit_krb5_mech.c +0 -1
index b2ad784..aa7433a 100644
@@ -206,6 +206,5 @@ internal_krb5_gss_initialize(void *dl)
 		krb5_mechanism.gss_free_lucid_sec_context = p;
 	}
 	krb5_mech_ptr = &krb5_mechanism;
-out:
 	return (krb5_mech_ptr);
 }
Signature · 1 line
1.7.11.7
#5 lore raw

PATCH 5/5 Fixed warnings in src/g_unseal.c and src/g_verify.c

In reply to Steve Dickson

Changed the signedness qop_state argument from int * to gss_qop_t *

---
 src/g_unseal.c | 2 +-
 src/g_verify.c | 2 +-
 src/mglueP.h   | 4 ++--
 3 files changed, 4 insertions(+), 4 deletions(-)
src/g_unseal.c +1 -1
index 5f5ccf0..a1c78e3 100644
@@ -41,7 +41,7 @@ gss_ctx_id_t		context_handle;
 gss_buffer_t		input_message_buffer;
 gss_buffer_t		output_message_buffer;
 int *			conf_state;
-int *			qop_state;
+gss_qop_t *		qop_state;
 
 {
     OM_uint32		status;
src/g_verify.c +1 -1
index 4439405..6c734bc 100644
@@ -74,7 +74,7 @@ int *			qop_state;
 				      ctx->internal_ctx_id,
 				      message_buffer,
 				      token_buffer,
-				      qop_state);
+				      (gss_qop_t *)qop_state);
 	else
 	    status = GSS_S_BAD_BINDINGS;
 
src/mglueP.h +2 -2
index da3eaed..78eabdd 100644
@@ -171,7 +171,7 @@ typedef struct gss_config {
 		    gss_buffer_t,	/* input_message_buffer */
 		    gss_buffer_t,	/* output_message_buffer */
 		    int*,		/* conf_state */
-		    int*		/* qop_state */
+		    gss_qop_t *	/* qop_state */
 		    );
     OM_uint32       (*gss_display_status)
 	(
@@ -316,7 +316,7 @@ typedef struct gss_config {
 		    gss_ctx_id_t,	/* context_handle */
 		    gss_buffer_t,	/* message_buffer */
 		    gss_buffer_t,	/* token_buffer */
-		    int*		/* qop_state */
+		    gss_qop_t  *	/* qop_state */
 		    );
 
     OM_uint32       (*gss_export_lucid_sec_context)
Signature · 1 line
1.7.11.7