+1998-10-06 Theodore Ts'o <tytso@rsts-11.mit.edu>
+
+ * 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 <gjking@mit.edu>
* krcp.c (error): Don't call rcmd_stream_write if iamremote is not
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... */
{
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. */
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);
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);