Re: Our aging base system heimdal

From: Marcin Cieslak <saper_at_saper.info>
Date: Sat, 12 Jun 2010 23:29:47 +0000 (UTC)
(from the freebsd-current mailing list)

Dnia 06.06.2010 b. f. <bf1783_at_googlemail.com> napisaƂ/a:
> Is anybody planning to update the base system heimdal, which has been
> largely untouched since May 2008?  In addition to the many other
> bug-fixes and improvements in the current version 1.3.3 (see, for
> example:

I decided to give it a try. My first steup is to make it compile on
FreeBSD. As you know, as of recently FreeBSD-current has no <utmp.h>

I have hacked up a small patch to fix this:

--- appl/ftp/ftpd/logwtmp.c	2010-05-26 23:53:13.000000000 +0200
+++ appl/ftp/ftpd/logwtmp.c	2010-06-12 22:32:57.373647840 +0200
_at__at_ -104,16 +104,16 _at__at_
 static void
 ftpd_logwtmp_wtmp(char *line, char *name, char *host)
 {
+#ifdef HAVE_UTMP_H
     static int init = 0;
     static int fd;
-#ifdef WTMPX_FILE
-    static int fdx;
-#endif
     struct utmp ut;
-#ifdef WTMPX_FILE
+#endif
+#ifdef HAVE_UTMPX_H
     struct utmpx utx;
 #endif
 
+#ifdef HAVE_UTMP_H
     memset(&ut, 0, sizeof(struct utmp));
 #ifdef HAVE_STRUCT_UTMP_UT_TYPE
     if(name[0])
_at__at_ -130,8 +130,9 _at__at_
     strncpy(ut.ut_host, host, sizeof(ut.ut_host));
 #endif
     ut.ut_time = time(NULL);
+#endif
 
-#ifdef WTMPX_FILE
+#ifdef HAVE_UTMPX_H
     strncpy(utx.ut_line, line, sizeof(utx.ut_line));
     strncpy(utx.ut_user, name, sizeof(utx.ut_user));
     strncpy(utx.ut_host, host, sizeof(utx.ut_host));
_at__at_ -140,6 +141,7 _at__at_
     if (utx.ut_syslen > sizeof(utx.ut_host))
         utx.ut_syslen = sizeof(utx.ut_host);
 #endif
+#endif
     {
 	struct timeval tv;
 
_at__at_ -152,21 +154,18 _at__at_
 	utx.ut_type = USER_PROCESS;
     else
 	utx.ut_type = DEAD_PROCESS;
-#endif
 
+#ifdef HAVE_UTMPX_H
+	pututxline(&utx);
+#else
     if(!init){
 	fd = open(WTMP_FILE, O_WRONLY|O_APPEND, 0);
-#ifdef WTMPX_FILE
-	fdx = open(WTMPX_FILE, O_WRONLY|O_APPEND, 0);
-#endif
 	init = 1;
     }
     if(fd >= 0) {
 	write(fd, &ut, sizeof(struct utmp)); /* XXX */
-#ifdef WTMPX_FILE
-	write(fdx, &utx, sizeof(struct utmpx));
-#endif	
     }
+#endif
 }
 
 #endif /* !HAVE_ASL_H */

-- 
              << Marcin Cieslak // saper_at_saper.info >>
Received on Sat Jun 12 2010 - 21:30:04 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:40:04 UTC