Browse code

- applied patch : added ability to specify MD5 from a configuration file FreeBSD does not have the md5sum function Patch provided by Norman Brandinger <norm@goes.com> Closes 1489505.

git-svn-id: https://openser.svn.sourceforge.net/svnroot/openser/trunk@841 689a6050-402a-0410-94f2-e92a70836424

Bogdan-Andrei Iancu authored on 19/05/2006 15:39:34
Showing 6 changed files
... ...
@@ -23,6 +23,8 @@
23 23
 # 2006-04-07  removed gen_ha1 dependency - use md5sum;
24 24
 #             separated the serweb from openser tables;
25 25
 #             fixed the reinstall functionality (bogdan)
26
+# 2006-05-16  added ability to specify MD5 from a configuration file
27
+#             FreeBSD does not have the md5sum function (norm)
26 28
 
27 29
 PATH=$PATH:/usr/local/sbin
28 30
 
... ...
@@ -82,6 +84,11 @@ if [ -z "$USERCOL" ]; then
82 82
 	USERCOL="username"
83 83
 fi
84 84
 
85
+# Program to calculate a message-digest fingerprint 
86
+if [ -z "$MD5" ]; then
87
+	MD5="md5sum"
88
+fi
89
+
85 90
 FOREVER="2020-05-28 21:32:15"
86 91
 
87 92
 DEFAULT_ALIASES_EXPIRES=$FOREVER
... ...
@@ -203,12 +210,12 @@ prompt_realm()
203 203
 # calculate credentials for admin
204 204
 credentials()
205 205
 {
206
-	HA1=`echo -n "admin:$SIP_DOMAIN:$DEFAULT_PW" | md5sum | awk '{ print $1 }'`
206
+	HA1=`echo -n "admin:$SIP_DOMAIN:$DEFAULT_PW" | $MD5 | awk '{ print $1 }'`
207 207
 	if [ $? -ne 0 ] ; then
208 208
 		echo "HA1 calculation failed"
209 209
 		exit 1
210 210
 	fi
211
-	HA1B=`echo -n "admin@$SIP_DOMAIN:$SIP_DOMAIN:$DEFAULT_PW" | md5sum | awk '{ print $1 }'`
211
+	HA1B=`echo -n "admin@$SIP_DOMAIN:$SIP_DOMAIN:$DEFAULT_PW" | $MD5 | awk '{ print $1 }'`
212 212
 	if [ $? -ne 0 ] ; then
213 213
 		echo "HA1B calculation failed"
214 214
 		exit 1
... ...
@@ -216,7 +223,7 @@ credentials()
216 216
 
217 217
 	#PHPLIB_ID of users should be difficulty to guess for security reasons
218 218
 	NOW=`date`;
219
-	PHPLIB_ID=`echo -n "$RANDOM:$NOW:$SIP_DOMAIN" | md5sum | awk '{ print $1 }'`
219
+	PHPLIB_ID=`echo -n "$RANDOM:$NOW:$SIP_DOMAIN" | $MD5 | awk '{ print $1 }'`
220 220
 	if [ $? -ne 0 ] ; then
221 221
 		echo "PHPLIB_ID calculation failed"
222 222
 		exit 1
... ...
@@ -28,6 +28,8 @@
28 28
 #  -  datetime types not sure
29 29
 # 2006-04-07  removed gen_ha1 dependency - use md5sum;
30 30
 #             separated the serweb from openser tables (bogdan)
31
+# 2006-05-16  added ability to specify MD5 from a configuration file
32
+#             FreeBSD does not have the md5sum function (norm)
31 33
 
32 34
 PATH=$PATH:/usr/local/sbin
33 35
 
... ...
@@ -93,6 +95,11 @@ if [ -z "$USERCOL" ]; then
93 93
 	USERCOL="username"
94 94
 fi
95 95
 
96
+# Program to calculate a message-digest fingerprint 
97
+if [ -z "$MD5" ]; then
98
+	MD5="md5sum"
99
+fi
100
+
96 101
 DUMMY_DATE="1900-01-01 00:00:01"
97 102
 FOREVER="2020-05-28 21:32:15"
98 103
 
... ...
@@ -221,12 +228,12 @@ prompt_realm()
221 221
 # calculate credentials for admin
222 222
 credentials()
223 223
 {
224
-	HA1=`echo -n "admin:$SIP_DOMAIN:$DEFAULT_PW" | md5sum | awk '{ print $1 }'`
224
+	HA1=`echo -n "admin:$SIP_DOMAIN:$DEFAULT_PW" | $MD5 | awk '{ print $1 }'`
225 225
 	if [ $? -ne 0 ] ; then
226 226
 		echo "HA1 calculation failed"
227 227
 		exit 1
228 228
 	fi
229
-	HA1B=`echo -n "admin@$SIP_DOMAIN:$SIP_DOMAIN:$DEFAULT_PW" | md5sum | awk '{ print $1 }'`
229
+	HA1B=`echo -n "admin@$SIP_DOMAIN:$SIP_DOMAIN:$DEFAULT_PW" | $MD5 | awk '{ print $1 }'`
230 230
 	if [ $? -ne 0 ] ; then
231 231
 		echo "HA1B calculation failed"
232 232
 		exit 1
... ...
@@ -234,7 +241,7 @@ credentials()
234 234
 
235 235
 	#PHPLIB_ID of users should be difficulty to guess for security reasons
236 236
 	NOW=`date`;
237
-	PHPLIB_ID=`echo -n "$RANDOM:$NOW:$SIP_DOMAIN" | md5sum | awk '{ print $1 }'`
237
+	PHPLIB_ID=`echo -n "$RANDOM:$NOW:$SIP_DOMAIN" | $MD5 | awk '{ print $1 }'`
238 238
 	PHPLIB_ID=`$GENHA1 "$RANDOM" "$NOW" $SIP_DOMAIN`
239 239
 	if [ $? -ne 0 ] ; then
240 240
 		echo "PHPLIB_ID calculation failed"
... ...
@@ -13,6 +13,9 @@
13 13
 # 2003-10-30 more debugging output, less copy and paste in
14 14
 #             the previous item
15 15
 # 2005-07-28 add support for lcr module (darilion)
16
+# 2006-05-16 added ability to specify MD5 from a configuration file
17
+#            FreeBSD does not have the md5sum function (norm)
18
+
16 19
 #
17 20
 # To-DO:
18 21
 # -----
... ...
@@ -108,6 +111,9 @@ fi
108 108
 if [ -z "$LAST_LINE" ] ; then
109 109
 	LAST_LINE='tail -1'
110 110
 fi
111
+if [ -z "$MD5" ]; then
112
+	MD5="md5sum"
113
+fi
111 114
 
112 115
 ##### ----------------------------------------------- #####
113 116
 ### path to useful tools
... ...
@@ -1261,12 +1267,12 @@ credentials()
1261 1261
 {
1262 1262
 	set_user $1
1263 1263
 
1264
-	HA1=`echo -n "$SERUSER:$SERDOMAIN:$2" | md5sum | awk '{ print $1 }'`
1264
+	HA1=`echo -n "$SERUSER:$SERDOMAIN:$2" | $MD5 | awk '{ print $1 }'`
1265 1265
 	if [ $? -ne 0 ] ; then
1266 1266
 		echo "HA1 calculation failed"
1267 1267
 		exit 1
1268 1268
 	fi
1269
-	HA1B=`echo -n "$SERUSER@$SERDOMAIN:$SERDOMAIN:$2" | md5sum | awk '{ print $1 }'`
1269
+	HA1B=`echo -n "$SERUSER@$SERDOMAIN:$SERDOMAIN:$2" | $MD5 | awk '{ print $1 }'`
1270 1270
 	if [ $? -ne 0 ] ; then
1271 1271
 		echo "HA1B calculation failed"
1272 1272
 		exit 1
... ...
@@ -1,11 +1,15 @@
1 1
 #!/bin/sh 
2 2
 #
3
+# $Id$
4
+#
3 5
 # sc: openser control; tool for maintaining openser's databases
4 6
 #
5 7
 # History:
6 8
 # --------
7 9
 # 2005-03-25 - SC with DBText support (cesc santasusana)
8 10
 # 2005-07-08 - Removed all non-DBText functions (daniel)
11
+# 2006-05-16 - added ability to specify MD5 from a configuration file
12
+#              FreeBSD does not have the md5sum function (norm)
9 13
 #
10 14
 
11 15
 
... ...
@@ -37,6 +41,9 @@ fi
37 37
 if [ -z "$LAST_LINE" ] ; then
38 38
 	LAST_LINE='tail -1'
39 39
 fi
40
+if [ -z "$MD5" ]; then
41
+	MD5="md5sum"
42
+fi
40 43
 
41 44
 ##### ----------------------------------------------- #####
42 45
 ### path to useful tools
... ...
@@ -706,12 +713,12 @@ credentials()
706 706
 {
707 707
 	set_user $1
708 708
 
709
-	HA1=`echo -n "$SERUSER:$SERDOMAIN:$2" | md5sum | awk '{ print $1 }'`
709
+	HA1=`echo -n "$SERUSER:$SERDOMAIN:$2" | $MD5 | awk '{ print $1 }'`
710 710
 	if [ $? -ne 0 ] ; then
711 711
 		echo -e "\nHA1 calculation failed\n"
712 712
 		exit 1
713 713
 	fi
714
-	HA1B=`echo -n "$SERUSER@$SERDOMAIN:$SERDOMAIN:$2" | md5sum | awk '{ print $1 }'`
714
+	HA1B=`echo -n "$SERUSER@$SERDOMAIN:$SERDOMAIN:$2" | $MD5 | awk '{ print $1 }'`
715 715
 	if [ $? -ne 0 ] ; then
716 716
 		echo -e "\nHA1B calculation failed\n"
717 717
 		exit 1
... ...
@@ -8,6 +8,8 @@
8 8
 # --------
9 9
 # 2003-04-06 this is a hack, from serctl, to make work with postgres
10 10
 # 2003-02-23 Thomas's start|stop commands checked in
11
+# 2006-05-16  added ability to specify MD5 from a configuration file
12
+#             FreeBSD does not have the md5sum function (norm)
11 13
 #
12 14
 # To-DO:
13 15
 # -----
... ...
@@ -96,6 +98,9 @@ fi
96 96
 if [ -z "$LAST_LINE" ] ; then
97 97
 	LAST_LINE='tail -1'
98 98
 fi
99
+if [ -z "$MD5" ]; then
100
+	MD5="md5sum"
101
+fi
99 102
 
100 103
 ##### ----------------------------------------------- #####
101 104
 # ACL name verification
... ...
@@ -552,12 +557,12 @@ is_user() {
552 552
 # output: HA1, HA1B
553 553
 credentials()
554 554
 {
555
-	HA1=`echo -n "$SERUSER:$SERDOMAIN:$2" | md5sum | awk '{ print $1 }'`
555
+	HA1=`echo -n "$SERUSER:$SERDOMAIN:$2" | $MD5 | awk '{ print $1 }'`
556 556
 	if [ $? -ne 0 ] ; then
557 557
 		echo "HA1 calculation failed"
558 558
 		exit 1
559 559
 	fi
560
-	HA1B=`echo -n "$SERUSER@$SERDOMAIN:$SERDOMAIN:$2" | md5sum | awk '{ print $1 }'`
560
+	HA1B=`echo -n "$SERUSER@$SERDOMAIN:$SERDOMAIN:$2" | $MD5 | awk '{ print $1 }'`
561 561
 	if [ $? -ne 0 ] ; then
562 562
 		echo "HA1B calculation failed"
563 563
 		exit 1
... ...
@@ -2,14 +2,18 @@
2 2
 #
3 3
 # $Id$
4 4
 #
5
-# sc: ser control; tool for maintaining ser's databases using UNIX sockets
5
+# sc: openser control; tool for maintaining openser's databases 
6
+#                      using UNIX sockets
6 7
 #
7 8
 # History:
8 9
 # -------
9 10
 # 2004-03-09 Derived from the original FIFO version (janakj)
11
+# 2006-05-16 added ability to specify MD5 from a configuration file
12
+#            FreeBSD does not have the md5sum function (norm)
13
+
10 14
 #
11 15
 
12
-# configuration for starting/stopping ser
16
+# configuration for starting/stopping openser
13 17
 PID_FILE=/var/run/openser.pid
14 18
 SYSLOG=1 # 0=output to console, 1=output to syslog
15 19
 STARTOPTIONS= # for example -dddd
... ...
@@ -50,6 +54,11 @@ SERUNIX='openserunix'
50 50
 MYSQL='mysql'
51 51
 SER='openser'
52 52
 LAST_LINE='tail -1'
53
+# Program to calculate a message-digest fingerprint 
54
+if [ -z "$MD5" ]; then
55
+	MD5="md5sum"
56
+fi
57
+
53 58
 
54 59
 # ACL name verification
55 60
 VERIFY_ACL=1
... ...
@@ -640,12 +649,12 @@ credentials()
640 640
 {
641 641
 	set_user $1
642 642
 
643
-	HA1=`echo -n "$SERUSER:$SERDOMAIN:$2" | md5sum | awk '{ print $1 }'`
643
+	HA1=`echo -n "$SERUSER:$SERDOMAIN:$2" | $MD5 | awk '{ print $1 }'`
644 644
 	if [ $? -ne 0 ] ; then
645 645
 		echo "HA1 calculation failed"
646 646
 		exit 1
647 647
 	fi
648
-	HA1B=`echo -n "$SERUSER@$SERDOMAIN:$SERDOMAIN:$2" | md5sum | awk '{ print $1 }'`
648
+	HA1B=`echo -n "$SERUSER@$SERDOMAIN:$SERDOMAIN:$2" | $MD5 | awk '{ print $1 }'`
649 649
 	if [ $? -ne 0 ] ; then
650 650
 		echo "HA1B calculation failed"
651 651
 		exit 1