View | Details | Raw Unified | Return to bug 14649
Collapse All | Expand All

(-)backend3.orig/net-pppoe (-6 / +13 lines)
Lines 1-7 Link Here
1
#!/bin/sh -ef
1
#!/bin/sh -ef
2
2
3
PATH=/usr/lib/alterator-net-common:$PATH
3
PATH=/usr/lib/alterator-net-common:$PATH
4
chapfile=/etc/ppp/chap-secrets
4
# chapfile=/etc/ppp/chap-secrets
5
5
6
################### shell file helpers
6
################### shell file helpers
7
7
Lines 79-90 Link Here
79
	
79
	
80
	if [ -n "$in_login" ] ;then
80
	if [ -n "$in_login" ] ;then
81
		sed -r "s,^user[[:space:]].*,user $in_login," -i "$name/pppoptions"
81
		sed -r "s,^user[[:space:]].*,user $in_login," -i "$name/pppoptions"
82
		sed -r "s,^$prev_login[[:space:]]*,$in_login	," -i "$chapfile"
82
		# sed -r "s,^$prev_login[[:space:]]*,$in_login	," -i "$chapfile"
83
		prev_login="$in_login"
83
		prev_login="$in_login"
84
	fi
84
	fi
85
	if [ -n "$in_password" ]; then
85
	if [ -n "$in_password" ]; then
86
		in_password=$(echo "$in_password"|sed -e 's/["]/\\\\&/g')
86
		in_password=$(echo "$in_password"|sed -e 's/["]/\\\\&/g')
87
		sed -r "s,^$prev_login[[:space:]].*,$prev_login	*	\"$in_password\"	*," -i "$chapfile"
87
		sed -r "s,^password[[:space:]].*,password $in_password," -i "$name/pppoptions"
88
		### WARNING deny users from reading the password
89
		chmod o-rw "$name/pppoptions"
90
		# sed -r "s,^$prev_login[[:space:]].*,$prev_login	*	\"$in_password\"	*," -i "$chapfile"
88
	fi
91
	fi
89
92
90
	ifdown "$1" && ifup "$1"
93
	ifdown "$1" && ifup "$1"
Lines 92-98 Link Here
92
95
93
new_iface()
96
new_iface()
94
{
97
{
95
	grep -qs "^$in_login[[:space:]]" "$chapfile" && return 1
98
	# grep -qs "^$in_login[[:space:]]" "$chapfile" && return 1
96
99
97
	local name="/etc/net/ifaces/$1"
100
	local name="/etc/net/ifaces/$1"
98
	in_password=$(echo "$in_password"|sed -e 's/["]/\\\\&/g')
101
	in_password=$(echo "$in_password"|sed -e 's/["]/\\\\&/g')
Lines 105-112 Link Here
105
	shell_add_or_subst "PPPMAXFAIL=" "0" "$name/options"
108
	shell_add_or_subst "PPPMAXFAIL=" "0" "$name/options"
106
	
109
	
107
	shell_add_or_subst "user " "$in_login" "$name/pppoptions"
110
	shell_add_or_subst "user " "$in_login" "$name/pppoptions"
111
	shell_add_or_subst "password " "$in_password" "$name/pppoptions"
112
	### WARNING deny users from reading the password
113
	chmod o-rw "$name/pppoptions"
114
	
108
115
109
	echo "$in_login	*	\"$in_password\"	*" >>"$chapfile"
116
	# echo "$in_login	*	\"$in_password\"	*" >>"$chapfile"
110
117
111
	ifup "$1"
118
	ifup "$1"
112
	return 0
119
	return 0
Lines 119-125 Link Here
119
	local name="/etc/net/ifaces/$1"
126
	local name="/etc/net/ifaces/$1"
120
	local prev_login="$(grep '^user' "$name/pppoptions"|sed -r 's,user[[:space:]]*,,')"
127
	local prev_login="$(grep '^user' "$name/pppoptions"|sed -r 's,user[[:space:]]*,,')"
121
128
122
	sed -r "/^$prev_login[[:space:]]/ d" -i "$chapfile"
129
	# sed -r "/^$prev_login[[:space:]]/ d" -i "$chapfile"
123
	rm -rf "$name"
130
	rm -rf "$name"
124
131
125
	ifdown "$1"
132
	ifdown "$1"
(-)backend3.orig/net-pptp (-6 / +13 lines)
Lines 1-7 Link Here
1
#!/bin/sh -ef
1
#!/bin/sh -ef
2
2
3
PATH=/usr/lib/alterator-net-common:$PATH
3
PATH=/usr/lib/alterator-net-common:$PATH
4
chapfile=/etc/ppp/chap-secrets
4
# chapfile=/etc/ppp/chap-secrets
5
5
6
################### shell file helpers
6
################### shell file helpers
7
7
Lines 86-97 Link Here
86
	
86
	
87
	if [ -n "$in_login" ] ;then
87
	if [ -n "$in_login" ] ;then
88
		sed -r "s,^user[[:space:]].*,user $in_login," -i "$name/pppoptions"
88
		sed -r "s,^user[[:space:]].*,user $in_login," -i "$name/pppoptions"
89
		sed -r "s,^$prev_login[[:space:]]*,$in_login	," -i "$chapfile"
89
		# sed -r "s,^$prev_login[[:space:]]*,$in_login	," -i "$chapfile"
90
		prev_login="$in_login"
90
		prev_login="$in_login"
91
	fi
91
	fi
92
	if [ -n "$in_password" ]; then
92
	if [ -n "$in_password" ]; then
93
		in_password=$(echo "$in_password"|sed -e 's/["]/\\\\&/g')
93
		in_password=$(echo "$in_password"|sed -e 's/["]/\\\\&/g')
94
		sed -r "s,^$prev_login[[:space:]].*,$prev_login	*	\"$in_password\"	*," -i "$chapfile"
94
		sed -r "s,^password[[:space:]].*,password $in_password," -i "$name/pppoptions"
95
		### WARNING deny users from reading the password
96
		chmod o-rw "$name/pppoptions"
97
		# sed -r "s,^$prev_login[[:space:]].*,$prev_login	*	\"$in_password\"	*," -i "$chapfile"
95
	fi
98
	fi
96
99
97
	ifdown "$1" && ifup "$1"
100
	ifdown "$1" && ifup "$1"
Lines 99-105 Link Here
99
102
100
new_iface()
103
new_iface()
101
{
104
{
102
	grep -qs "^$in_login[[:space:]]" "$chapfile" && return 1
105
	# grep -qs "^$in_login[[:space:]]" "$chapfile" && return 1
103
106
104
	local name="/etc/net/ifaces/$1"
107
	local name="/etc/net/ifaces/$1"
105
	in_password=$(echo "$in_password"|sed -e 's/["]/\\\\&/g')
108
	in_password=$(echo "$in_password"|sed -e 's/["]/\\\\&/g')
Lines 111-118 Link Here
111
	shell_add_or_subst "REQUIRES=" "$in_iface" "$name/options"
114
	shell_add_or_subst "REQUIRES=" "$in_iface" "$name/options"
112
115
113
	shell_add_or_subst "user " "$in_login" "$name/pppoptions"
116
	shell_add_or_subst "user " "$in_login" "$name/pppoptions"
117
	shell_add_or_subst "password " "$in_password" "$name/pppoptions"
118
	### WARNING deny users from reading the password
119
	chmod o-rw "$name/pppoptions"
120
	
114
121
115
	echo "$in_login	*	\"$in_password\"	*" >>"$chapfile"
122
	# echo "$in_login	*	\"$in_password\"	*" >>"$chapfile"
116
123
117
	ifup "$1"
124
	ifup "$1"
118
	return 0
125
	return 0
Lines 125-131 Link Here
125
	local name="/etc/net/ifaces/$1"
132
	local name="/etc/net/ifaces/$1"
126
	local prev_login="$(grep '^user' "$name/pppoptions"|sed -r 's,user[[:space:]]*,,')"
133
	local prev_login="$(grep '^user' "$name/pppoptions"|sed -r 's,user[[:space:]]*,,')"
127
134
128
	sed -r "/^$prev_login[[:space:]]/ d" -i "$chapfile"
135
	# sed -r "/^$prev_login[[:space:]]/ d" -i "$chapfile"
129
	rm -rf "$name"
136
	rm -rf "$name"
130
137
131
	ifdown "$1"
138
	ifdown "$1"

Return to bug 14649