File: 0001-bug-304737-default-Maildir-may-be-overridden-thro.diff

package info (click to toggle)
checkpw 1.02-1.1
  • links: PTS
  • area: main
  • in suites: bullseye, buster, jessie, jessie-kfreebsd, stretch
  • size: 552 kB
  • sloc: ansic: 2,169; makefile: 396; sh: 189
file content (76 lines) | stat: -rw-r--r-- 1,939 bytes parent folder | download | duplicates (4)
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
73
74
75
76
From b3137da39f141aeed36a9f94d05af617645c8461 Mon Sep 17 00:00:00 2001
From: Gerrit Pape <pape@innominate.com>
Date: Tue, 11 Dec 2007 10:11:38 +0000
Subject: [PATCH] bug#304737: default 'Maildir' may be overridden through the env variable $MAILDIR

---
 checkapoppw.c |    7 +++++--
 checkpw.c     |    7 +++++--
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/checkapoppw.c b/checkapoppw.c
index 4243652..1533028 100644
--- a/checkapoppw.c
+++ b/checkapoppw.c
@@ -43,6 +43,7 @@ main(int argc,char **argv)
   char *dash;
   char *ext;
   char *password;
+  char *maildir;
   char *timestamp;
   struct stat st;
   int r;
@@ -55,7 +56,9 @@ main(int argc,char **argv)
  
   if (!argv[1]) _exit(2);
   dash = env_get("DASH");
- 
+  maildir = env_get("MAILDIR");
+  if (!maildir) maildir = auto_maildir;
+
   uplen = 0;
   for (;;) {
     do
@@ -94,7 +97,7 @@ main(int argc,char **argv)
   }
   if (chdir(pw->pw_dir) == -1) die(111);
 
-  if (!stralloc_copys(&pwfile, auto_maildir)) die(111);
+  if (!stralloc_copys(&pwfile, maildir)) die(111);
   if (dash && *ext) {
     if (!stralloc_cats(&pwfile, dash)) die(111);
     if (!stralloc_cats(&pwfile, ext)) die(111);
diff --git a/checkpw.c b/checkpw.c
index 957691a..796745e 100644
--- a/checkpw.c
+++ b/checkpw.c
@@ -38,13 +38,16 @@ main(int argc,char **argv)
   char *dash;
   char *ext;
   char *password;
+  char *maildir;
   struct stat st;
   int r;
   int i;
  
   if (!argv[1]) _exit(2);
   dash = env_get("DASH");
- 
+  maildir = env_get("MAILDIR");
+  if (!maildir) maildir = auto_maildir;
+
   uplen = 0;
   for (;;) {
     do
@@ -80,7 +83,7 @@ main(int argc,char **argv)
   }
   if (chdir(pw->pw_dir) == -1) die(111);
 
-  if (!stralloc_copys(&pwfile, auto_maildir)) die(111);
+  if (!stralloc_copys(&pwfile, maildir)) die(111);
   if (dash && *ext) {
     if (!stralloc_cats(&pwfile, dash)) die(111);
     if (!stralloc_cats(&pwfile, ext)) die(111);
-- 
1.5.3.4