Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 5 Nov 1995 13:33:19 +0100 (MET)
From:      grog@lemis.de (Greg Lehey)
To:        joerg_wunsch@uriah.heep.sax.de
Cc:        hackers@freebsd.org (FreeBSD Hackers)
Subject:   Re: RPC oddities
Message-ID:  <199511051233.NAA12443@allegro.lemis.de>
In-Reply-To: <199511041821.TAA02527@uriah.heep.sax.de> from "J Wunsch" at Nov 4, 95 07:21:06 pm

next in thread | previous in thread | raw e-mail | index | archive | help
J Wunsch writes:
> 
> <rpc/rpc.h> includes definitions for several constants that are inside
> enum's.  To the contrary, <nfs/rpcv2.h> #define's just the very same
> constants.  The result is that the compiler sees something like:
> 
> enum auth_stat {
>         AUTH_OK=0,
>          
> 
>         1 =1,                    
>         AUTH_REJECTEDCRED=2,             
>         3 =3,                    
>         AUTH_REJECTEDVERF=4,             
>         5 =5,                    
>          
> 
>         AUTH_INVALIDRESP=6,              
>         AUTH_FAILED=7                    
> };
> 
> or even worse:
> 
> enum clnt_stat {
>         RPC_SUCCESS=0,                   
>          
> 
>         RPC_CANTENCODEARGS=1,            
>         RPC_CANTDECODERES=2,             
>         RPC_CANTSEND=3,                  
>         RPC_CANTRECV=4,                  
>         RPC_TIMEDOUT=5,                  
>          
> 
>         RPC_VERSMISMATCH=6,              
>         RPC_AUTHERROR=7,                 
>         1 =8,            
>         RPC_PROGVERSMISMATCH=9,          
>         3 =10,           
> ...
> };
> 
> 
> What would be the correct way to resolve the conflicts?

How about a series of:

/* Authentication failures */
#undef	AUTH_BADCRED	1
#undef	AUTH_REJECTCRED	2
#undef	AUTH_BADVERF	3
#undef	AUTH_REJECTVERF	4
#undef	AUTH_TOOWEAK	5		/* Give em wheaties */

If you're really paranoid, you could change that to

#ifdef AUTH_BADCRED
# if AUTH_BADCRED != 1
#  error incorrect redefinition of AUTH_BADCRED
#endif
#undef AUTH_BADCRED
#endif
#ifdef AUTH_REJECTCRED
# if AUTH_REJECTCRED != 2
#  error incorrect redefinition of AUTH_REJECTCRED
#endif
#undef AUTH_REJECTCRED
#endif
#ifdef AUTH_BADVERF
# if AUTH_BADVERF != 3
#  error incorrect redefinition of AUTH_BADVERF
#endif
#undef AUTH_BADVERF
#endif
#ifdef AUTH_REJECTVERF
# if AUTH_REJECTVERF != 4
#  error incorrect redefinition of AUTH_REJECTVERF
#endif
#undef AUTH_REJECTVERF
#endif
#ifdef AUTH_TOOWEAK
# if AUTH_TOOWEAK != 5
#  error incorrect redefinition of AUTH_TOOWEAK
#endif
#undef AUTH_TOOWEAK
#endif		/* Give em wheaties */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199511051233.NAA12443>