diff options
author | fredb <fredb> | 2003-02-27 21:43:36 +0000 |
---|---|---|
committer | fredb <fredb> | 2003-02-27 21:43:36 +0000 |
commit | 9d950ba388df3ab8f6bab5cebab5c99719c9a29c (patch) | |
tree | cd82fc0a8cd69973d5614da5d23188e4c92ae2a9 /comms/mgetty+sendfax | |
parent | db561d80b3caade1c66cbfc0319200dd3509912d (diff) | |
download | pkgsrc-9d950ba388df3ab8f6bab5cebab5c99719c9a29c.tar.gz |
Use the same ut_id as "login" does, so we can properly close out the wtmpx
entry that "login" creates.
Diffstat (limited to 'comms/mgetty+sendfax')
-rw-r--r-- | comms/mgetty+sendfax/distinfo | 4 | ||||
-rw-r--r-- | comms/mgetty+sendfax/patches/patch-al | 44 |
2 files changed, 28 insertions, 20 deletions
diff --git a/comms/mgetty+sendfax/distinfo b/comms/mgetty+sendfax/distinfo index c37fee958bf..0c1aa5b2657 100644 --- a/comms/mgetty+sendfax/distinfo +++ b/comms/mgetty+sendfax/distinfo @@ -1,4 +1,4 @@ -$NetBSD: distinfo,v 1.10 2003/02/27 17:13:38 fredb Exp $ +$NetBSD: distinfo,v 1.11 2003/02/27 21:43:36 fredb Exp $ SHA1 (mgetty1.1.28-Jan10.tar.gz) = b0c33bf5f5137f17f8d1fbd529c5ba6f0afb9dbc Size (mgetty1.1.28-Jan10.tar.gz) = 964610 bytes @@ -11,5 +11,5 @@ SHA1 (patch-ag) = 943aa837a285663ff6cf5ab07c3f908f499c2074 SHA1 (patch-ai) = 98eba401e1b422e2f759eca00132a75e68518f4d SHA1 (patch-aj) = d03345166f70270d05ae478287165089bd832c16 SHA1 (patch-ak) = 18f9570f35909089a4083fa24903dfea14dcc475 -SHA1 (patch-al) = 854ac984c6763aabfc4ec6e98eb535c066f2a8be +SHA1 (patch-al) = 2a6dcf13d65446d2064228b1024517e599892a60 SHA1 (patch-am) = 6b7516b3f857f65c0ecc7963f39e433e4ef8771d diff --git a/comms/mgetty+sendfax/patches/patch-al b/comms/mgetty+sendfax/patches/patch-al index a4568e5c088..952e385cd59 100644 --- a/comms/mgetty+sendfax/patches/patch-al +++ b/comms/mgetty+sendfax/patches/patch-al @@ -1,4 +1,4 @@ -$NetBSD: patch-al,v 1.2 2003/02/27 14:42:55 fredb Exp $ +$NetBSD: patch-al,v 1.3 2003/02/27 21:43:36 fredb Exp $ --- utmp.c.orig 2001-12-17 16:43:25.000000000 -0600 +++ utmp.c @@ -43,13 +43,13 @@ $NetBSD: patch-al,v 1.2 2003/02/27 14:42:55 fredb Exp $ /* on SunOS (and other BSD-derived systems), the getty process does * * not have to care for the utmp entries, login and init do all the work * Anyway, we have to _read_ it to get the number of users logged in. -@@ -109,26 +116,68 @@ +@@ -109,26 +116,74 @@ { struct utmp *utmp; pid_t pid; +#ifdef NETBSD_UTMPX -+char id[4]; +struct utmpx ut; ++char *id; +#else +# if !defined(SVR4) && !defined(__GLIBC__) || __GLIBC__ < 2 struct stat st; @@ -58,41 +58,49 @@ $NetBSD: patch-al,v 1.2 2003/02/27 14:42:55 fredb Exp $ FILE * fp; +#ifdef NETBSD_UTMPX -+ id[0] = line[0]; -+ id[1] = line[strlen(line) - 2]; -+ id[2] = line[strlen(line) - 1]; -+ id[3] = '\0'; ++ id = line; ++ if ( strlen( line ) > sizeof( ut.ut_id ) ) ++ id += strlen( line ) - sizeof( ut.ut_id ); ++ + if ( ut_type == UT_INIT ) { -+ lprintf(L_JUNK, "creating initial utmp entry... (id: %s)", id); ++ lprintf(L_JUNK, ++ "creating initial utmp entry... (ID: %s)", ++ id); + -+ memset(&ut, 0, sizeof( ut )); -+ memcpy(ut.ut_id, id, 4); -+ strncpy(ut.ut_line, line, sizeof( ut.ut_line )); -+ gettimeofday(&ut.ut_tv, NULL ); ++ memset( &ut, 0, sizeof( ut ) ); ++ strncpy( ut.ut_id, id, sizeof( ut.ut_id ) ); ++ strncpy( ut.ut_line, line, sizeof( ut.ut_line ) ); ++ gettimeofday( &ut.ut_tv, NULL ); + ut.ut_type = INIT_PROCESS; + login( &ut ); + + lprintf(L_NOISE, "initial utmp + wtmp entry made"); + return; + } ++ + if ((pid = checklock( line )) == NO_LOCK) { + pid = getpid(); + } -+ lprintf(L_JUNK, "looking for utmp entry... (my ID: %s)", id); ++ ++ lprintf(L_JUNK, ++ "looking for utmp entry... (ID: %s)", id); +#else pid = getpid(); ++ lprintf(L_JUNK, "looking for utmp entry... (my PID: %d)", pid); +#endif + setutent(); while ((utmp = getutent()) != (struct utmp *) NULL) { +- if (utmp->ut_pid == pid && +- (utmp->ut_type == INIT_PROCESS || utmp->ut_type == LOGIN_PROCESS)) +#ifdef NETBSD_UTMPX -+ if (memcmp(utmp->ut_id, id, 4) == 0 && ++ if ( strncmp( utmp->ut_id, id, sizeof( utmp->ut_id ) ) == 0 && +#else - if (utmp->ut_pid == pid && ++ if ( utmp->ut_pid == pid && +#endif - (utmp->ut_type == INIT_PROCESS || utmp->ut_type == LOGIN_PROCESS)) ++ (utmp->ut_type == INIT_PROCESS || utmp->ut_type == LOGIN_PROCESS) ) { - strcpy(utmp->ut_line, line ); + strncpy(utmp->ut_line, line, sizeof( utmp->ut_line) ); @@ -115,7 +123,7 @@ $NetBSD: patch-al,v 1.2 2003/02/27 14:42:55 fredb Exp $ if (ut_host != NULL) { strncpy( utmp->ut_host, ut_host, sizeof( utmp->ut_host ) - 1); -@@ -138,7 +187,7 @@ +@@ -138,7 +193,7 @@ } #endif /* SVR4 */ @@ -124,7 +132,7 @@ $NetBSD: patch-al,v 1.2 2003/02/27 14:42:55 fredb Exp $ if ( pututline(utmp) == NULL ) { lprintf( L_ERROR, "cannot create utmp entry" ); -@@ -151,7 +200,7 @@ +@@ -151,7 +206,7 @@ /* write same record to end of wtmp * if wtmp file exists */ |