AutoPPP appears in the "who" listing

Vladimir Turin (vova@mics.msu.su)
Wed, 29 Jan 1997 11:26:06 +0300


Daniel Van Wieren wrote:
> 
> I am running mgetty+sendfax 0.99 with the AutoPPP option turned on.  When every a users logs into the system their login name in the "who" listing and in the utmp accounting file is AutoPPP not their userid.  The following is the line in the login.con
fi
> g file for AutoPPP:
> 
> /AutoPPP/ -    @     /usr/sbin/pppd auth -chap +pap login
> 
> Any suggestions on how to make the username appear in the "who" listing and in the utmp file would be helpful.
> 
> Thanks
> 
> Daniel

  Hi !

  I spent some time to solve this problem and found nothing than
to patch pppd code. I don't remember details, but original pppd 
did something different from what I wanted :-)
  So I've collect changes and you may try to use them, but I am
using FreeBSD 2.1.5 RELEASE, so this patch is for FreeBSD 2.1.5
source code.

  Bye, Vladimir.


Line in login.config:

/AutoPPP/ -     -       /usr/sbin/pppd file /etc/ppp/options.mgetty 


Contents of file /etc/ppp/options.mgetty (just to be exact)

auth
-chap
+pap
login
debug
modem
dns1 xx.xx.xx.xx
dns2 xx.xx.xx.xx

Patch for file auth.c in the pppd source code:

--------------------------------------------------------
*** auth.c.orig Fri Mar  1 22:34:45 1996
--- auth.c      Wed Nov 27 22:40:15 1996
***************
*** 43,48 ****
--- 43,49 ----
  #include <syslog.h>
  #include <pwd.h>
  #include <string.h>
+ #include <utmp.h>
  #include <sys/types.h>
  #include <sys/stat.h>
  
***************
*** 102,108 ****
  /* Prototypes */
  void check_access __P((FILE *, char *));
  
! static int  login __P((char *, char *, char **, int *));
  static void logout __P((void));
  static int  null_login __P((int));
  static int  get_upap_passwd __P((void));
--- 103,109 ----
  /* Prototypes */
  void check_access __P((FILE *, char *));
  
! static int  ppplogin __P((char *, char *, char **, int *));
  static void logout __P((void));
  static int  null_login __P((int));
  static int  get_upap_passwd __P((void));
***************
*** 398,404 ****
      }
  
      if (uselogin && ret == UPAP_AUTHACK) {
!       ret = login(user, passwd, msg, msglen);
        if (ret == UPAP_AUTHNAK) {
            syslog(LOG_WARNING, "upap login failure for %s", user);
        }
--- 399,405 ----
      }
  
      if (uselogin && ret == UPAP_AUTHACK) {
!       ret = ppplogin(user, passwd, msg, msglen);
        if (ret == UPAP_AUTHNAK) {
            syslog(LOG_WARNING, "upap login failure for %s", user);
        }
***************
*** 445,451 ****
   * In either case, msg points to an appropriate message.
   */
  static int
! login(user, passwd, msg, msglen)
      char *user;
      char *passwd;
      char **msg;
--- 446,452 ----
   * In either case, msg points to an appropriate message.
   */
  static int
! ppplogin(user, passwd, msg, msglen)
      char *user;
      char *passwd;
      char **msg;
***************
*** 454,459 ****
--- 455,461 ----
      struct passwd *pw;
      char *epasswd;
      char *tty;
+     struct utmp utmp;
  
      if ((pw = getpwnam(user)) == NULL) {
        return (UPAP_AUTHNAK);
***************
*** 482,490 ****
      tty = devnam;
      if (strncmp(tty, "/dev/", 5) == 0)
        tty += 5;
!     logwtmp(tty, user, "");           /* Add wtmp login entry */
!     logged_in = TRUE;
  
      return (UPAP_AUTHACK);
  }
  
--- 484,510 ----
      tty = devnam;
      if (strncmp(tty, "/dev/", 5) == 0)
        tty += 5;
! #if 0
!     logwtmp(tty, user, "ppp");                /* Add wtmp login entry
*/
! #else
! /* vova */
! /*    extern void login _PROTO(( struct utmp * utmp ));*/
! 
!     bzero( (void*) &utmp, sizeof(utmp) );
!     utmp.ut_time = time(NULL);
!     strncpy( utmp.ut_name, user, sizeof(utmp.ut_name) );
!     strncpy( utmp.ut_line, tty,  sizeof(utmp.ut_line) );
!     strncpy( utmp.ut_host, "ppp", sizeof(utmp.ut_host) );
! /*
!     if ( ut_host != NULL )
!       strncpy( utmp.ut_host, ut_host, sizeof(utmp.ut_host) );
! */
!     login( &utmp );
! 
! /* vova */
! #endif
  
+     logged_in = TRUE;
      return (UPAP_AUTHACK);
  }
  
***************
*** 496,501 ****
--- 516,522 ----
  {
      char *tty;
  
+     syslog(LOG_INFO, "user %s logged out", user);
      tty = strrchr(devnam, '/');
      if (tty == NULL)
        tty = devnam;

-----------------------------------------------------------