C++ VFS compilation problem

Constantine Vetoshev gepardcv at yahoo.com
Fri Jul 6 19:25:40 GMT 2007


Greetings all---

I actually submitted this to Bugzilla as 4708 (https://bugzilla.samba.org/show_bug.cgi?id=4708), but I've done a bit more digging since then.

In brief, I found two header file problems which cause compilation problems for VFS plugins written in C++. Both problems remain in the current v3-0 head branch.

1. rpc_netlogon.h has two typedefs which C++ doesn't like, since it automatically typedefs structs:

line 1151: typedef struct NET_R_DSR_GETDCNAME NET_R_DSR_GETDCNAMEEX;
line 1170: typedef struct NET_R_DSR_GETDCNAME NET_R_DSR_GETDCNAMEEX2;

I searched the source tree, and I don't think they are being used at all, so it should be safe to delete them.

2. struct SERVICE_STATUS is defined in two places: rpc_svcctl.h and librpc/gen_ndr/svcctl.h. At first, I thought I might be able to rewire the order of includes to just keep one definition, but unfortunately, the two structs have one different field: win32_exit_code is a WERROR in rpc_svcctl.h and a uint32_t in svcctl.h. Hmmm. I don't know the history behind this, but it just doesn't seem right to have the same name for a struct which does almost, but not quite, the same thing. Plain C doesn't complain about this because one is typedefed and the other is not.

For now, I just added an #ifndef __cplusplus directive around the definition in rpc_svcctl.h. It's obviously the wrong thing to do, but at least I can continue working. What is the right fix?

I'm attaching a patch.

Best regards,
CV


diff --git a/source/include/rpc_netlogon.h b/source/include/rpc_netlogon.h
index 9407093..a6eac3d 100644
--- a/source/include/rpc_netlogon.h
+++ b/source/include/rpc_netlogon.h
@@ -1147,9 +1147,6 @@ typedef struct net_q_dsr_getdcnameex {
        uint32 flags;
 } NET_Q_DSR_GETDCNAMEEX;

-/* NET_R_DSR_GETDCNAMEEX */
-typedef struct NET_R_DSR_GETDCNAME NET_R_DSR_GETDCNAMEEX;
-
 /* NET_Q_DSR_GETDCNAMEEX2 */
 typedef struct net_q_dsr_getdcnameex2 {
        uint32 ptr_server_unc;
@@ -1166,9 +1163,6 @@ typedef struct net_q_dsr_getdcnameex2 {
        uint32 flags;
 } NET_Q_DSR_GETDCNAMEEX2;

-/* NET_R_DSR_GETDCNAMEEX */
-typedef struct NET_R_DSR_GETDCNAME NET_R_DSR_GETDCNAMEEX2;
-
 /* NET_Q_DSR_GESITENAME */
 typedef struct net_q_dsr_getsitename {
        uint32 ptr_computer_name;
diff --git a/source/include/rpc_svcctl.h b/source/include/rpc_svcctl.h
index f4bf509..163e58e 100644
--- a/source/include/rpc_svcctl.h
+++ b/source/include/rpc_svcctl.h
@@ -123,6 +123,7 @@

 /* utility structures for RPCs */

+#ifndef __cplusplus
 typedef struct {
        uint32 type;
        uint32 state;
@@ -132,6 +133,7 @@ typedef struct {
        uint32 check_point;
        uint32 wait_hint;
 } SERVICE_STATUS;
+#endif

 typedef struct {
        SERVICE_STATUS status;





       
____________________________________________________________________________________
Need a vacation? Get great deals
to amazing places on Yahoo! Travel.
http://travel.yahoo.com/


More information about the samba-technical mailing list