Subject: bin/21265: rpcgen produces wrong code
To: None <>
From: None <>
List: netbsd-bugs
Date: 04/22/2003 21:17:20
>Number:         21265
>Category:       bin
>Synopsis:       rpcgen produces wrong code
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Apr 22 21:18:00 UTC 2003
>Originator:     Nils O. Selåsdal
>Release:        1.6.1
NetBSD netbsd 1.6.1 NetBSD 1.6.1 (GENERIC) #0: Tue Apr  8 12:05:52 UTC 2003 i386

rpcgen seems to produce bad output for the server stub.
the server stub tries to call the function_version(..) but it should really
call function_version_svc(..). which in the headerfile generated from the .x file has the right prototype. function(..) is what the client is supposed to call.
given a simple .x file like:
program H2VXWPROG
    version H2VXWVERS
        int SENDSIGNAL(int)  = 1;
    } = 1;
} = 0x20406091;

  rpcgen   -h -o h2vxw.h h2vxw.x 
  the header file will tell that the signature for the server function should be:
  extern  int *sendsignal_1_svc(int *, struct svc_req *);

  rpcgen -m -o h2vxw_svc.c h2vxw.x
  for making the server stub will include "h2vxw.h"
  and do the following:
                xdr_argument = xdr_int;
                xdr_result = xdr_int;
                local = (char *(*)())sendsignal_1;
  now, in the header file sendsignal_1 is declared as:
  extern  int *sendsignal_1(int *, CLIENT *);
  clearly wrong. it should call the
  extern  int *sendsignal_1_svc(int *, struct svc_req *);