Usenet comp.unix.osf.osf1 (1992-2004)
 help / color / mirror / Atom feed
From: swr@batman.unx.dec.com (Scott Ruch)
Subject: Re: Finding out LAT source name
Date: 12 Jan 1995 03:11:50 GMT	[thread overview]
Message-ID: <3f26lm$6to@jac.zko.dec.com> (raw)
In-Reply-To: 3eunql$n3q@ulowell.uml.edu

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 <stropts.h>
#include <sys/errno.h>
#include <sys/stat.h>
#include <lat/streams/latioc.h>

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("      <application>\n");
     else
        printf("      <interactive>\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
------------------------------------------------------------------


      parent reply	other threads:[~1995-01-12  3:11 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1995-01-10 19:40 Finding out LAT source name Brian 'Doc' O'Neill
1995-01-11 19:22 ` Sam Eads
1995-01-12  3:11 ` Scott Ruch [this message]
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox