[packages/dovecot] Rel 3; export lua fields back to dovecot also in case of auth/passdb lookup failures

arekm arekm at pld-linux.org
Wed Feb 19 11:48:45 CET 2025


commit 8256f052825b3d7247eb2ddf2b5c501fab7b3447
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date:   Wed Feb 19 10:47:20 2025 +0100

    Rel 3; export lua fields back to dovecot also in case of auth/passdb lookup failures

 dovecot-lua-export-on-auth-fail.patch | 49 +++++++++++++++++++++++++++++++++++
 dovecot.spec                          |  4 ++-
 2 files changed, 52 insertions(+), 1 deletion(-)
---
diff --git a/dovecot.spec b/dovecot.spec
index cc62371..92bcc2c 100644
--- a/dovecot.spec
+++ b/dovecot.spec
@@ -13,7 +13,7 @@ Summary:	IMAP and POP3 server written with security primarily in mind
 Summary(pl.UTF-8):	Serwer IMAP i POP3 pisany głównie z myślą o bezpieczeństwie
 Name:		dovecot
 Version:	2.3.21.1
-Release:	2
+Release:	3
 Epoch:		1
 License:	MIT (libraries), LGPL v2.1 (the rest)
 Group:		Networking/Daemons
@@ -29,6 +29,7 @@ Patch2:		%{name}-shebang.patch
 Patch3:         proc-status.patch
 Patch4:		openssl3.patch
 Patch5:		icu76.patch
+Patch6:		dovecot-lua-export-on-auth-fail.patch
 URL:		http://dovecot.org/
 BuildRequires:	autoconf
 BuildRequires:	automake
@@ -172,6 +173,7 @@ Pakiet programistyczny do tworzenia wtyczek dla Dovecota.
 %patch -P3 -p1
 %patch -P4 -p1
 %patch -P5 -p1
+%patch -P6 -p1
 
 %{__sed} -i 's,/usr/lib/dovecot,%{_libdir}/dovecot,g' doc/example-config/*.conf doc/example-config/conf.d/*.conf
 
diff --git a/dovecot-lua-export-on-auth-fail.patch b/dovecot-lua-export-on-auth-fail.patch
new file mode 100644
index 0000000..c9bfb52
--- /dev/null
+++ b/dovecot-lua-export-on-auth-fail.patch
@@ -0,0 +1,49 @@
+; export fields from lua back to dovecot also on userdb/passdb failures
+; Patch by Przemysław Plewa
+diff -urNp dovecot-2.3.21.1.org/src/auth/db-lua.c dovecot-2.3.21.1/src/auth/db-lua.c
+--- dovecot-2.3.21.1.org/src/auth/db-lua.c	2024-08-13 12:37:50.000000000 +0200
++++ dovecot-2.3.21.1/src/auth/db-lua.c	2025-02-19 10:28:54.277679024 +0100
+@@ -537,14 +537,13 @@ auth_lua_export_userdb_table(lua_State *
+ {
+ 	enum userdb_result ret = lua_tointeger(L, -2);
+ 
++        auth_lua_export_table(L, req, NULL, NULL);
++
+ 	if (ret != USERDB_RESULT_OK) {
+-		lua_pop(L, 2);
+-		lua_gc(L, LUA_GCCOLLECT, 0);
+ 		*error_r = "userdb failed";
+ 		return ret;
+ 	}
+ 
+-	auth_lua_export_table(L, req, NULL, NULL);
+ 	return USERDB_RESULT_OK;
+ }
+ 
+@@ -555,14 +554,13 @@ auth_lua_export_passdb_table(lua_State *
+ {
+ 	enum passdb_result ret = lua_tointeger(L, -2);
+ 
++	auth_lua_export_table(L, req, scheme_r, password_r);
++
+ 	if (ret != PASSDB_RESULT_OK) {
+-		lua_pop(L, 2);
+-		lua_gc(L, LUA_GCCOLLECT, 0);
+ 		*error_r = "passb failed";
+ 		return ret;
+ 	}
+ 
+-	auth_lua_export_table(L, req, scheme_r, password_r);
+ 	return PASSDB_RESULT_OK;
+ }
+ 
+@@ -585,7 +583,8 @@ auth_lua_call_lookup_finish(lua_State *L
+ 
+ 	if (ret != PASSDB_RESULT_OK && ret != PASSDB_RESULT_NEXT) {
+ 		*error_r = str;
+-	} else {
++	}
++	if (str != NULL) {
+ 		auth_lua_export_fields(req, str, scheme_r, password_r);
+ 	}
+ 
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/dovecot.git/commitdiff/8256f052825b3d7247eb2ddf2b5c501fab7b3447



More information about the pld-cvs-commit mailing list