I'm wondering if anyone out there has had experience with qmail and disabling
dot-file support.
As a medium-size ISP we're considering switching to qmail for delivery purposes,
but because of various spam attacks we'd prefer not to allow ordinary users to
be able to use .qmail files. Of course 'alias' still has to be able to control
arbitrary usernames such as 'postmaster' and 'mailer-daemon'.
What I came up with is the patch below -- crufty or what! -- which
is the best I could come up with after two days at staring at Dan's tight,
efficient and extremely sparsely commented code in qmail-local.
I have tested this on non-production systems and it appears to operate as
specified, but perhaps some of you who are thinking about using qmail in
a production system and have a concern about .qmail files would like
to try it out first (and tell me your results).
Note that it introduces a dependency on getpwnam which may not be appropriate
for qmail-local. Suggestions gratefully received.
Niall Murphy
*** qmail-local.c.orig Mon Jun 15 11:53:16 1998
- --- qmail-local.c Thu Feb 4 16:45:06 1999
***************
*** 29,34 ****
- --- 29,39 ----
#include "gfrom.h"
#include "auto_patrn.h"
+ #include "auto_uids.h"
+ #include <pwd.h>
+ #include <sys/types.h>
+ #include "auto_qmail.h"
+
void usage() { strerr_die1x(100,"qmail-local: usage: qmail-local [ -nN ]
user homedir local dash ext domain sender aliasempty"); }
void temp_nomem() { strerr_die1x(111,"Out of memory. (#4.3.0)"); }
***************
*** 381,391 ****
int *cutable;
{
int i;
if (!stralloc_copys(&qme,".qmail")) temp_nomem();
if (!stralloc_cats(&qme,dash)) temp_nomem();
if (!stralloc_cat(&qme,&safeext)) temp_nomem();
! if (qmeexists(fd,cutable)) {
if (safeext.len >= 7) {
i = safeext.len - 7;
if (!byte_diff("default",7,safeext.s + i))
- --- 386,413 ----
int *cutable;
{
int i;
+ struct passwd *dataonuser;
+ uid_t uidofrecipient;
+
+ printf("Entered qmesearch with user = %s\n",user);
+ if ((dataonuser = getpwnam(user)) == NULL) {
+ /* We could have failed for two reasons.
+ A) Out of memory
+ B) User not found.
+ If B has occured then it could be an alias not in the password file
+ that we may nevertheless want to respond to. Therefore we can't bomb
+ out with temp_nomem, we must assign the uid == alias user and
continue on.
+ [EMAIL PROTECTED] Feb 99 */
+ uidofrecipient = auto_uida;
+ } else {
+ uidofrecipient = dataonuser->pw_uid;
+ }
if (!stralloc_copys(&qme,".qmail")) temp_nomem();
if (!stralloc_cats(&qme,dash)) temp_nomem();
if (!stralloc_cat(&qme,&safeext)) temp_nomem();
! if (((unsigned long) auto_uida == uidofrecipient) &&
qmeexists(fd,cutable)) {
! /* if (qmeexists(fd,cutable)) { [EMAIL PROTECTED] feb 98 */
if (safeext.len >= 7) {
i = safeext.len - 7;
if (!byte_diff("default",7,safeext.s + i))
- --