Bug 27816

Summary: rpcgen -b generates server code which does not compile
Product: Base System Reporter: Jean-Luc.Richier <Jean-Luc.Richier>
Component: miscAssignee: Martin Blapp <mbr>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: 5.0-CURRENT   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
file.diff
none
file.diff none

Description Jean-Luc.Richier 2001-06-01 16:40:02 UTC
	FreeBSD5.0-current uses know TI-RPC rpc library. Therefore rpcgen
	should generate TI-RPC code.
	But currently rpcgen generate protmap code by default, and the code
	for servers generated for TI-RPC (rpcgen -b) does not compile,
	for it reference TLI transport functions and not socket transport.

Fix: Below is a patch to generate correct code.
Some remarks
1/ I kept the old TI-transport code, and added an internal flag
   tirpc_socket (with no option to clear it) to control the generation.
2/ I reversed the -b flag: now TI-RPC is the default.
3/ Even if on many systems option -I (inetd support) is always on,
   I modified rpcgen to generate different code with option -I or
   without (simpler code). So explicit -I is needed for inetd support.
   This choice can be argued.
4/ There are a few corrections in rpcgen.1 and usage function to conform
   to the code.
5/ I kept a support for ``transport monitors'' and the NLSPROVIDER env
   variable, even if the use is not clear in non TLI stream based systems.

int nonfatalerrors;	/* errors */
#if defined(__FreeBSD__) || defined(__NetBSD__)
! int inetdflag = 0;	/* Support for inetd  is now the default */
  #else
  int inetdflag;	/* Support for inetd  is now the default */
  #endif
--- 124,131 ----
  
  int nonfatalerrors;	/* errors */
  #if defined(__FreeBSD__) || defined(__NetBSD__)
! int inetdflag = 0;
! int tirpc_socket = 1;	/* TI-RPC on socket, no TLI library */
  #else
  int inetdflag;	/* Support for inetd  is now the default */
  #endif
***************
How-To-Repeat: 	take a rpcsvc file, compile it:
	% cp /usr/include/rpcsvc/rnusers.x .
	% rpcgen -b rnusers.x 
	% cc -o serv rnusers_svc.c 
rnusers_svc.c: In function `closedown':
rnusers_svc.c:58: storage size of `tinfo' isn't known
rnusers_svc.c:60: `T_CLTS' undeclared (first use in this function)
rnusers_svc.c:60: (Each undeclared identifier is reported only once
rnusers_svc.c:60: for each function it appears in.)
rnusers_svc.c: In function `main':
rnusers_svc.c:271: `FMNAMESZ' undeclared (first use in this function)
rnusers_svc.c:271: size of array `mname' has non-integer type
rnusers_svc.c:273: `I_LOOK' undeclared (first use in this function)
rnusers_svc.c:290: `T_DATAXFER' undeclared (first use in this function)
rnusers_svc.c:293: `I_POP' undeclared (first use in this function)
rnusers_svc.c:293: `I_PUSH' undeclared (first use in this function)
Comment 1 Martin Blapp freebsd_committer freebsd_triage 2002-07-12 00:11:00 UTC
State Changed
From-To: open->analyzed

I'll work on this. 


Comment 2 Martin Blapp freebsd_committer freebsd_triage 2002-07-12 00:11:00 UTC
Responsible Changed
From-To: freebsd-bugs->mbr

I'll work on this.
Comment 3 Alfred Perlstein freebsd_committer freebsd_triage 2002-07-14 18:54:43 UTC
State Changed
From-To: analyzed->closed

submitted patch has been applied, thank you.