File: 09-authmappeduser.patch

package info (click to toggle)
solid-pop3d 0.15-27
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 1,716 kB
  • ctags: 1,497
  • sloc: ansic: 6,364; sh: 2,084; makefile: 486
file content (72 lines) | stat: -rw-r--r-- 2,506 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
From: "Adam D. Barratt" <debian-bts@adam-barratt.org.uk>
Date: Fri, 16 Jan 2004 10:42:08 +0000
Subject: 09 authmappeduser

Add AuthMappedUser option (bug#228085).
---
 man/spop3d.conf.5 |    7 +++++++
 src/configfile.h  |    1 +
 src/main.c        |    5 +++--
 3 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/man/spop3d.conf.5 b/man/spop3d.conf.5
index 6f1de20..76fd136 100644
--- a/man/spop3d.conf.5
+++ b/man/spop3d.conf.5
@@ -179,6 +179,13 @@ in user mapping file. If DoMapping is enabled and RequiredMapping is disabled
 user needn't have entry in user mapping file (no mapping is performed then).
 Option has no effect when DoMapping is disabled. Option is enabled by default.
 .TP
+.B AuthMappedUser boolean
+Controls whether authentication is performed on the username given by
+the user, or the username looked up in the user mapping file.
+.br
+The option is enabled by default, meaning that the user from the mapping
+file is used. The option has no effect when DoMapping is disabled.
+.TP
 .B LogStatistics boolean
 If enabled qpopper-like statistics are logged. At the end of each session
 username, number of deleted messages, size (in bytes) of deleted messages,
diff --git a/src/configfile.h b/src/configfile.h
index aa7f09a..39c01e7 100644
--- a/src/configfile.h
+++ b/src/configfile.h
@@ -66,6 +66,7 @@ extern unsigned int wccount;
 #ifdef MAPPING
 extern int domapping;
 extern int reqmapping;
+extern int authmappeduser;
 extern char sp_mapfile[];
 extern char mapfileowner[];
 #endif
diff --git a/src/main.c b/src/main.c
index 2544125..9788030 100644
--- a/src/main.c
+++ b/src/main.c
@@ -175,6 +175,7 @@ struct str_option options_set[] =
 #ifdef MAPPING
 	{"UserMapFile", OP_STRING, &sp_mapfile, PATH_MAX, NULL},
 	{"DoMapping", OP_BOOLEAN, &domapping, 0, NULL},
+	{"AuthMappedUser", OP_BOOLEAN, &authmappeduser, 1, NULL},
 	{"RequiredMapping", OP_BOOLEAN, &reqmapping, 0, NULL},
 #endif
 #ifdef NONIPVIRTUALS
@@ -210,7 +211,7 @@ char maildrop_name[PATH_MAX];
 char maildrop_type[MAXMDTYPENAMELENGTH];
 #ifdef MAPPING
 char sp_mapfile[PATH_MAX];
-int domapping = 0, reqmapping = 1;
+int domapping = 0, reqmapping = 1, authmappeduser = 1;
 char mapusername[MAXARGLN + 1];
 #endif
 #ifdef APOP
@@ -1385,7 +1386,7 @@ int main(int argc, char **argv)
 			if (!useapop) {
 #endif
 #ifdef MAPPING
-			if (domapping)
+			if (domapping && authmappeduser)
 				tmp = sp_authenticate_user(mapusername, password);
 			else
 				tmp = sp_authenticate_user(username, password);
--