Skip to contentSkip to conversation

fix bugs and compiling warnings in libgssglue

PATCH In review Yao Zhao 3 participants 8 messages Sep 17, 2012 – Jan 23, 2013

Subsystems (2)
lore
Share & tools
lore

Yao Zhao

author
#0 lore raw

PATCH 1/1 fix bugs and compiling warnings in libgssglue

Hi,

The 4 attached patches fixed a couple of warnings and bug found when compiling libgssglue.

thanks,
yao

--- a/src/g_canon_name.c
+++ b/src/g_canon_name.c
fix the bug:
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.

OM_uint32 __gss_copy_namebuf(src, dest)

    gss_buffer_t   src;
    gss_buffer_t   *dest;
typedef struct gss_union_name_t {
	gss_mechanism		gss_mech;
	gss_OID			name_type;
	gss_buffer_desc		external_name;
	/*
	 * These last two fields are only filled in for mechanism
	 * names.
	 */
	gss_OID			mech_type;
	gss_name_t		mech_name;
} gss_union_name_desc, *gss_union_name_t;
typedef struct gss_buffer_desc_struct {
      size_t length;
      void FAR *value;
} gss_buffer_desc, FAR *gss_buffer_t;

Upstream-Status: Pending

@@ -121,11 +121,17 @@ gss_canonicalize_name (OM_uint32 *minor_

     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,

src/g_initialize.c +0 -0
index 82fcce1..200f173 100644

Fix the warning for getuid, geteuid
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]

Upstream-Status: Pending

@@ -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>

--- a/src/g_inq_cred.c
+++ b/src/g_inq_cred.c
1) add free if malloc failed for (*mechanisms)->elements
2) g_inq_cred.c: In function 'gss_inquire_cred':
g_inq_cred.c:161:8: warning: passing argument 3 of 'generic_gss_copy_oid' from incompatible pointer type [enabled by default]

Upstream-Status: Pending

@@ -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;
}

--- a/src/mglueP.h
+++ b/src/mglueP.h
fix the warning:
warning: implicit declaration of function 'generic_gss_copy_oid_set' [-Wimplicit-function-declaration]

Upstream-Status: Pending

@@ -447,6 +447,12 @@ OM_uint32 generic_gss_copy_oid
gss_OID * /* new_oid */
);

+OM_uint32 generic_gss_copy_oid_set
+ (OM_uint32 *minor_status, /* minor_status */
+ const gss_OID_set_desc * const oidset, /* oid */
+ gss_OID_set *new_oidset /* new_oid */
+ );
+
OM_uint32 generic_gss_create_empty_oid_set
(OM_uint32 *, /* minor_status */
gss_OID_set * /* oid_set */

#1 lore raw

Steve, is it you that maintains libgssglue now?

--b.

Quoted 141 lines · Yao Zhao

Hi,

The 4 attached patches fixed a couple of warnings and bug found when compiling libgssglue.

thanks,
yao

src/g_canon_name.c +0 -0

fix the bug:
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.

OM_uint32 __gss_copy_namebuf(src, dest)

    gss_buffer_t   src;
    gss_buffer_t   *dest;
typedef struct gss_union_name_t {
	gss_mechanism		gss_mech;
	gss_OID			name_type;
	gss_buffer_desc		external_name;
	/*
	 * These last two fields are only filled in for mechanism
	 * names.
	 */
	gss_OID			mech_type;
	gss_name_t		mech_name;
} gss_union_name_desc, *gss_union_name_t;
typedef struct gss_buffer_desc_struct {
      size_t length;
      void FAR *value;
} gss_buffer_desc, FAR *gss_buffer_t;

Upstream-Status: Pending

src/g_canon_name.c +10 -4
@@ -121,11 +121,17 @@ gss_canonicalize_name (OM_uint32 *minor_
 
     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,
src/g_initialize.c +0 -0
index 82fcce1..200f173 100644

Fix the warning for getuid, geteuid
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]

Upstream-Status: Pending

src/g_initialize.c +2 -0
@@ -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>
src/g_inq_cred.c +0 -0

1) add free if malloc failed for (*mechanisms)->elements
2) g_inq_cred.c: In function 'gss_inquire_cred':
g_inq_cred.c:161:8: warning: passing argument 3 of 'generic_gss_copy_oid' from incompatible pointer type [enabled by default]

Upstream-Status: Pending

src/g_inq_cred.c +4 -2
@@ -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;
 	}
src/mglueP.h +0 -0

fix the warning:
warning: implicit declaration of function 'generic_gss_copy_oid_set' [-Wimplicit-function-declaration]

Upstream-Status: Pending

src/mglueP.h +6 -0
@@ -447,6 +447,12 @@ OM_uint32 generic_gss_copy_oid
 	    gss_OID *		/* new_oid */
 	    );
 
+OM_uint32 generic_gss_copy_oid_set
+	   (OM_uint32 *minor_status,	/* minor_status */
+	    const gss_OID_set_desc * const oidset,	/* oid */
+	    gss_OID_set *new_oidset			/* new_oid */
+	   );
+
 OM_uint32 generic_gss_create_empty_oid_set
 	   (OM_uint32 *,	/* minor_status */
 	    gss_OID_set *	/* oid_set */
#2 lore raw
Quoted 1 line · J. Bruce Fields

Steve, is it you that maintains libgssglue now?

Yes, I do. Thanks for the ping. I did miss this...

steved.

Quoted 146 lines

--b.

Quoted 141 lines · Yao Zhao

Hi,

The 4 attached patches fixed a couple of warnings and bug found when compiling libgssglue.

thanks,
yao

src/g_canon_name.c +0 -0

fix the bug:
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.

OM_uint32 __gss_copy_namebuf(src, dest)

    gss_buffer_t   src;
    gss_buffer_t   *dest;
typedef struct gss_union_name_t {
	gss_mechanism		gss_mech;
	gss_OID			name_type;
	gss_buffer_desc		external_name;
	/*
	 * These last two fields are only filled in for mechanism
	 * names.
	 */
	gss_OID			mech_type;
	gss_name_t		mech_name;
} gss_union_name_desc, *gss_union_name_t;
typedef struct gss_buffer_desc_struct {
      size_t length;
      void FAR *value;
} gss_buffer_desc, FAR *gss_buffer_t;

Upstream-Status: Pending

src/g_canon_name.c +10 -4
@@ -121,11 +121,17 @@ gss_canonicalize_name (OM_uint32 *minor_
 
     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,
src/g_initialize.c +0 -0
index 82fcce1..200f173 100644

Fix the warning for getuid, geteuid
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]

Upstream-Status: Pending

src/g_initialize.c +2 -0
@@ -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>
src/g_inq_cred.c +0 -0

1) add free if malloc failed for (*mechanisms)->elements
2) g_inq_cred.c: In function 'gss_inquire_cred':
g_inq_cred.c:161:8: warning: passing argument 3 of 'generic_gss_copy_oid' from incompatible pointer type [enabled by default]

Upstream-Status: Pending

src/g_inq_cred.c +4 -2
@@ -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;
 	}
src/mglueP.h +0 -0

fix the warning:
warning: implicit declaration of function 'generic_gss_copy_oid_set' [-Wimplicit-function-declaration]

Upstream-Status: Pending

src/mglueP.h +6 -0
@@ -447,6 +447,12 @@ OM_uint32 generic_gss_copy_oid
 	    gss_OID *		/* new_oid */
 	    );
 
+OM_uint32 generic_gss_copy_oid_set
+	   (OM_uint32 *minor_status,	/* minor_status */
+	    const gss_OID_set_desc * const oidset,	/* oid */
+	    gss_OID_set *new_oidset			/* new_oid */
+	   );
+
 OM_uint32 generic_gss_create_empty_oid_set
 	   (OM_uint32 *,	/* minor_status */
 	    gss_OID_set *	/* oid_set */
author
#3 lore raw
Quoted 4 lines · Steve Dickson
Quoted 1 line · J. Bruce Fields

Steve, is it you that maintains libgssglue now?

Yes, I do. Thanks for the ping. I did miss this...

Hi Steve,

Just want to follow up whether these are fixed?

thanks,
yao

Quoted 142 lines

steved.

Quoted 140 lines

--b.

Quoted 137 lines · Yao Zhao

Hi,

The 4 attached patches fixed a couple of warnings and bug found when compiling libgssglue.

thanks,
yao

src/g_canon_name.c +0 -0

fix the bug:
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.

OM_uint32 __gss_copy_namebuf(src, dest)

     gss_buffer_t   src;
     gss_buffer_t   *dest;
typedef struct gss_union_name_t {
	gss_mechanism		gss_mech;
	gss_OID			name_type;
	gss_buffer_desc		external_name;
	/*
	 * These last two fields are only filled in for mechanism
	 * names.
	 */
	gss_OID			mech_type;
	gss_name_t		mech_name;
} gss_union_name_desc, *gss_union_name_t;
typedef struct gss_buffer_desc_struct {
       size_t length;
       void FAR *value;
} gss_buffer_desc, FAR *gss_buffer_t;

Upstream-Status: Pending

src/g_canon_name.c +10 -4
@@ -121,11 +121,17 @@ gss_canonicalize_name (OM_uint32 *minor_
 
      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,
src/g_initialize.c +0 -0
index 82fcce1..200f173 100644

Fix the warning for getuid, geteuid
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]

Upstream-Status: Pending

src/g_initialize.c +2 -0
@@ -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>
src/g_inq_cred.c +0 -0

1) add free if malloc failed for (*mechanisms)->elements
2) g_inq_cred.c: In function 'gss_inquire_cred':
g_inq_cred.c:161:8: warning: passing argument 3 of 'generic_gss_copy_oid' from incompatible pointer type [enabled by default]

Upstream-Status: Pending

src/g_inq_cred.c +4 -2
@@ -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;
  	}
src/mglueP.h +0 -0

fix the warning:
warning: implicit declaration of function 'generic_gss_copy_oid_set' [-Wimplicit-function-declaration]

Upstream-Status: Pending

src/mglueP.h +6 -0
@@ -447,6 +447,12 @@ OM_uint32 generic_gss_copy_oid
  	    gss_OID *		/* new_oid */
  	    );
 
+OM_uint32 generic_gss_copy_oid_set
+	   (OM_uint32 *minor_status,	/* minor_status */
+	    const gss_OID_set_desc * const oidset,	/* oid */
+	    gss_OID_set *new_oidset			/* new_oid */
+	   );
+
  OM_uint32 generic_gss_create_empty_oid_set
  	   (OM_uint32 *,	/* minor_status */
  	    gss_OID_set *	/* oid_set */
#4 lore raw
Quoted 8 lines · Yao Zhao
Quoted 4 lines · Steve Dickson
Quoted 1 line · J. Bruce Fields

Steve, is it you that maintains libgssglue now?

Yes, I do. Thanks for the ping. I did miss this...

Hi Steve,

Just want to follow up whether these are fixed?

Yes they were... in libgssglue-0.5

steved.

Quoted 140 lines

thanks,
yao

Quoted 136 lines

steved.

Quoted 134 lines

--b.

Quoted 131 lines · Yao Zhao

Hi,

The 4 attached patches fixed a couple of warnings and bug found when compiling libgssglue.

thanks,
yao

src/g_canon_name.c +0 -0

fix the bug:
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.

OM_uint32 __gss_copy_namebuf(src, dest)

     gss_buffer_t   src;
     gss_buffer_t   *dest;
typedef struct gss_union_name_t {
    gss_mechanism        gss_mech;
    gss_OID            name_type;
    gss_buffer_desc        external_name;
    /*
     * These last two fields are only filled in for mechanism
     * names.
     */
    gss_OID            mech_type;
    gss_name_t        mech_name;
} gss_union_name_desc, *gss_union_name_t;
typedef struct gss_buffer_desc_struct {
       size_t length;
       void FAR *value;
} gss_buffer_desc, FAR *gss_buffer_t;

Upstream-Status: Pending

src/g_canon_name.c +9 -3
@@ -121,11 +121,17 @@ gss_canonicalize_name (OM_uint32 *minor_
        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,
src/g_initialize.c +0 -0
index 82fcce1..200f173 100644

Fix the warning for getuid, geteuid
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]

Upstream-Status: Pending

src/g_initialize.c +1 -0
@@ -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>
src/g_inq_cred.c +0 -0

1) add free if malloc failed for (*mechanisms)->elements
2) g_inq_cred.c: In function 'gss_inquire_cred':
g_inq_cred.c:161:8: warning: passing argument 3 of 'generic_gss_copy_oid' from incompatible pointer type [enabled by default]

Upstream-Status: Pending

src/g_inq_cred.c +4 -2
@@ -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;
      }
src/mglueP.h +0 -0

fix the warning:
warning: implicit declaration of function 'generic_gss_copy_oid_set' [-Wimplicit-function-declaration]

Upstream-Status: Pending

src/mglueP.h +5 -0
@@ -447,6 +447,12 @@ OM_uint32 generic_gss_copy_oid
          gss_OID *        /* new_oid */
          );
  +OM_uint32 generic_gss_copy_oid_set
+       (OM_uint32 *minor_status,    /* minor_status */
+        const gss_OID_set_desc * const oidset,    /* oid */
+        gss_OID_set *new_oidset            /* new_oid */
+       );
+
  OM_uint32 generic_gss_create_empty_oid_set
         (OM_uint32 *,    /* minor_status */
          gss_OID_set *    /* oid_set */
author
#5 lore raw
Quoted 10 lines · Steve Dickson
Quoted 7 lines · Yao Zhao
Quoted 3 lines · Steve Dickson
Quoted 1 line · J. Bruce Fields

Steve, is it you that maintains libgssglue now?

Yes, I do. Thanks for the ping. I did miss this...

Hi Steve,

Just want to follow up whether these are fixed?

Yes they were... in libgssglue-0.5

Thanks Steve!
Could you give me a link where to find it? I couldn't find it at
http://www.citi.umich.edu/projects/nfsv4/linux/libgssglue/

thanks,
yao

Quoted 140 lines

steved.

Quoted 138 lines

thanks,
yao

Quoted 136 lines

steved.

Quoted 134 lines

--b.

Quoted 131 lines · Yao Zhao

Hi,

The 4 attached patches fixed a couple of warnings and bug found when compiling libgssglue.

thanks,
yao

src/g_canon_name.c +0 -0

fix the bug:
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.

OM_uint32 __gss_copy_namebuf(src, dest)

      gss_buffer_t   src;
      gss_buffer_t   *dest;
typedef struct gss_union_name_t {
     gss_mechanism        gss_mech;
     gss_OID            name_type;
     gss_buffer_desc        external_name;
     /*
      * These last two fields are only filled in for mechanism
      * names.
      */
     gss_OID            mech_type;
     gss_name_t        mech_name;
} gss_union_name_desc, *gss_union_name_t;
typedef struct gss_buffer_desc_struct {
        size_t length;
        void FAR *value;
} gss_buffer_desc, FAR *gss_buffer_t;

Upstream-Status: Pending

src/g_canon_name.c +9 -3
@@ -121,11 +121,17 @@ gss_canonicalize_name (OM_uint32 *minor_
         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,
src/g_initialize.c +0 -0
index 82fcce1..200f173 100644

Fix the warning for getuid, geteuid
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]

Upstream-Status: Pending

src/g_initialize.c +1 -0
@@ -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>
src/g_inq_cred.c +0 -0

1) add free if malloc failed for (*mechanisms)->elements
2) g_inq_cred.c: In function 'gss_inquire_cred':
g_inq_cred.c:161:8: warning: passing argument 3 of 'generic_gss_copy_oid' from incompatible pointer type [enabled by default]

Upstream-Status: Pending

src/g_inq_cred.c +4 -2
@@ -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;
       }
src/mglueP.h +0 -0

fix the warning:
warning: implicit declaration of function 'generic_gss_copy_oid_set' [-Wimplicit-function-declaration]

Upstream-Status: Pending

src/mglueP.h +5 -0
@@ -447,6 +447,12 @@ OM_uint32 generic_gss_copy_oid
           gss_OID *        /* new_oid */
           );
   +OM_uint32 generic_gss_copy_oid_set
+       (OM_uint32 *minor_status,    /* minor_status */
+        const gss_OID_set_desc * const oidset,    /* oid */
+        gss_OID_set *new_oidset            /* new_oid */
+       );
+
   OM_uint32 generic_gss_create_empty_oid_set
          (OM_uint32 *,    /* minor_status */
           gss_OID_set *    /* oid_set */
author
#7 lore raw
Quoted 8 lines · Steve Dickson
Quoted 3 lines · Yao Zhao

On 13-01-23 01:21 PM, Steve Dickson wrote:
Could you give me a link where to find it? I couldn't find it at
http://www.citi.umich.edu/projects/nfsv4/linux/libgssglue/

The git tree is at:
git://linux-nfs.org/~steved/libgssglue.git

steved.

HI Steve,

I checked out this tree, the latest commit is from 2009.

which branch you refer to for the 0.5? master?

I didn't see changes.

yao