From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fee84,64f5d783309d3695 X-Google-Attributes: gidfee84,public X-Google-ArrivalTime: 1995-01-11 19:11:50 PST Path: nntp.gmd.de!newsserver.jvnc.net!nntpserver.pppl.gov!princeton!gw1.att.com!fnnews.fnal.gov!usenet.eel.ufl.edu!news.mathworks.com!hookup!olivea!uunet!news.iij.ad.jp!wnoc-tyo-news!spinnews!news.dec-j!jrd.dec.com!mets86.mse.tay.dec.com!jac.zko.dec.com!batman!swr From: swr@batman.unx.dec.com (Scott Ruch) Newsgroups: comp.unix.osf.osf1 Subject: Re: Finding out LAT source name Date: 12 Jan 1995 03:11:50 GMT Organization: Digital Equipment Corporation Message-ID: <3f26lm$6to@jac.zko.dec.com> References: <3eunql$n3q@ulowell.uml.edu> NNTP-Posting-Host: batman.unx.dec.com X-Newsreader: TIN [version 1.2 PL2] Brian 'Doc' O'Neill (oneill@cs.uml.edu) wrote: : I'm in the process of porting some shadow password stuff (John F. Haugh II's : implementation) to OSF/1 V3.0 on the Alpha, and noticed that by default : OSF/1 doesn't log the source LAT host when a person logs in, nor can I find : the routines which can get them which were under Ultrix. Does anyone know : how to determine the source host under OSF/1?? The following example program does what you want and more. Note that in V3.2, the LAT server / port is now saved in utmp/wtmp by the login process. For other useful examples, check /usr/examples/lat/. /* * For LAT on DEC OSF/1 V3.0 and later. * * The following code can be used to determine what the server and port names * are for incoming LAT connections as well as host-initiated connections * (application ports). * * The program takes a LAT tty as an argument 'show_port tty' and displays * the info for that tty. The functionality here is very similar to the * 'latcp -d -P -p' command. */ #include #include #include #include main(argc, argv) int argc; char **argv; { int fd; char tty[80]; struct stat statbuf; lats_info port; struct strioctl strioctl; if (argc < 2) { printf("Usage: show_port tty\n"); exit(-1); } if ( (fd = open("/dev/streams/lat", 2)) < 0 ) { perror("/dev/streams/lat"); exit(-1); } bzero(&port, sizeof(lats_info)); bzero(&statbuf, sizeof(statbuf)); bzero(tty, 80); if ( strncmp(argv[1], "tty", 3) == 0 ) strcpy(tty, "/dev/"); /* BSD style LAT tty = /dev/ttyWX */ else strcpy(tty, "/dev/lat/"); /* SVR4 style LAT tty = /dev/lat/nnn */ strcat(tty, argv[1]); if (stat(tty, &statbuf) < 0) { perror(tty); exit(-1); } port.info_dev = minor(statbuf.st_rdev); bzero(&strioctl, sizeof(struct strioctl)); strioctl.ic_cmd = LIOC_INFO_SHOW; strioctl.ic_len = sizeof(lats_info); strioctl.ic_dp = (char *)&port; if (ioctl(fd, I_STR, &strioctl) < 0) { printf("LIOC_INFO_SHOW ioctl failed. errno=%d.\n",errno); exit(2); } printf("\nLocal Port Name = %s", tty); if (port.info_type == INFO_TOUCH_HIC) printf(" \n"); else printf(" \n"); if ( port.info_status == INFO_STS_IDLE ) printf("\tPort not active\n"); if (port.rmt_node[0] != NULL) printf("\tRemote Node Name = %s\n", port.rmt_node); if (port.rmt_port[0] != NULL) printf("\tRemote Port Name = %s\n", port.rmt_port); if (port.rmt_service[0] != NULL) printf("\tRemote Service Name = %s\n", port.rmt_service); if (port.lcl_service[0] != NULL) printf("\tLocal Service Name = %s\n", port.lcl_service); } -- ------------------------------------------------------------------ Scott Ruch Unix Systems Group DEC OSF/1 LAT Engineering Digital Equipment Corp. |d|i|g|i|t|a|l| 200 US Rt. 9 North swr@unx.dec.com Manalapan, NJ 07726-9455 (908) 577-6082 Monmouth College Dept. of Software Engineering r4009@ignatz.monmouth.edu ------------------------------------------------------------------