svc_getcaller

svc_getcaller

Post by Madhu Ramachandra » Thu, 19 Sep 2002 10:34:34



all:

i have a question on the ONC RPC call svc_getcaller()
It returns sockaddr_in pointer. Should i call free() on it. i tried and geta
core dump.

 struct sockaddr_in *
     svc_getcaller(xprt)
     SVCXPRT *xprt;

is there any other way to free the sockaddr_in? i am seeing a leak around
this line of code.. Iam using the TI-RPC (ONC RPC implementation on AIX
4.3.x)

regards.

 
 
 

svc_getcaller

Post by Gary R. Hoo » Fri, 20 Sep 2002 08:24:31



> all:

> i have a question on the ONC RPC call svc_getcaller()
> It returns sockaddr_in pointer. Should i call free() on it. i tried and geta
> core dump.

>  struct sockaddr_in *
>      svc_getcaller(xprt)
>      SVCXPRT *xprt;

> is there any other way to free the sockaddr_in? i am seeing a leak around
> this line of code.. Iam using the TI-RPC (ONC RPC implementation on AIX
> 4.3.x)

That macro only looks inside the SVCXPRT structure and returns
the address of a member.  If xprt was allocated somewhere, you
don't want to try to free only part of it; that's invalid.

Usually, if you need to free a returned datum, the man page tells
you (usually...).  In this case, the AIX docs clearly state that
svc_getcaller is macro, and if you look in rpc/svc.h you can
see how it works.  No magic, no allocation.

--
Gary R. Hook / AIX PartnerWorld for Developers / These opinions are MINE
________________________________________________________________________

 
 
 

1. svc_getcaller in Solaris 2 - does it work ?

I'm trying to port an RPC program from Solaris 1 to Solaris 2.  Some of the
routines it provides are a bit sensitive ("DELUSERSFILES" springs to mind
...), so under Solaris 1 I used `svc_getcaller' to check the request was
coming from a privileged port on a trusted machine.  Trying the same thing on
Solaris 2 seems to return junk: svc_getcaller(rqstp->rq_xprt) returns things
like AF_INET port 34224 address 0.0.0.0.

I've tried cc vs. gcc, and running under inetd vs. not.  Can anyone guess from
this what I'm doing wrong ?  Can anyone confirm that this should work ?  Is
there a cleaner way to do this authentication ?

Cheers,

Rob
--
UUCP:   ...!mcsun!uknet!warwick!cudcv   PHONE:  +44 203 523037

Rob McMahon, Computing Services, Warwick University, Coventry CV4 7AL, England

2. Setting Process Resource Limit(s)

3. RPC svc_getcaller() problem 4.x/5.x

4. 100 Mbit Ethernet

5. Where does svc_getcaller live in Solaris 2.2 ?

6. Linux Image and Thumbnail Browsers