Revert "TODO: s3:smbd: Add OpenBSD utmp support"
authorStefan Metzmacher <metze@samba.org>
Fri, 26 Oct 2012 10:32:48 +0000 (12:32 +0200)
committerStefan Metzmacher <metze@samba.org>
Tue, 16 Jan 2018 06:47:05 +0000 (07:47 +0100)
This reverts commit f8d4764b74604e65ddaac7daa45a7d5d55a0a864.

source3/smbd/utmp.c

index 497ba4eb930050b5cd651a8abab2b2e0cca8f679..17b1e0d8506f039727f0e0c6e1fdd2075d8d2425 100644 (file)
@@ -253,64 +253,14 @@ static char *uw_pathname(TALLOC_CTX *ctx,
 }
 
 #ifndef HAVE_PUTUTLINE
-#include <ttyent.h>
-
 /****************************************************************************
  Update utmp file directly.  No subroutine interface: probably a BSD system.
 ****************************************************************************/
 
 static void pututline_my(const char *uname, struct utmp *u, bool claim)
 {
-       int fd, topslot;
-       struct utmp ubuf;
-
-       if ((fd = open(uname, O_RDWR, 0)) < 0) {
-               return;
-       }
-
-       if (!setttyent()) {
-               return;
-       }
-
-       for (topslot = 0; getttyent() != (struct ttyent *)NULL; ) {
-               topslot++;
-       }
-
-       if (!endttyent()) {
-               return;
-       }
-
-       (void) lseek(fd, (off_t)(topslot * sizeof(struct utmp)), SEEK_SET);
-
-       DEBUG(1,("pututline(%s, %s, %d); topslot=%d\n",
-                u->ut_line, u->ut_name, claim, topslot));
-
-       while (true) {
-               if (read(fd, &ubuf, sizeof(ubuf)) == sizeof(ubuf)) {
-                       if ((claim && !ubuf.ut_name[0]) ||
-                           (!claim && ubuf.ut_name[0] &&
-                           !strncmp(ubuf.ut_line, u->ut_line, UT_LINESIZE)))
-                       {
-                               (void)lseek(fd, -(off_t)sizeof(struct utmp),
-                                           SEEK_CUR);
-                               break;
-                       }
-                       topslot++;
-               } else {
-                       (void)lseek(fd, (off_t)(topslot * sizeof(struct utmp)),
-                                   SEEK_SET);
-                       break;
-               }
-       }
-
-       if (!claim) {
-               memset((char *)&u->ut_name, '\0', sizeof(u->ut_name));
-               memset((char *)&u->ut_host, '\0', sizeof(u->ut_host));
-       }
-
-       (void)write(fd, u, sizeof(struct utmp));
-
-       (void)close(fd);
+       DEBUG(1,("pututline_my: not yet implemented\n"));
+       /* BSD implementor: may want to consider (or not) adjusting "lastlog" */
 }
 #endif /* HAVE_PUTUTLINE */