diff mbox

[Libtirpc-devel,libtirpc] fix build w/gssapi disabled

Message ID 554B98E9.4040601@RedHat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Steve Dickson May 7, 2015, 4:55 p.m. UTC
On 05/07/2015 12:33 PM, Thorsten Kukuk wrote:
>>> > > Else here is my patch:
>> > Is this patch addition to Mike's patch?
> No, replacing it except the struct part.
So this is the complete patch..... 

Look reasonable??

steved.

From 621856e44814e87cbc9e2442e3467c88cb8f5a95 Mon Sep 17 00:00:00 2001
From: Thorsten Kukuk <kukuk@suse.de>
Date: Thu, 7 May 2015 12:50:48 -0400
Subject: [PATCH] Fix Build w/gssapi disabled

Signed-off-by: Steve Dickson <steved@redhat.com>
---
 .gitignore                |  1 +
 Makefile.am               |  4 +++-
 configure.ac              |  3 ++-
 tirpc/rpc/rpc.h           |  4 +++-
 tirpc/rpc/svc_auth.h      |  8 ++++++++
 tirpc/tirpc-features.h    | 11 +++++++++++
 tirpc/tirpc-features.h.in | 10 ++++++++++
 7 files changed, 38 insertions(+), 3 deletions(-)
 create mode 100644 tirpc/tirpc-features.h
 create mode 100644 tirpc/tirpc-features.h.in

Comments

Thorsten Kukuk May 7, 2015, 6:12 p.m. UTC | #1
On Thu, May 07, Steve Dickson wrote:

> On 05/07/2015 12:33 PM, Thorsten Kukuk wrote:
> >>> > > Else here is my patch:
> >> > Is this patch addition to Mike's patch?
> > No, replacing it except the struct part.
> So this is the complete patch..... 
> 
> Look reasonable??

Some corrections:

> diff --git a/tirpc/rpc/svc_auth.h b/tirpc/rpc/svc_auth.h
> index 44b38bf..4b9b0f1 100644
> --- a/tirpc/rpc/svc_auth.h
> +++ b/tirpc/rpc/svc_auth.h

> @@ -63,8 +69,10 @@ typedef struct SVCAUTH {
>  		int     (*svc_ah_destroy)(struct SVCAUTH *);
>  		} *svc_ah_ops;
>  	caddr_t svc_ah_private;
> +#ifdef HAVE_RPCSEC_GSS
>  	svc_rpc_gss_parms_t svc_gss_params;
>  	rpc_gss_rawcred_t raw_cred;
> +#endif
>  } SVCAUTH;
>  

This needs to be "#ifdef HAVE_GSSAPI", HAVE_RPCSEC_GSS
will never be defined if the header is used outside of
libtirpc sources

> diff --git a/tirpc/tirpc-features.h b/tirpc/tirpc-features.h
> new file mode 100644
> index 0000000..7aec775
> --- /dev/null
> +++ b/tirpc/tirpc-features.h


You should not tirpc/tirpc-features.h, only tirpc/tirpc-features.h.in
tirpc/tirpc-features.h will be created by configure, like libtirpc.pc
and config.h.

  Thorsten
Steve Dickson May 7, 2015, 8:04 p.m. UTC | #2
On 05/07/2015 02:12 PM, Thorsten Kukuk wrote:
> On Thu, May 07, Steve Dickson wrote:
> 
>> On 05/07/2015 12:33 PM, Thorsten Kukuk wrote:
>>>>>>> Else here is my patch:
>>>>> Is this patch addition to Mike's patch?
>>> No, replacing it except the struct part.
>> So this is the complete patch..... 
>>
>> Look reasonable??
> 
> Some corrections:
> 
>> diff --git a/tirpc/rpc/svc_auth.h b/tirpc/rpc/svc_auth.h
>> index 44b38bf..4b9b0f1 100644
>> --- a/tirpc/rpc/svc_auth.h
>> +++ b/tirpc/rpc/svc_auth.h
> 
>> @@ -63,8 +69,10 @@ typedef struct SVCAUTH {
>>  		int     (*svc_ah_destroy)(struct SVCAUTH *);
>>  		} *svc_ah_ops;
>>  	caddr_t svc_ah_private;
>> +#ifdef HAVE_RPCSEC_GSS
>>  	svc_rpc_gss_parms_t svc_gss_params;
>>  	rpc_gss_rawcred_t raw_cred;
>> +#endif
>>  } SVCAUTH;
>>  
> 
> This needs to be "#ifdef HAVE_GSSAPI", HAVE_RPCSEC_GSS
> will never be defined if the header is used outside of
> libtirpc sources
When I do that I get the following errors when the gssapi is
enabled:

svc_auth_gss.c: In function 'rpc_gss_getcred':
svc_auth_gss.c:920:7: error: 'SVCAUTH' has no member named 'raw_cred'
   auth->raw_cred = gd->rcred;
       ^
svc_auth_gss.c:921:7: error: 'SVCAUTH' has no member named 'raw_cred'
   auth->raw_cred.service = _rpc_gss_svc_to_service(gd->sec.svc);
       ^
svc_auth_gss.c:922:32: error: 'SVCAUTH' has no member named 'raw_cred'
   (void)rpc_gss_num_to_qop(auth->raw_cred.mechanism, gd->sec.qop,
                                ^
svc_auth_gss.c:923:12: error: 'SVCAUTH' has no member named 'raw_cred'
       &auth->raw_cred.qop);
            ^
svc_auth_gss.c:924:17: error: 'SVCAUTH' has no member named 'raw_cred'
   *rcred = &auth->raw_cred;

I guess something is still broken in the configure.ac...
Looking into it.

> 
>> diff --git a/tirpc/tirpc-features.h b/tirpc/tirpc-features.h
>> new file mode 100644
>> index 0000000..7aec775
>> --- /dev/null
>> +++ b/tirpc/tirpc-features.h
> 
> 
> You should not tirpc/tirpc-features.h, only tirpc/tirpc-features.h.in
> tirpc/tirpc-features.h will be created by configure, like libtirpc.pc
> and config.h.
Ok... I'll add tirpc/tirpc-features.h to the .gitignore

Thanks again!

steved.


--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Steve Dickson May 7, 2015, 8:12 p.m. UTC | #3
On 05/07/2015 04:04 PM, Steve Dickson wrote:
>> > This needs to be "#ifdef HAVE_GSSAPI", HAVE_RPCSEC_GSS
>> > will never be defined if the header is used outside of
>> > libtirpc sources
> When I do that I get the following errors when the gssapi is
> enabled:
> 
> svc_auth_gss.c: In function 'rpc_gss_getcred':
> svc_auth_gss.c:920:7: error: 'SVCAUTH' has no member named 'raw_cred'
>    auth->raw_cred = gd->rcred;
>        ^
Pilot error on my part... #ifdef HAVE_GSSAPI does work.

Sorry for the noise.

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

Patch

diff --git a/.gitignore b/.gitignore
index b7814a3..4e224c3 100644
--- a/.gitignore
+++ b/.gitignore
@@ -34,6 +34,7 @@  libtirpc.pc
 lib*.a
 src/libtirpc.la
 src/libtirpc_la-*.lo
+tirpc/stamp-h2
 # generic editor backup et al
 *~
 .stgitmail.txt
diff --git a/Makefile.am b/Makefile.am
index 2bf725c..2bce3b0 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -4,9 +4,11 @@  ACLOCAL_AMFLAGS = -I m4
 noinst_HEADERS	       = tirpc/reentrant.h \
 			 tirpc/getpeereid.h \
 			 tirpc/libc_private.h \
-			 tirpc/un-namespace.h
+			 tirpc/un-namespace.h \
+			 tirpc/tirpc-features.h.in
 
 nobase_include_HEADERS = tirpc/netconfig.h \
+			 tirpc/tirpc-features.h \
 			 tirpc/rpcsvc/crypt.x \
 			 tirpc/rpcsvc/crypt.h \
 			 tirpc/rpc/xdr.h \
diff --git a/configure.ac b/configure.ac
index 711b054..290c635 100644
--- a/configure.ac
+++ b/configure.ac
@@ -10,6 +10,7 @@  AC_ARG_ENABLE(gssapi,
 AM_CONDITIONAL(GSS, test "x$enable_gssapi" = xyes)
 
 if test "x$enable_gssapi" = xyes; then
+	AC_DEFINE([HAVE_GSSAPI], [1], [Define to 1 if GSSAPI is enabled])
 	GSSAPI_CFLAGS=`krb5-config --cflags gssapi`
 	GSSAPI_LIBS=`krb5-config --libs gssapi`
 	AC_SUBST([GSSAPI_CFLAGS])
@@ -41,7 +42,7 @@  AC_ARG_ENABLE(symvers,
 AM_CONDITIONAL(SYMVERS, test "x$enable_symvers" = xyes)
 
 AC_PROG_CC
-AC_CONFIG_HEADERS([config.h])
+AC_CONFIG_HEADERS([config.h tirpc/tirpc-features.h])
 AC_PROG_LIBTOOL
 AC_HEADER_DIRENT
 AC_PREFIX_DEFAULT(/usr)
diff --git a/tirpc/rpc/rpc.h b/tirpc/rpc/rpc.h
index 1dbb391..8f37454 100644
--- a/tirpc/rpc/rpc.h
+++ b/tirpc/rpc/rpc.h
@@ -35,6 +35,8 @@ 
 #ifndef _TIRPC_RPC_H
 #define _TIRPC_RPC_H
 
+#include <tirpc-features.h>
+
 #include <rpc/types.h>		/* some typedefs */
 #include <sys/socket.h>
 #include <netinet/in.h>
@@ -60,7 +62,7 @@ 
 #include <rpc/auth_des.h>	/* protocol for des style cred */
 #endif /* HAVE_AUTHDES */
 
-#ifdef HAVE_RPCSEC_GSS
+#ifdef HAVE_GSSAPI
 #include <rpc/auth_gss.h>   /* RPCSEC_GSS */
 #endif
 
diff --git a/tirpc/rpc/svc_auth.h b/tirpc/rpc/svc_auth.h
index 44b38bf..4b9b0f1 100644
--- a/tirpc/rpc/svc_auth.h
+++ b/tirpc/rpc/svc_auth.h
@@ -41,6 +41,10 @@ 
 #ifndef _RPC_SVC_AUTH_H
 #define _RPC_SVC_AUTH_H
 
+#include <tirpc-features.h>
+
+#ifdef HAVE_GSSAPI
+
 #include <rpc/rpcsec_gss.h>
 
 typedef struct {
@@ -51,6 +55,8 @@  typedef struct {
 	u_int			seq_num;
 } svc_rpc_gss_parms_t;
 
+#endif /* HAVE_GSSAPI */
+
 /*
  * Interface to server-side authentication flavors.
  */
@@ -63,8 +69,10 @@  typedef struct SVCAUTH {
 		int     (*svc_ah_destroy)(struct SVCAUTH *);
 		} *svc_ah_ops;
 	caddr_t svc_ah_private;
+#ifdef HAVE_RPCSEC_GSS
 	svc_rpc_gss_parms_t svc_gss_params;
 	rpc_gss_rawcred_t raw_cred;
+#endif
 } SVCAUTH;
 
 #define SVCAUTH_WRAP(auth, xdrs, xfunc, xwhere) \
diff --git a/tirpc/tirpc-features.h b/tirpc/tirpc-features.h
new file mode 100644
index 0000000..7aec775
--- /dev/null
+++ b/tirpc/tirpc-features.h
@@ -0,0 +1,11 @@ 
+/* tirpc/tirpc-features.h.  Generated from tirpc-features.h.in by configure.  */
+#ifndef _TIRPC_FEATURES_H
+#define _TIRPC_FEATURES_H
+
+/* Define to 1 if DES authentication is enabled */
+/* #undef HAVE_AUTHDES */
+
+/* Define to 1 if GSSAPI is enabled */
+/* #undef HAVE_GSSAPI */
+
+#endif /* _TIRPC_FEATURES_H */
diff --git a/tirpc/tirpc-features.h.in b/tirpc/tirpc-features.h.in
new file mode 100644
index 0000000..72e18bc
--- /dev/null
+++ b/tirpc/tirpc-features.h.in
@@ -0,0 +1,10 @@ 
+#ifndef _TIRPC_FEATURES_H
+#define _TIRPC_FEATURES_H
+
+/* Define to 1 if DES authentication is enabled */
+#undef HAVE_AUTHDES
+
+/* Define to 1 if GSSAPI is enabled */
+#undef HAVE_GSSAPI
+
+#endif /* _TIRPC_FEATURES_H */