Skip to content

Commit 990440c

Browse files
committed
backend update to 24.04.000.102
1 parent c298c1c commit 990440c

File tree

7 files changed

+69
-35
lines changed

7 files changed

+69
-35
lines changed

backend/src/c/xmlback/blockmail.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ blockmail_alloc (const char *fname, bool_t syncfile, log_t *lg) /*{{{*/
104104
b -> outputdata = NULL;
105105
b -> counter = NULL;
106106
b -> active = false;
107-
b -> reason = REASON_UNSPEC;
107+
b -> reason = Reason_Unspec;
108108
b -> reason_detail = 0;
109109
b -> reason_custom = NULL;
110110
b -> control = NULL;

backend/src/c/xmlback/create.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ create_output (blockmail_t *blockmail, receiver_t *rec) /*{{{*/
372372
st = true;
373373
m = NULL;
374374
blockmail -> active = true;
375-
blockmail -> reason = REASON_UNSPEC;
375+
blockmail -> reason = Reason_Unspec;
376376
blockmail -> reason_detail = 0;
377377
if (blockmail -> reason_custom) {
378378
free (blockmail -> reason_custom);
@@ -416,7 +416,7 @@ create_output (blockmail_t *blockmail, receiver_t *rec) /*{{{*/
416416
}
417417
} else {
418418
blockmail -> active = false;
419-
blockmail -> reason = REASON_NO_MEDIA;
419+
blockmail -> reason = Reason_No_Media;
420420
blockmail -> reason_detail = type;
421421
}
422422
break;
@@ -439,7 +439,7 @@ create_output (blockmail_t *blockmail, receiver_t *rec) /*{{{*/
439439
strcpy (rec -> mid, m ? media_typeid (m -> type) : "?");
440440
if ((! rec -> media) && blockmail -> active) {
441441
blockmail -> active = false;
442-
blockmail -> reason = REASON_UNMATCHED_MEDIA;
442+
blockmail -> reason = Reason_Unmatched_Media;
443443
blockmail -> reason_detail = 0;
444444
}
445445
if (blockmail -> active && docreate)

backend/src/c/xmlback/generate.c

Lines changed: 51 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -618,14 +618,13 @@ sendmail_inject_mail (blockmail_t *blockmail, sendmail_t *s, gen_t *g, receiver_
618618
break;
619619
default:
620620
if ((exit_status >= EX__BASE) && (exit_status <= EX__MAX)) {
621-
char reason[128];
622-
623-
snprintf (reason, sizeof (reason) - 1, "inject=exit %d", exit_status);
624-
st = write_bounce_log (g, blockmail, rec, "4.9.9", reason);
621+
blockmail -> active = false;
622+
blockmail -> reason = Reason_Reject;
623+
blockmail -> reason_detail = exit_status;
625624
}
626625
break;
627626
}
628-
if (exit_status != EX_OK)
627+
if ((exit_status != EX_OK) && ((exit_status < EX__BASE) || (exit_status > EX__MAX)))
629628
st = false;
630629
} else {
631630
if (WIFSIGNALED (status))
@@ -890,29 +889,61 @@ generate_owrite (void *data, blockmail_t *blockmail, receiver_t *rec) /*{{{*/
890889
log_out (blockmail -> lg, LV_ERROR, "Failed to write to %s: %m", g -> midlog);
891890
}
892891
if (! blockmail -> active) {
892+
const char *reason = NULL;
893893
char dsn[32];
894+
buffer_t *scratch;
894895
char *custom;
895-
const char *reason;
896896

897897
snprintf (dsn, sizeof (dsn) - 1, "1.%d.%d", blockmail -> reason, blockmail -> reason_detail);
898+
if (scratch = buffer_alloc (256)) {
899+
buffer_sets (scratch, "skip=");
900+
switch (blockmail -> reason) {
901+
case Reason_Unspec:
902+
buffer_appends (scratch, "unspec reason");
903+
break;
904+
case Reason_No_Media:
905+
buffer_format (scratch, "no media (%d)", blockmail -> reason_detail);
906+
break;
907+
case Reason_Empty_Document:
908+
buffer_appends (scratch, "no document");
909+
break;
910+
case Reason_Unmatched_Media:
911+
buffer_appends (scratch, "unmatched media");
912+
break;
913+
case Reason_Reject:
914+
buffer_format (scratch, "reject (exit code %d)", blockmail -> reason_detail);
915+
break;
916+
case Reason_Custom:
917+
if (blockmail -> reason_custom && *(blockmail -> reason_custom))
918+
buffer_appends (scratch, blockmail -> reason_custom);
919+
else
920+
buffer_appends (scratch, "generic custom reason");
921+
}
922+
reason = buffer_string (scratch);
923+
}
898924
custom = NULL;
899-
switch (blockmail -> reason) {
900-
case REASON_UNSPEC: reason = "skip=unspec reason"; break;
901-
case REASON_NO_MEDIA: reason = "skip=no media"; break;
902-
case REASON_EMPTY_DOCUMENT: reason = "skip=no document"; break;
903-
case REASON_UNMATCHED_MEDIA: reason = "skip=unmatched media"; break;
904-
case REASON_CUSTOM:
905-
default:
906-
if ((blockmail -> reason == REASON_CUSTOM) && blockmail -> reason_custom) {
907-
if (custom = malloc (strlen (blockmail -> reason_custom) + 6))
908-
sprintf (custom, "skip=%s", blockmail -> reason_custom);
909-
} else if (custom = malloc (32)) {
910-
sprintf (custom, "skip=reason %d", blockmail -> reason);
925+
if (! reason) {
926+
switch (blockmail -> reason) {
927+
case Reason_Unspec: reason = "skip=unspec reason"; break;
928+
case Reason_No_Media: reason = "skip=no media"; break;
929+
case Reason_Empty_Document: reason = "skip=no document"; break;
930+
case Reason_Unmatched_Media: reason = "skip=unmatched media"; break;
931+
case Reason_Reject: reason = "skip=reject"; break;
932+
case Reason_Custom:
933+
default:
934+
if ((blockmail -> reason == Reason_Custom) && blockmail -> reason_custom) {
935+
if (custom = malloc (strlen (blockmail -> reason_custom) + 6))
936+
sprintf (custom, "skip=%s", blockmail -> reason_custom);
937+
} else if (custom = malloc (32)) {
938+
sprintf (custom, "skip=reason %d", blockmail -> reason);
939+
}
940+
reason = custom;
941+
break;
911942
}
912-
reason = custom;
913-
break;
914943
}
915944
st = write_bounce_log (g, blockmail, rec, dsn, reason ? reason : "skip=not specified");
945+
if (scratch)
946+
buffer_free (scratch);
916947
if (custom)
917948
free (custom);
918949
} else if (! rec -> media) {

backend/src/c/xmlback/replace.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ replace_tags (blockmail_t *blockmail, receiver_t *rec, block_t *block,
348348
if (rec -> media && rec -> media -> empty)
349349
if ((block -> tid != TID_EMail_HTML_Preheader) && (block -> tid != TID_EMail_HTML_Clearance)) {
350350
blockmail -> active = false;
351-
blockmail -> reason = REASON_EMPTY_DOCUMENT;
351+
blockmail -> reason = Reason_Empty_Document;
352352
}
353353
}
354354
return st;

backend/src/c/xmlback/xmlback.h

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -107,11 +107,15 @@
107107
# define SP_BLOCK 1
108108

109109
/* possible reasons for inactive user */
110-
# define REASON_UNSPEC 0
111-
# define REASON_NO_MEDIA 1
112-
# define REASON_EMPTY_DOCUMENT 2
113-
# define REASON_UNMATCHED_MEDIA 3
114-
# define REASON_CUSTOM 4
110+
typedef enum { /*{{{*/
111+
Reason_Unspec,
112+
Reason_No_Media,
113+
Reason_Empty_Document,
114+
Reason_Unmatched_Media,
115+
Reason_Reject,
116+
Reason_Custom
117+
/*}}}*/
118+
} reason_t;
115119

116120
typedef struct iflua iflua_t;
117121
typedef enum { /*{{{*/
@@ -446,7 +450,7 @@ struct blockmail { /*{{{*/
446450
void *outputdata; /* output related private data */
447451
counter_t *counter; /* counter for created mails */
448452
bool_t active; /* if user is active */
449-
int reason; /* code, if user not active */
453+
reason_t reason; /* code, if user not active */
450454
int reason_detail; /* specific reason, if available*/
451455
char *reason_custom; /* custom reason text */
452456
buffer_t *control; /* control block */

backend/src/script/lib/config.sh

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,7 @@ export SYSTEM_CONFIG='{
3737
"mailout-server": "localhost",
3838
"mailout-port": "8093",
3939
"direct-path-server": "localhost",
40-
"direct-path-port": "9403",
41-
"python-auto-install-modules": "true"
40+
"direct-path-port": "9403"
4241
}'
4342
export DBCFG_PATH="$BASE/etc/dbcfg"
4443
#
@@ -507,7 +506,7 @@ export VERSION="$version"
507506
export LICENCE="$licence"
508507
#
509508
setupVirtualEnviron || die "failed to setup virtual environment"
510-
if [ "$BASE" = "$HOME" ] && [ "`$cq python-auto-install-modules:false`" = "true" ]; then
509+
if [ "$BASE" = "$HOME" ] && [ "`$cq python-auto-install-modules:true`" = "true" ]; then
511510
"$BASE/scripts/requirements.py"
512511
rc=$?
513512
case "$rc" in

backend/version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
24.10.000.073
1+
24.10.000.102

0 commit comments

Comments
 (0)