summaryrefslogtreecommitdiff
path: root/comms/asterisk18/patches/patch-bc
blob: 7b8322d1bad96a733cf633624bf2e0e0a31952aa (plain)
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
$NetBSD: patch-bc,v 1.1.1.1 2010/12/15 03:22:45 jnemeth Exp $

--- contrib/scripts/vmail.cgi.orig	2008-09-20 00:55:01.000000000 +0000
+++ contrib/scripts/vmail.cgi
@@ -145,7 +145,7 @@ sub check_login($$)
 		$context = "default";
 	}
 	if (!$filename) {
-		$filename = "/etc/asterisk/voicemail.conf";
+		$filename = "@ASTETCDIR@/voicemail.conf";
 	}
 #	print header;
 #	print "Including <h2>$filename</h2> while in <h2>$category</h2>...\n";
@@ -153,7 +153,7 @@ sub check_login($$)
 	while(<VMAIL>) {
 		chomp;
 		if (/include\s\"([^\"]+)\"$/) {
-			($tmp, $category) = &check_login("/etc/asterisk/$1", $category);
+			($tmp, $category) = &check_login("@ASTETCDIR@/$1", $category);
 			if (length($tmp)) {
 #				print "Got '$tmp'\n";
 				return ($tmp, $category);
@@ -200,7 +200,7 @@ sub check_login_users {
 	my ($mbox, $context) = split(/\@/, param('mailbox'));
 	my $pass = param('password');
 	my ($found, $fullname) = (0, "");
-	open VMAIL, "</etc/asterisk/users.conf";
+	open VMAIL, "<@ASTETCDIR@/users.conf";
 	while (<VMAIL>) {
 		chomp;
 		if (m/\[(.*)\]/) {
@@ -242,7 +242,7 @@ sub validmailbox($$$$)
 		$context = "default";
 	}
 	if (!$filename) {
-		$filename = "/etc/asterisk/voicemail.conf";
+		$filename = "@ASTETCDIR@/voicemail.conf";
 	}
 	if (!$category) {
 		$category = "general";
@@ -251,7 +251,7 @@ sub validmailbox($$$$)
 	while (<VMAIL>) {
 		chomp;
 		if (/include\s\"([^\"]+)\"$/) {
-			($tmp, $category) = &validmailbox($mbox, $context, "/etc/asterisk/$1");
+			($tmp, $category) = &validmailbox($mbox, $context, "@ASTETCDIR@/$1");
 			if ($tmp) {
 				return ($tmp, $category);
 			}
@@ -298,7 +298,7 @@ sub mailbox_options()
 	local $tmp2;
 	local $tmp;
 	if (!$filename) {
-		$filename = "/etc/asterisk/voicemail.conf";
+		$filename = "@ASTETCDIR@/voicemail.conf";
 	}
 	if (!$category) {
 		$category = "general";
@@ -386,7 +386,7 @@ sub mailbox_list()
 sub msgcount() 
 {
 	my ($context, $mailbox, $folder) = @_;
-	my $path = "/var/spool/asterisk/voicemail/$context/$mailbox/$folder";
+	my $path = "@ASTSPOOLDIR@/voicemail/$context/$mailbox/$folder";
 	if (opendir(DIR, $path)) {
 		my @msgs = grep(/^msg....\.txt$/, readdir(DIR));
 		closedir(DIR);
@@ -410,7 +410,7 @@ sub msgcountstr()
 sub messages()
 {
 	my ($context, $mailbox, $folder) = @_;
-	my $path = "/var/spool/asterisk/voicemail/$context/$mailbox/$folder";
+	my $path = "@ASTSPOOLDIR@/voicemail/$context/$mailbox/$folder";
 	if (opendir(DIR, $path)) {
 		my @msgs = sort grep(/^msg....\.txt$/, readdir(DIR));
 		closedir(DIR);
@@ -435,7 +435,7 @@ sub getfields()
 {
 	my ($context, $mailbox, $folder, $msg) = @_;
 	my $fields;
-	if (open(MSG, "</var/spool/asterisk/voicemail/$context/$mailbox/$folder/msg${msg}.txt")) {
+	if (open(MSG, "<@ASTSPOOLDIR@/voicemail/$context/$mailbox/$folder/msg${msg}.txt")) {
 		while(<MSG>) {
 			s/\#.*$//g;
 			if (/^(\w+)\s*\=\s*(.*)$/) {
@@ -560,7 +560,7 @@ _EOH
 	<input name="action" type=submit value="download">
 </td></tr>
 <tr><td colspan=2 align=center>
-<embed width=400 height=40 src="vmail.cgi?action=audio&folder=$folder&mailbox=$mbox&context=$context&password=$passwd&msgid=$msgid&format=$format&dontcasheme=$$.$format" autostart=yes loop=false></embed>
+<embed width=400 height=40 src="vmail?action=audio&folder=$folder&mailbox=$mbox&context=$context&password=$passwd&msgid=$msgid&format=$format&dontcasheme=$$.$format" autostart=yes loop=false></embed>
 </td></tr></table>
 </td></tr>
 </table>
@@ -588,7 +588,7 @@ sub message_audio()
 	}
 	&untaint($format);
 
-	my $path = "/var/spool/asterisk/voicemail/$context/$mailbox/$folder/msg${msgid}.$format";
+	my $path = "@ASTSPOOLDIR@/voicemail/$context/$mailbox/$folder/msg${msgid}.$format";
 
 	$msgid =~ /^\d\d\d\d$/ || die("Msgid Liar ($msgid)!");
 	grep(/^${format}$/, keys %formats) || die("Format Liar ($format)!");
@@ -809,11 +809,11 @@ sub message_rename()
 		die("Invalid old Message<BR>\n");
 	}
 	
-	my $path = "/var/spool/asterisk/voicemail/$context/$mbox/$newfolder";
+	my $path = "@ASTSPOOLDIR@/voicemail/$context/$mbox/$newfolder";
 	$path =~ /^(.*)$/;
 	$path = $1;
 	mkdir $path, 0770;
-	$path = "/var/spool/asterisk/voicemail/$context/$mbox/$oldfolder";
+	$path = "@ASTSPOOLDIR@/voicemail/$context/$mbox/$oldfolder";
 	opendir(DIR, $path) || die("Unable to open directory\n");
 	my @files = grep /^msg${old}\.\w+$/, readdir(DIR);
 	closedir(DIR);
@@ -823,7 +823,7 @@ sub message_rename()
 			$tmp = $1;
 			$oldfile = $path . "/$tmp";
 			$tmp =~ s/msg${old}/msg${new}/;
-			$newfile = "/var/spool/asterisk/voicemail/$context/$mbox/$newfolder/$tmp";
+			$newfile = "@ASTSPOOLDIR@/voicemail/$context/$mbox/$newfolder/$tmp";
 #			print "Renaming $oldfile to $newfile<BR>\n";
 			rename($oldfile, $newfile);
 		}
@@ -884,15 +884,15 @@ sub message_copy()
 		die("Invalid old Message<BR>\n");
 	}
 	
-	my $path = "/var/spool/asterisk/voicemail/$context/$newmbox";
+	my $path = "@ASTSPOOLDIR@/voicemail/$context/$newmbox";
 	$path =~ /^(.*)$/;
 	$path = $1;
 	mkdir $path, 0770;
-	$path = "/var/spool/asterisk/voicemail/$context/$newmbox/INBOX";
+	$path = "@ASTSPOOLDIR@/voicemail/$context/$newmbox/INBOX";
 	$path =~ /^(.*)$/;
 	$path = $1;
 	mkdir $path, 0770;
-	$path = "/var/spool/asterisk/voicemail/$context/$mbox/$oldfolder";
+	$path = "@ASTSPOOLDIR@/voicemail/$context/$mbox/$oldfolder";
 	opendir(DIR, $path) || die("Unable to open directory\n");
 	my @files = grep /^msg${old}\.\w+$/, readdir(DIR);
 	closedir(DIR);
@@ -902,7 +902,7 @@ sub message_copy()
 			$tmp = $1;
 			$oldfile = $path . "/$tmp";
 			$tmp =~ s/msg${old}/msg${new}/;
-			$newfile = "/var/spool/asterisk/voicemail/$context/$newmbox/INBOX/$tmp";
+			$newfile = "@ASTSPOOLDIR@/voicemail/$context/$newmbox/INBOX/$tmp";
 #			print "Copying $oldfile to $newfile<BR>\n";
 			&file_copy($oldfile, $newfile);
 		}
@@ -932,7 +932,7 @@ sub message_delete()
 	} else {
 		die("Invalid Message<BR>\n");
 	}
-	my $path = "/var/spool/asterisk/voicemail/$context/$mbox/$folder";
+	my $path = "@ASTSPOOLDIR@/voicemail/$context/$mbox/$folder";
 	opendir(DIR, $path) || die("Unable to open directory\n");
 	my @files = grep /^msg${msg}\.\w+$/, readdir(DIR);
 	closedir(DIR);
@@ -968,7 +968,7 @@ sub message_forward()
 	my $txt;
 	$context = &untaint($context);
 	$newmbox = &untaint($newmbox);
-	my $path = "/var/spool/asterisk/voicemail/$context/$newmbox/INBOX";
+	my $path = "@ASTSPOOLDIR@/voicemail/$context/$newmbox/INBOX";
 	if ($msgs[0]) {
 		if (&lock_path($path) == 0) {
 			$msgcount = &msgcount($context, $newmbox, "INBOX");
@@ -1018,7 +1018,7 @@ sub message_delete_or_move()
 	$context = &untaint($context);
 	$mbox = &untaint($mbox);
 	$folder = &untaint($folder);
-	$path = "/var/spool/asterisk/voicemail/$context/$mbox/$folder";
+	$path = "@ASTSPOOLDIR@/voicemail/$context/$mbox/$folder";
 	if ($msgs[0]) {
 		if (&lock_path($path) == 0) {
 			my $msgcount = &msgcount($context, $mbox, $folder);