Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
freedombone
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Context Sensitive Group
freedombone
Commits
e9e14243
Commit
e9e14243
authored
6 years ago
by
Bob Mottram
Browse files
Options
Downloads
Patches
Plain Diff
Improve handling of dynamic dns password so that special characters are possible
parent
dce45c75
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/freedombone-installer
+35
-30
35 additions, 30 deletions
src/freedombone-installer
webadmin/dynamicdns.php
+6
-2
6 additions, 2 deletions
webadmin/dynamicdns.php
with
41 additions
and
32 deletions
src/freedombone-installer
+
35
−
30
View file @
e9e14243
...
...
@@ -95,6 +95,7 @@ upgrade_file="$webadmin_install_dir/.upgrade.txt"
language_file="$webadmin_install_dir/.language.txt"
system_monitor_file="$webadmin_install_dir/.system_monitor.txt"
dynamic_dns_file="$webadmin_install_dir/.dynamicdns.txt"
dynamic_dns_password_file="$webadmin_install_dir/.dynamicdnspassword.txt"
reset_file="$webadmin_install_dir/.reset.txt"
shutdown_file="$webadmin_install_dir/.shutdown.txt"
setup_file="$webadmin_install_dir/setup.txt"
...
...
@@ -3263,48 +3264,52 @@ function update_email_proxy {
function
update_dynamic_dns
{
if
[
-f
"$
dynamic_dns_file
"
];
then
ddns=
$(awk
-F
','
'{
print
$1}'
<
"$
dynamic_dns_file
")
ddns_username=
$(awk
-F
','
'{
print
$2}'
<
"$
dynamic_dns_file
")
ddns_password=
$(awk
-F
','
'{
print
$3}'
<
"$
dynamic_dns_file
")
ddns_code=
$(awk
-F
','
'{
print
$4}'
<
"$
dynamic_dns_file
")
ddns_is_valid=
if
[
"$
ddns_username
"
];
then
if
[
"$
ddns_password
"
];
then
if
[
${
#ddns_username
}
-gt
2
];
then
if
[
${
#ddns_username
}
-lt
512
];
then
if
[
${
#ddns_password
}
-gt
2
];
then
if
[
${
#ddns_password
}
-lt
512
];
then
ddns_is_valid=
1
if
[
-f
"$
dynamic_dns_password_file
"
];
then
ddns=
$(awk
-F
','
'{
print
$1}'
<
"$
dynamic_dns_file
")
ddns_username=
$(awk
-F
','
'{
print
$2}'
<
"$
dynamic_dns_file
")
ddns_code=
$(awk
-F
','
'{
print
$3}'
<
"$
dynamic_dns_file
")
ddns_password=
$(head
-n
1
"$
dynamic_dns_password_file
")
ddns_is_valid=
if
[
"$
ddns_username
"
];
then
if
[
"$
ddns_password
"
];
then
if
[
${
#ddns_username
}
-gt
2
];
then
if
[
${
#ddns_username
}
-lt
512
];
then
if
[
${
#ddns_password
}
-gt
2
];
then
if
[
${
#ddns_password
}
-lt
512
];
then
ddns_is_valid=
1
fi
fi
fi
fi
fi
fi
fi
if
[
$
ddns_is_valid
];
then
/
usr
/
local
/
bin
/${
PROJECT_NAME
}
-ddns
"$
ddns
"
"$
ddns_username
"
"$
ddns_password
"
if
[
$
ddns_is_valid
];
then
/
usr
/
local
/
bin
/${
PROJECT_NAME
}
-ddns
"$
ddns
"
"$
ddns_username
"
"$
ddns_password
"
if
[
"$
ddns_code
"
];
then
if
[
${
#ddns_code
}
-gt
30
];
then
#
if
the
whole
cron
line
was
pasted
then
parse
that
if
[[
"$
ddns_code
"
==
*
'
freedns
'
*
]];
then
if
[[
"$
ddns_code
"
==
*
'?'
*
&&
"$
ddns_code
"
==
*
'='
*
]];
then
ddns_code=
$(echo
"$
ddns_code
"
|
awk
-F
'?'
'{
print
$2}'
|
awk
-F
'='
'{
print
$1}')
if
[
"$
ddns_code
"
];
then
if
[
${
#ddns_code
}
-gt
30
];
then
#
if
the
whole
cron
line
was
pasted
then
parse
that
if
[[
"$
ddns_code
"
==
*
'
freedns
'
*
]];
then
if
[[
"$
ddns_code
"
==
*
'?'
*
&&
"$
ddns_code
"
==
*
'='
*
]];
then
ddns_code=
$(echo
"$
ddns_code
"
|
awk
-F
'?'
'{
print
$2}'
|
awk
-F
'='
'{
print
$1}')
fi
fi
if
grep
-q
"
DEFAULT_DOMAIN_CODE=
" "
$
CONFIGURATION_FILE
";
then
sed
-i
"
s
|
DEFAULT_DOMAIN_CODE=
.*|DEFAULT_DOMAIN_CODE=${ddns_code}|g"
"$
CONFIGURATION_FILE
"
else
echo
"
DEFAULT_DOMAIN_CODE=
${ddns_code}"
>
> "$CONFIGURATION_FILE"
fi
fi
if
grep
-q
"
DEFAULT_DOMAIN_CODE=
" "
$
CONFIGURATION_FILE
";
then
sed
-i
"
s
|
DEFAULT_DOMAIN_CODE=
.*|DEFAULT_DOMAIN_CODE=${ddns_code}|g"
"$
CONFIGURATION_FILE
"
else
echo
"
DEFAULT_DOMAIN_CODE=
${ddns_code}"
>
> "$CONFIGURATION_FILE"
ddns_code=
fi
else
ddns_code=
fi
fi
regenerate_dynamic_dns "$ddns" "$ddns_username" "$ddns_password" "$ddns_code"
regenerate_dynamic_dns "$ddns" "$ddns_username" "$ddns_password" "$ddns_code"
fi
rm "$dynamic_dns_password_file"
fi
rm "$dynamic_dns_file"
...
...
This diff is collapsed.
Click to expand it.
webadmin/dynamicdns.php
+
6
−
2
View file @
e9e14243
...
...
@@ -40,12 +40,16 @@ if (isset($_POST['submitddnsdomain'])) {
if
(
isset
(
$_POST
[
'submitddns'
]))
{
$ddns
=
htmlspecialchars
(
$_POST
[
'dynamicdns'
]);
$ddns_username
=
htmlspecialchars
(
$_POST
[
'ddns_username'
]);
$ddns_password
=
htmlspecialchars
(
$_POST
[
'ddns_password'
]
)
;
$ddns_password
=
$_POST
[
'ddns_password'
];
$ddns_code
=
htmlspecialchars
(
$_POST
[
'ddnscode'
]);
$ddns_file
=
fopen
(
".dynamicdns.txt"
,
"w"
)
or
die
(
"Unable to create dynamicdns file"
);
fwrite
(
$ddns_file
,
$ddns
.
','
.
$ddns_username
.
','
.
$ddns_
password
.
','
.
$ddns_
code
);
fwrite
(
$ddns_file
,
$ddns
.
','
.
$ddns_username
.
','
.
$ddns_code
);
fclose
(
$ddns_file
);
$ddns_password_file
=
fopen
(
".dynamicdnspassword.txt"
,
"w"
)
or
die
(
"Unable to create dynamicdnspassword file"
);
fwrite
(
$ddns_password_file
,
$ddns_password
);
fclose
(
$ddns_password_file
);
}
$htmlfile
=
fopen
(
"
$output_filename
"
,
"r"
)
or
die
(
"Unable to open
$output_filename
"
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment