The Samba-Bugzilla – Attachment 8210 Details for
Bug 8786
Add OpenBSD utmp support
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Add utmp support for OpenBSD
samba_utmp.diff (text/plain), 2.18 KB, created by
Brad Smith
on 2012-11-17 02:59:41 UTC
(
hide
)
Description:
Add utmp support for OpenBSD
Filename:
MIME Type:
Creator:
Brad Smith
Created:
2012-11-17 02:59:41 UTC
Size:
2.18 KB
patch
obsolete
>diff --git a/source3/smbd/utmp.c b/source3/smbd/utmp.c >index 0dc1917..694bfd3 100644 >--- a/source3/smbd/utmp.c >+++ b/source3/smbd/utmp.c >@@ -253,14 +253,59 @@ 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) > { >- 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()) >+ goto error; >+ >+ for (topslot = 0; getttyent() != (struct ttyent *)NULL; ) >+ topslot++; >+ >+ if (!endttyent()) >+ goto error; >+ >+ (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)); >+ >+error: >+ (void) close(fd); > } > #endif /* HAVE_PUTUTLINE */ >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 8786
:
7354
| 8210