Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Arch Linux
netctl
Commits
4d18e145
Commit
4d18e145
authored
Sep 20, 2017
by
Jouke Witteveen
Browse files
Improve handling of untrimmed profile names (FS#55295)
Reported by Michaël Cadilhac <michael@cadilhac.name>
parent
b1b03d8e
Changes
5
Hide whitespace changes
Inline
Side-by-side
src/ifplugd.action
View file @
4d18e145
...
...
@@ -8,13 +8,13 @@ PROFILE_FILE="$STATE_DIR/ifplugd-$1.profile"
case
"
$2
"
in
up
)
while
read
-r
profile
;
do
while
IFS
=
read
-r
profile
;
do
if
ForceConnect
=
yes
"
$SUBR_DIR
/network"
start
"
$profile
"
;
then
mkdir
-p
"
$(
dirname
"
$PROFILE_FILE
"
)
"
printf
"%s"
"
$profile
"
>
"
$PROFILE_FILE
"
exit
0
fi
done
< <
(
list_profiles |
while
read
-r
profile
;
do
done
< <
(
list_profiles |
while
IFS
=
read
-r
profile
;
do
report_debug
"Examining profile '
$profile
'"
(
source
"
$PROFILE_DIR
/
$profile
"
>
/dev/null
...
...
src/lib/globals
View file @
4d18e145
...
...
@@ -103,7 +103,7 @@ timeout_wait() {
### Profile management
## List all acceptable profiles names
(assume they don't contain
newlines
)
## List all acceptable profiles names
separated by
newlines
list_profiles
()
{
# Follow aliases with -L, skip forbidden/reserved names
find
-L
"
$PROFILE_DIR
/"
-maxdepth
1
-type
f
-not
-name
'.*'
-not
-name
'*~'
-not
-name
$'*
\n
*'
-not
-name
'*.action'
-not
-name
'*.conf'
-not
-name
'*.service'
-printf
"%f
\n
"
...
...
@@ -116,9 +116,9 @@ load_profile() {
if
[[
-z
$1
||
!
-r
"
$PROFILE_DIR
/
$1
"
]]
;
then
exit_error
"Profile '
$1
' does not exist or is not readable"
fi
while
read
-r
hook
;
do
while
IFS
=
read
-r
hook
;
do
source
"
$hook
"
done
< <
(
find
-L
"
$PROFILE_DIR
/hooks"
-maxdepth
1
-type
f
-executable
-not
-name
'.*'
-not
-name
'*~'
|
sort
-u
)
done
< <
(
find
-L
"
$PROFILE_DIR
/hooks"
-maxdepth
1
-type
f
-executable
-not
-name
'.*'
-not
-name
'*~'
-not
-name
$'*
\n
*'
|
sort
-u
)
source
"
$PROFILE_DIR
/
$1
"
if
[[
-z
$Interface
]]
;
then
exit_error
"Profile '
$1
' does not specify an interface"
...
...
src/netctl-auto
View file @
4d18e145
...
...
@@ -214,7 +214,7 @@ start() {
echo
"p2p_disabled=1"
>>
"
$wpa_conf
"
local
profile
list_profiles |
while
read
-r
profile
;
do
list_profiles |
while
IFS
=
read
-r
profile
;
do
report_debug
"Examining profile '
$profile
'"
(
source
"
$PROFILE_DIR
/
$profile
"
...
...
src/netctl.in
View file @
4d18e145
...
...
@@ -30,7 +30,7 @@ END
list
()
{
local
indicators
=(
' '
'+'
'*'
)
i
list_profiles |
while
read
-r
Profile
;
do
list_profiles |
while
IFS
=
read
-r
Profile
;
do
if
sd_call
"is-active --quiet"
"
$Profile
"
&> /dev/null
;
then
[[
$(
sd_status_text
"
$Profile
"
)
==
"online"
]]
((
i
=
2 -
$?
))
...
...
@@ -43,7 +43,7 @@ list() {
store
()
{
mkdir
-p
"
$(
dirname
"
$STATE_FILE
"
)
"
list_profiles |
while
read
-r
Profile
;
do
list_profiles |
while
IFS
=
read
-r
Profile
;
do
if
sd_call
"is-active --quiet"
"
$Profile
"
&> /dev/null
;
then
printf
"%s
\n
"
"
$Profile
"
fi
...
...
src/wifi-menu
View file @
4d18e145
...
...
@@ -33,7 +33,7 @@ quote_safe() {
# for interface $1.
init_profiles
()
{
local
i
=
0 essid profile
while
read
-r
profile
;
do
while
IFS
=
read
-r
profile
;
do
essid
=
$(
unset
INTERFACE ESSID
source
"
$PROFILE_DIR
/
$profile
"
>
/dev/null
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment