This is the mail archive of the libc-hacker@sourceware.cygnus.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

rpc.rusersd in netkit (xdr_utmp problem) (fwd)


Forwarded message:
> From eken.phys.nagoya-u.ac.jp!uehara Fri Jul 31 03:14:08 1998
> Message-Id: <199807310854.RAA16489@eken2.eken.phys.nagoya-u.ac.jp>
> To: dholland@hcs.harvard.edu
> cc: hjl@gnu.org, uehara@eken.phys.nagoya-u.ac.jp
> Subject: rpc.rusersd in netkit (xdr_utmp problem)
> Mime-Version: 1.0 (generated by tm-edit 7.106)
> Content-Type: text/plain; charset=US-ASCII
> Date: Fri, 31 Jul 1998 17:54:08 +0900
> From: Shozo UEHARA <uehara@eken.phys.nagoya-u.ac.jp>
> 
> This is the second report on rpc.rusersd on netkit-rusers-0.11.
> 
> I sent you the first report on Fri, 21 Nov 1997, which is 
> 
> >>>>> ">>" == Shozo UEHARA <uehara@eken.phys.nagoya-u.ac.jp> writes:
> 
> >>> This is a report on rpc.rusersd on netkit-ruseres-0.11.
> >>> I found a problem as
> 
> >>>   "rpc.ruserd cannot answer informations on users 
> >>>           if a user whose account has 8 chars. is logging in."
> >>>  (If only users whose account has less than 8 chars are logging in,
> >>>   it is OK.)
> 
> 
> >>>  clnt_call() in rusers.c returns an error. "RPC: Remote system error"
> 
> >>> Circum:   libc.5.4.38, gcc-2.7.2.3, linux-2.0.31(same with 29,30)
> 
> 
> And now I think the above problem seems to be caused by a function
> "xdr_utmp" in rusers.x in linux libc source. 
> I'm now using libc-5.4.46.
> 
> 
> The function xdr_utmp() has such a code:
> 
>  xdr_utmp(xdrs, objp)
>         XDR *xdrs;
> 	struct ru_utmp *objp;
>  {
>         (snip)
>                char *ptr;
>         (snip)
>                ptr = objp->ut_name;
>                if (!xdr_string (xdrs, &ptr, sizeof (objp->ut_name))) {
>                        return (FALSE);
>                }
> 
> Since "objp->ut_name" is not in general a NULL terminated string
> (especially for an account of length 8!) and xdr_string() deals with
> "C strings", i.e., arrays of bytes that are terminated by a NULL
> character, xdr_string() returns FALSE (when account has 8 chars.)!
> 
> The similar code is in the treatment of objp->ut_host: 
> 
> sizeof(objp->ut_host) = 16 and hence if someone login from a remote
> host whose FQDN is more than 16 chars and the linux platform does not
> have an alias for that host, then rpc.rusersd returns FALSE!
> 
> So I think in order to rpc.rusersd work properly, xdr_utmp() in
> rusers.x should be fixed properly, (change xdr_string for xdr_bytes)
> 
> I'll also send this report to hjl@gnu.org.
> 
> best regards
> 
>                       UEHARA
> 
>                       Nagoya University, Japan
> 

Ulrich, here is a patch for glibc 2.0. I think glibc 2.1 is the same.

Thanks.


-- 
H.J. Lu (hjl@gnu.org)
---
Index: sunrpc/rpcsvc/rusers.x
===================================================================
RCS file: /home/work/cvs/gnu/glibc-2.0/sunrpc/rpcsvc/rusers.x,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 rusers.x
--- rusers.x	1997/09/19 18:10:45	1.1.1.1
+++ rusers.x	1998/08/03 15:29:03
@@ -140,16 +140,20 @@
 %	if (xdrs->x_op != XDR_FREE)
 %	{
 %		char *ptr;
+%		unsigned int size;
 %		ptr = objp->ut_line;
-%		if (!xdr_string (xdrs, &ptr, sizeof (objp->ut_line))) {
+%		size = sizeof (objp->ut_line);
+%		if (!xdr_bytes (xdrs, &ptr, &size, size)) {
 %			return (FALSE);
 %		}
 %		ptr = objp->ut_name;
-%		if (!xdr_string (xdrs, &ptr, sizeof (objp->ut_name))) {
+%		size = sizeof (objp->ut_name);
+%		if (!xdr_bytes (xdrs, &ptr, &size, size)) {
 %			return (FALSE);
 %		}
 %		ptr = objp->ut_host;
-%		if (!xdr_string (xdrs, &ptr, sizeof (objp->ut_host))) {
+%		size = sizeof (objp->ut_host);
+%		if (!xdr_bytes (xdrs, &ptr, &size, size)) {
 %			return (FALSE);
 %		}
 %	}


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]