diff options
author | garga <garga@FreeBSD.org> | 2010-04-06 19:51:22 +0800 |
---|---|---|
committer | garga <garga@FreeBSD.org> | 2010-04-06 19:51:22 +0800 |
commit | 45c9c3cc9fe026964c3d6ea22cb18e68d0d6d4aa (patch) | |
tree | 71f5aaa0ecd54077ac9f3fa4ac1d925a9977050b /mail/qmail | |
parent | 6a5f58f6746d9c23ef0ad96af5c5d63c199735f7 (diff) | |
download | freebsd-ports-gnome-45c9c3cc9fe026964c3d6ea22cb18e68d0d6d4aa.tar.gz freebsd-ports-gnome-45c9c3cc9fe026964c3d6ea22cb18e68d0d6d4aa.tar.zst freebsd-ports-gnome-45c9c3cc9fe026964c3d6ea22cb18e68d0d6d4aa.zip |
Fix build with utmpx
Reported by: pointyhat by erwin@
Diffstat (limited to 'mail/qmail')
-rw-r--r-- | mail/qmail/Makefile | 6 | ||||
-rw-r--r-- | mail/qmail/files/extra-patch-utmpx-ldap | 65 |
2 files changed, 70 insertions, 1 deletions
diff --git a/mail/qmail/Makefile b/mail/qmail/Makefile index b3ea145827cc..81c2a1db1ae0 100644 --- a/mail/qmail/Makefile +++ b/mail/qmail/Makefile @@ -311,7 +311,11 @@ NO_MTREE= yes .include <bsd.port.pre.mk> .if ${OSVERSION} >= 900007 -EXTRA_PATCHES+= ${FILESDIR}/extra-patch-utmpx +. if defined(SLAVE_LDAP) +EXTRA_PATCHES+= ${FILESDIR}/extra-patch-utmpx-ldap +. else +EXTRA_PATCHES+= ${FILESDIR}/extra-patch-utmpx +. endif .endif .if defined(SLAVE_TLS) diff --git a/mail/qmail/files/extra-patch-utmpx-ldap b/mail/qmail/files/extra-patch-utmpx-ldap new file mode 100644 index 000000000000..4fd164a6bc10 --- /dev/null +++ b/mail/qmail/files/extra-patch-utmpx-ldap @@ -0,0 +1,65 @@ +--- qbiff.c.orig 2010-04-06 08:43:28.000000000 -0300 ++++ qbiff.c 2010-04-06 08:44:35.000000000 -0300 +@@ -1,14 +1,7 @@ + #include <sys/types.h> + #include <sys/stat.h> + #include <unistd.h> +-#include <utmp.h> +-#ifndef UTMP_FILE +-#ifdef _PATH_UTMP +-#define UTMP_FILE _PATH_UTMP +-#else +-#define UTMP_FILE "/etc/utmp" +-#endif +-#endif ++#include <utmpx.h> + #include "readwrite.h" + #include "stralloc.h" + #include "substdio.h" +@@ -21,15 +14,12 @@ + #include "env.h" + #include "exit.h" + +-substdio ssutmp; +-char bufutmp[sizeof(struct utmp) * 16]; +-int fdutmp; + substdio sstty; + char buftty[1024]; + int fdtty; + +-struct utmp ut; +-char line[sizeof(ut.ut_line) + 1]; ++struct utmpx *ut; ++char line[sizeof(ut->ut_line) + 1]; + stralloc woof = {0}; + stralloc tofrom = {0}; + stralloc text = {0}; +@@ -64,7 +54,7 @@ + if (!(user = env_get("USER"))) _exit(0); + if (!(sender = env_get("SENDER"))) _exit(0); + if (!(userext = env_get("LOCAL"))) _exit(0); +- if (str_len(user) > sizeof(ut.ut_name)) _exit(0); ++ if (str_len(user) > sizeof(ut->ut_user)) _exit(0); + + if (!stralloc_copys(&tofrom,"*** TO <")) _exit(0); + if (!stralloc_cats(&tofrom,userext)) _exit(0); +@@ -89,15 +79,11 @@ + if (!stralloc_cat(&woof,&text)) _exit(0); + if (!stralloc_cats(&woof,"\015\n")) _exit(0); + +- fdutmp = open_read(UTMP_FILE); +- if (fdutmp == -1) _exit(0); +- substdio_fdbuf(&ssutmp,subread,fdutmp,bufutmp,sizeof(bufutmp)); +- +- while (substdio_get(&ssutmp,(char *)&ut,sizeof(ut)) == sizeof(ut)) +- if (!str_diffn(ut.ut_name,user,sizeof(ut.ut_name))) ++ while ((ut = getutxent()) != NULL) ++ if (ut->ut_type == USER_PROCESS && !str_diffn(ut->ut_user,user,sizeof(ut->ut_user))) + { +- byte_copy(line,sizeof(ut.ut_line),ut.ut_line); +- line[sizeof(ut.ut_line)] = 0; ++ byte_copy(line,sizeof(ut->ut_line),ut->ut_line); ++ line[sizeof(ut->ut_line)] = 0; + if (line[0] == '/') continue; + if (!line[0]) continue; + if (line[str_chr(line,'.')]) continue; |