From: Theodore Tso Date: Thu, 8 Oct 1998 05:51:33 +0000 (+0000) Subject: krshd.c (doit): Apply ghudson's patch so that rshd passes the port X-Git-Tag: krb5-1.1-beta1~526 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=699a01672d6679516dc7ba6729f4f43ac7e058b0;p=krb5.git krshd.c (doit): Apply ghudson's patch so that rshd passes the port numbers for the local and foreign addresses so that the V4 encrypted RCP will work correctly. [krb5-appl/638] v4rcp.c (answer_auth): Apply ghudson's patch so that if KRB5LOCALPORT and KRB5REMOTEPORT are set, use them to set the foreign and local ports so that encrypted rcp for the same machine. [krb5-appl/638] git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@10971 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/appl/bsd/ChangeLog b/src/appl/bsd/ChangeLog index cee882741..6eaa52942 100644 --- a/src/appl/bsd/ChangeLog +++ b/src/appl/bsd/ChangeLog @@ -1,3 +1,13 @@ +1998-10-06 Theodore Ts'o + + * krshd.c (doit): Apply ghudson's patch so that rshd passes the + port numbers for the local and foreign addresses so that + the V4 encrypted RCP will work correctly. [krb5-appl/638] + * v4rcp.c (answer_auth): Apply ghudson's patch so that if + KRB5LOCALPORT and KRB5REMOTEPORT are set, use them to set + the foreign and local ports so that encrypted rcp for the + same machine. [krb5-appl/638] + Sat Aug 15 00:01:15 1998 Geoffrey King * krcp.c (error): Don't call rcmd_stream_write if iamremote is not diff --git a/src/appl/bsd/krshd.c b/src/appl/bsd/krshd.c index 164dd6d55..6f9468e80 100644 --- a/src/appl/bsd/krshd.c +++ b/src/appl/bsd/krshd.c @@ -443,8 +443,10 @@ char term[64] = "TERM=network"; char path_rest[] = RPATH; char remote_addr[64]; /* = "KRB5REMOTEADDR=" */ +char remote_port[64]; /* = "KRB5REMOTEPORT=" */ char local_addr[64]; /* = "KRB5LOCALADDR=" */ -#define ADDRPAD 0,0 /* remoteaddr, localaddr */ +char local_port[64]; /* = "KRB5LOCALPORT=" */ +#define ADDRPAD 0,0,0,0 #define KRBPAD 0 /* KRB5CCNAME, optional */ /* The following include extra space for TZ and MAXENV pointers... */ @@ -1348,14 +1350,22 @@ if(port) { int i; - /* these two are covered by ADDRPAD */ + /* these four are covered by ADDRPAD */ sprintf(local_addr, "KRB5LOCALADDR=%s", inet_ntoa(localaddr.sin_addr)); for (i = 0; envinit[i]; i++); envinit[i] =local_addr; + sprintf(local_port, "KRB5LOCALPORT=%d", ntohs(localaddr.sin_port)); + for (; envinit[i]; i++); + envinit[i] =local_port; + sprintf(remote_addr, "KRB5REMOTEADDR=%s", inet_ntoa(fromp->sin_addr)); for (; envinit[i]; i++); envinit[i] =remote_addr; + + sprintf(remote_port, "KRB5REMOTEPORT=%d", ntohs(fromp->sin_port)); + for (; envinit[i]; i++); + envinit[i] =remote_port; } /* If we do anything else, make sure there is space in the array. */ diff --git a/src/appl/bsd/v4rcp.c b/src/appl/bsd/v4rcp.c index 4ddef36da..36754dead 100644 --- a/src/appl/bsd/v4rcp.c +++ b/src/appl/bsd/v4rcp.c @@ -1003,7 +1003,10 @@ answer_auth() local.sin_addr.s_addr = inet_addr(envaddr); #endif local.sin_family = AF_INET; - local.sin_port = 0; + if (envaddr = getenv("KRB5LOCALPORT")) + local.sin_port = htons(atoi(envaddr)); + else + local.sin_port = 0; } else { fprintf(stderr, "v4rcp: couldn't get local address (KRB5LOCALADDR)\n"); exit(1); @@ -1015,7 +1018,10 @@ answer_auth() foreign.sin_addr.s_addr = inet_addr(envaddr); #endif foreign.sin_family = AF_INET; - foreign.sin_port = 0; + if (envaddr = getenv("KRB5REMOTEPORT")) + foreign.sin_port = htons(atoi(envaddr)); + else + foreign.sin_port = 0; } else { fprintf(stderr, "v4rcp: couldn't get remote address (KRB5REMOTEADDR)\n"); exit(1);