Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 12 Mar 2001 17:35:29 -0800 (PST)
From:      Jim.Pirzyk@disney.com
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   bin/25757: rcp does not handle logins with a '.' in them
Message-ID:  <200103130135.f2D1ZTH06033@snoopy.fan.fa.disney.com>

next in thread | raw e-mail | index | archive | help

>Number:         25757
>Category:       bin
>Synopsis:       rcp does not handle logins with a '.' in it
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Mar 12 17:40:01 PST 2001
>Closed-Date:
>Last-Modified:
>Originator:     Jim Pirzyk
>Release:        FreeBSD 4.2-RELEASE i386
>Organization:
>Environment:

	FreeBSD 4.2-RELEASE

>Description:

	If you use rcp with a login name, that login name has a '.' in it, rcp
	will fail, but returns a 0 error code.

>How-To-Repeat:

	touch /tmp/junk
	rcp Jim.Pirzyk@localhost:/tmp/junk /tmp/junk2

>Fix:

	The following fix handles both problems,
		a) returns non zero when the login name is bad.
		b) allows a '.' in the login name

*** ./bin/rcp/rcp.c.orig	Thu Feb 24 13:21:15 2000
--- ./bin/rcp/rcp.c	Mon Mar 12 17:28:50 2001
***************
*** 308,315 ****
  				suser = argv[i];
  				if (*suser == '\0')
  					suser = pwd->pw_name;
! 				else if (!okname(suser))
  					continue;
  				(void)snprintf(bp, len,
  				    "%s %s -l %s -n %s %s '%s%s%s:%s'",
  				    _PATH_RSH, host, suser, cmd, src,
--- 308,317 ----
  				suser = argv[i];
  				if (*suser == '\0')
  					suser = pwd->pw_name;
! 				else if (!okname(suser)) {
! 					++errs;
  					continue;
+ 				}
  				(void)snprintf(bp, len,
  				    "%s %s -l %s -n %s %s '%s%s%s:%s'",
  				    _PATH_RSH, host, suser, cmd, src,
***************
*** 389,396 ****
  			suser = argv[i];
  			if (*suser == '\0')
  				suser = pwd->pw_name;
! 			else if (!okname(suser))
  				continue;
  		}
  		len = strlen(src) + CMDNEEDS + 20;
  		if ((bp = malloc(len)) == NULL)
--- 391,400 ----
  			suser = argv[i];
  			if (*suser == '\0')
  				suser = pwd->pw_name;
! 			else if (!okname(suser)) {
! 				++errs;
  				continue;
+ 			}
  		}
  		len = strlen(src) + CMDNEEDS + 20;
  		if ((bp = malloc(len)) == NULL)
*** ./bin/rcp/util.c.orig	Mon Mar 12 17:14:08 2001
--- ./bin/rcp/util.c	Mon Mar 12 17:29:38 2001
***************
*** 98,104 ****
  		c = *cp;
  		if (c & 0200)
  			goto bad;
! 		if (!isalpha(c) && !isdigit(c) && c != '_' && c != '-')
  			goto bad;
  	} while (*++cp);
  	return (1);
--- 98,104 ----
  		c = *cp;
  		if (c & 0200)
  			goto bad;
! 		if (!isalpha(c) && !isdigit(c) && c != '_' && c != '-' &&  c != '.')
  			goto bad;
  	} while (*++cp);
  	return (1);
>Release-Note:
>Audit-Trail:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




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