[6789] in Kerberos
Re: solaris 2.4 / getsockname bug
daemon@ATHENA.MIT.EDU (Ed Phillips)
Thu Feb 29 11:13:01 1996
Date: Thu, 29 Feb 1996 10:56:52 -0500 (EST)
From: Ed Phillips <flaregun@UDel.Edu>
To: Victor Dmitri Schoeman <vs0r+@andrew.cmu.edu>
Cc: kerberos@MIT.EDU
In-Reply-To: <MlBByfa00YUy4b62Jw@andrew.cmu.edu>
On Wed, 28 Feb 1996, Victor Dmitri Schoeman wrote:
> I was wondering if anyone has compiled kerberos 5b5 on solaris 2.4. As
> far as I can tell an error with getsockname() is causing krb5_mk_safe
> to fail. Rather than filling out the host's ip address the structure
> is filled with all 0s. Thus when a server attempts to verify the
> sender's address it fails.
>
> As far as I can tell this is a bug which only seems to affect solaris.
> (SunOS 4.1.3 works correctly with this call) Is there a patch for
> kerberos that I am currently missing (or one for solaris I suppose).
> If not, I'll make my own patch and send it in to krb5-bugs to see if
> they'll include it as a workaround (or at least mention of it) in the
> documentation since it took me a couple of days to track down and
> prove what was happening.
>
> I've isolated the incorrect behavior in the following program - which
> fairly closely models the calls kerberos uses to get the ip address.
>
> Under SunOS 4.1.3 it prints out the ip address. Under Solaris 2.4 it
> prints out all 0s. (Even if I take the binary from SunOS and move it
> to Solaris, it still prints out all 0s)
>
> Thanks,
> Dmitri
>
>
> #include <stdio.h>
> #include <sys/types.h>
> #include <sys/socket.h>
> #include <netinet/in.h>
> #include <arpa/inet.h>
>
> main()
> {
> int sockfd;
> struct sockaddr_in cli_addr, serv_addr;
> int i;
>
> memset((char *) &serv_addr,0,sizeof(serv_addr));
> serv_addr.sin_family=AF_INET;
> serv_addr.sin_addr.s_addr=inet_addr("155.157.99.46");
> serv_addr.sin_port = htons(6543);
>
> if((sockfd = socket(AF_INET, SOCK_DGRAM, 0))<0)
> {
> printf("couldn't assign sock\n");
> return;
> }
>
> memset((char *) &cli_addr,0,sizeof(cli_addr));
> cli_addr.sin_family=AF_INET;
>
> if(bind(sockfd, (struct sockaddr *) &cli_addr, sizeof(cli_addr))<0)
> {
> printf("in bind\n");
> return;
> }
> if(connect(sockfd, (struct sockaddr *)&serv_addr, sizeof(serv_addr))==-1)
> {
> printf("couldn't connect");
> return;
> }
> memset((char *) &cli_addr,0,sizeof(cli_addr));
> i=sizeof(cli_addr);
> if(getsockname(sockfd, (struct sockaddr *) &cli_addr,&i)<0)
> {
> printf("couldn't getsockname");
> return;
> }
> printf("hostip = %d.%d.%d.%d\n",cli_addr.sin_addr.S_un.S_un_b.s_b1,
> cli_addr.sin_addr.S_un.S_un_b.s_b2,
> cli_addr.sin_addr.S_un.S_un_b.s_b3,
> cli_addr.sin_addr.S_un.S_un_b.s_b4);
>
> }
>
FYI...
This doesn't work in Solaris 2.3, 2.4, or 2.5.
Ed
+-------------------------------------------------------------------------+
| Ed Phillips <flaregun@udel.edu> University of Delaware (302) 831-6082 |
| Jr Systems Programmer, Network and Systems Services, Info. Technologies |
| Public key footprint: 1C D4 AC C2 A3 D5 97 AA DB 3B D8 85 88 E7 40 B8 |
| Finger flaregun@udel.edu for PGP public key |
+-------------------------------------------------------------------------+