utmp update for bsd systems (try 2)

John H Terpstra jht at Samba.Org
Thu Apr 14 18:02:50 GMT 2005


On Thursday 14 April 2005 11:11, Michael Shalayeff wrote:
> re
> i have posted this before but received no response...
> is there anybod reading on this address?

Yes sir! Many of us read this list and some of even respond to postings on it.

While we appreciate your interest in Samba 2.2.x we are at a loss as to what 
would you like us to do with your patch.

The Samba 2.x is a dead code tree. It is no longer officially maintained by 
the Samba Team. This code branch has been discontinued for over a year now.
As much as we may want to maintain this code we lack the resources to do this.

Samba-3 is being actively maintained and developed and Samba-4, which has been 
in the pipeline for over 2 years is still in pre-Beta development.

Patches that are sent to the Samba mailing lists do not necessarily get acted 
on. Often our team is busy and just miss patch postings. The only way to 
assure that a patch will be considered and not lost is to post a bug report 
on https://bugzilla.samba.org.

- John T.

> cu
>
> ----- Forwarded message (env-from mickey) -----
>
> re
> this is a patch against samba-2.2.12p0 and adds support
> for updating utmp on bsds. code similarly ripped from
> openbsd's ftpd (;
> cu
> --
>     paranoic mickey       (my employers have changed but, the name has
> remained)
>
> --- utmp.c	Thu Aug 12 14:24:20 2004
> +++ /home/mickey/utmp.c	Wed Mar 30 15:51:40 2005
> @@ -261,6 +261,7 @@
>  }
>
>  #ifndef HAVE_PUTUTLINE
> +#include <ttyent.h>
>
> 
> /**************************************************************************
>** Update utmp file directly.  No subroutine interface: probably a BSD
> system. @@ -268,8 +269,50 @@
>
>  static void pututline_my(pstring uname, struct utmp *u, BOOL claim)
>  {
> -	DEBUG(1,("pututline_my: not yet implemented\n"));
> -	/* BSD implementor: may want to consider (or not) adjusting "lastlog" */
> +	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 (1) {
> +		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);
>  }
>  #endif /* HAVE_PUTUTLINE */
>
>
> ----- End of forwarded message (env-from mickey) -----


More information about the samba-technical mailing list