Hi,
I've had problems using the 'login' option with ppp 2.3.8, 2.3.9 and some
previous versions too.
It succesfully validates users using the system user accounts, but fails to
log it correctly in /var/log/wtmp (I needed the logs to run acua as a
validation software for an ISP).
Tracing pppd I discovered that it tries to unlock wtmp *after* closing it,
causing an error and leaving the file unchanged (at least in my
configuration).
I corrected the problem with flock() and added the possibility to use
updwtmp() when glibc2 is available (not much work, it's just one more line
of code while other two where swapped).
Regrettably this is the first time I try and contribute to a Linux program
so I hope this is the right place to post the patch.
--
Bye, /\/\ / Admin of SiLink |char*p="char*p=%c%s%c;main(){printf(p,
(/\/\)ax. SysOp of Ade BBS |34,p,34);}";main(){printf(p,34,p,34);}
diff -Naur ppp-2.3.9/pppd/sys-linux.c ppp-2.3.9-2/pppd/sys-linux.c
--- ppp-2.3.9/pppd/sys-linux.c Fri Jul 23 05:41:06 1999
+++ ppp-2.3.9-2/pppd/sys-linux.c Sun Jul 25 15:59:32 1999
@@ -1727,7 +1727,6 @@
void logwtmp (const char *line, const char *name, const char *host)
{
- int wtmp;
struct utmp ut, *utp;
pid_t mypid = getpid();
/*
@@ -1777,16 +1776,25 @@
/*
* Update the wtmp file.
*/
- wtmp = open(_PATH_WTMP, O_APPEND|O_WRONLY);
- if (wtmp >= 0) {
- flock(wtmp, LOCK_EX);
-
- /* we really should check for error on the write for a full disk! */
- write (wtmp, (char *)&ut, sizeof(ut));
- close (wtmp);
+#if __GLIBC__ >= 2
+ updwtmp(_PATH_WTMP, &ut);
+#else
+ {
+ int wtmp;
+
+ wtmp = open(_PATH_WTMP, O_APPEND|O_WRONLY);
+ if (wtmp >= 0) {
+ flock(wtmp, LOCK_EX);
- flock(wtmp, LOCK_UN);
+ /* we really should check for error on the write for a full disk! */
+ write (wtmp, (char *)&ut, sizeof(ut));
+
+ flock(wtmp, LOCK_UN);
+
+ close (wtmp);
+ }
}
+#endif /* __GLIBC__ */
}