projects
/
apps
/
pfixtools.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Rename project -> pfixtools.
[apps/pfixtools.git]
/
postfix.c
diff --git
a/postfix.c
b/postfix.c
index
298d251
..
0b5f84a
100644
(file)
--- a/
postfix.c
+++ b/
postfix.c
@@
-1,5
+1,5
@@
/******************************************************************************/
/******************************************************************************/
-/* p
ostlicyd: a postfix policy daemon with a lot of features
*/
+/* p
fixtools: a collection of postfix related tools
*/
/* ~~~~~~~~~ */
/* ________________________________________________________________________ */
/* */
/* ~~~~~~~~~ */
/* ________________________________________________________________________ */
/* */
@@
-33,22
+33,20
@@
* Copyright © 2006-2007 Pierre Habouzit
*/
* Copyright © 2006-2007 Pierre Habouzit
*/
-#include <errno.h>
-#include <limits.h>
-#include <stdbool.h>
-#include <syslog.h>
-#include <unistd.h>
-
-#include "job.h"
+#include "common.h"
#include "postfix.h"
#include "buffer.h"
#include "tokens.h"
#include "postfix.h"
#include "buffer.h"
#include "tokens.h"
-struct jpriv_t {
+#if 0
+
+#define ishspace(c) ((c) == ' ' || (c) == '\t')
+
+typedef struct jpriv_t {
buffer_t ibuf;
buffer_t obuf;
query_t query;
buffer_t ibuf;
buffer_t obuf;
query_t query;
-};
+}
jpriv_t
;
static jpriv_t *postfix_jpriv_init(jpriv_t *jp)
{
static jpriv_t *postfix_jpriv_init(jpriv_t *jp)
{
@@
-66,11
+64,6
@@
static void postfix_jpriv_wipe(jpriv_t *jp)
DO_NEW(jpriv_t, postfix_jpriv);
DO_DELETE(jpriv_t, postfix_jpriv);
DO_NEW(jpriv_t, postfix_jpriv);
DO_DELETE(jpriv_t, postfix_jpriv);
-static void postfix_stop(job_t *job)
-{
- postfix_jpriv_delete(&job->jdata);
-}
-
static int postfix_parsejob(query_t *query)
{
#define PARSE_CHECK(expr, error, ...) \
static int postfix_parsejob(query_t *query)
{
#define PARSE_CHECK(expr, error, ...) \
@@
-87,18
+80,18
@@
static int postfix_parsejob(query_t *query)
char *k, *v;
int klen, vlen, vtk;
char *k, *v;
int klen, vlen, vtk;
- while (
*p == ' ' || *p == '\t'
)
+ while (
ishspace(*p)
)
p++;
p = strchr(k = p, '=');
p++;
p = strchr(k = p, '=');
- PARSE_CHECK(p, "could not find '=' in
policy
line");
- for (klen = p - k; k
[klen] == ' ' || k[klen] == '\t'
; klen--);
+ PARSE_CHECK(p, "could not find '=' in line");
+ for (klen = p - k; k
len && ishspace(k[klen])
; klen--);
p += 1; /* skip = */
p += 1; /* skip = */
- while (
*p == ' ' || *p == '\t'
)
+ while (
ishspace(*p)
)
p++;
p = strstr(v = p, "\r\n");
p++;
p = strstr(v = p, "\r\n");
- PARSE_CHECK(p, "could not find final \\r\\n in
policy
line");
- for (vlen = p - v; v
[vlen] == ' ' || v[vlen] == '\t'
; vlen--);
+ PARSE_CHECK(p, "could not find final \\r\\n in line");
+ for (vlen = p - v; v
len && ishspace(v[vlen])
; vlen--);
p += 2; /* skip \r\n */
vtk = tokenize(v, vlen);
p += 2; /* skip \r\n */
vtk = tokenize(v, vlen);
@@
-159,10
+152,10
@@
static int postfix_parsejob(query_t *query)
default:
return -1;
}
default:
return -1;
}
- /* do sth with (k,v) */
}
}
- return -1;
+ return query->state == SMTP_UNKNOWN ? -1 : 0;
+
#undef PARSE_CHECK
}
#undef PARSE_CHECK
}
@@
-193,8
+186,6
@@
static void postfix_process(job_t *job)
if (job->jdata->obuf.len)
return;
if (job->jdata->obuf.len)
return;
- job_update_mode(job, JOB_READ);
-
/* fall through */
case JOB_READ:
/* fall through */
case JOB_READ:
@@
-231,8
+222,6
@@
static void postfix_process(job_t *job)
return;
}
return;
}
- job_update_mode(job, JOB_IDLE);
-
/* TODO: run the scenario */
return;
/* TODO: run the scenario */
return;
@@
-241,3
+230,4
@@
static void postfix_process(job_t *job)
return;
}
}
return;
}
}
+#endif