diff options
| author | manuel <manuel@mausz.at> | 2013-02-04 02:48:34 +0100 |
|---|---|---|
| committer | manuel <manuel@mausz.at> | 2013-02-04 02:48:34 +0100 |
| commit | 5d47a7101a2394c7f7bb288585464fa293a2ad33 (patch) | |
| tree | 0c371687c8791b2278c5b8049bbd64a7de1d0863 /overmaildirquota.c | |
| parent | 86d5a6ec30ceea44e9459394d2e6403642cdd158 (diff) | |
| download | qmail-5d47a7101a2394c7f7bb288585464fa293a2ad33.tar.gz qmail-5d47a7101a2394c7f7bb288585464fa293a2ad33.tar.bz2 qmail-5d47a7101a2394c7f7bb288585464fa293a2ad33.zip | |
[PATCH] maildir++ for qmail-local and qmail-pop3d
Patch to make qmail-local and qmail-pop3d compatible with the maildir++ quota
system that is used by vpopmail and courier-imap
qmail-maildir++
Diffstat (limited to 'overmaildirquota.c')
| -rw-r--r-- | overmaildirquota.c | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/overmaildirquota.c b/overmaildirquota.c new file mode 100644 index 0000000..5e1877c --- /dev/null +++ b/overmaildirquota.c | |||
| @@ -0,0 +1,43 @@ | |||
| 1 | /* | ||
| 2 | ** Copyright 1998 - 1999 Double Precision, Inc. | ||
| 3 | ** See COPYING for distribution information. | ||
| 4 | */ | ||
| 5 | |||
| 6 | #if HAVE_CONFIG_H | ||
| 7 | #include "config.h" | ||
| 8 | #endif | ||
| 9 | #include "maildirquota.h" | ||
| 10 | #include <stdlib.h> | ||
| 11 | #include <string.h> | ||
| 12 | #include <errno.h> | ||
| 13 | #include <sys/stat.h> | ||
| 14 | |||
| 15 | static const char rcsid[]="$Id: overquota.c,v 1.0 2002/06/09 16:21:05 mr \ | ||
| 16 | sam Exp $"; | ||
| 17 | |||
| 18 | |||
| 19 | int user_over_maildirquota( const char *dir, const char *q) | ||
| 20 | { | ||
| 21 | struct stat stat_buf; | ||
| 22 | int quotafd; | ||
| 23 | int ret_value; | ||
| 24 | |||
| 25 | if (fstat(0, &stat_buf) == 0 && S_ISREG(stat_buf.st_mode) && | ||
| 26 | stat_buf.st_size > 0 && *q) | ||
| 27 | { | ||
| 28 | if (maildir_checkquota(dir, "afd, q, stat_buf.st_size, 1) | ||
| 29 | && errno != EAGAIN) | ||
| 30 | { | ||
| 31 | if (quotafd >= 0) close(quotafd); | ||
| 32 | ret_value = 1; | ||
| 33 | } else { | ||
| 34 | maildir_addquota(dir, quotafd, q, stat_buf.st_size, 1); | ||
| 35 | if (quotafd >= 0) close(quotafd); | ||
| 36 | ret_value = 0; | ||
| 37 | } | ||
| 38 | } else { | ||
| 39 | ret_value = 0; | ||
| 40 | } | ||
| 41 | |||
| 42 | return(ret_value); | ||
| 43 | } | ||
