Ticket refs #16060: TR-069: method to download ubus-x certificates/keys

This commit is contained in:
Omar Kallel 2018-11-01 13:43:36 +01:00
parent 20ee304560
commit 1d2362e493
3 changed files with 35 additions and 6 deletions

View file

@ -177,3 +177,26 @@ icwmp_apply_vendor_configuration()
fi
}
icwmp_apply_ca_ssl_certificate_key()
{
local fault_code="9000"
local current_file="/tmp/owsd-repeater-control-cert.pem"
# if [ $# -gt 0 ]; then
# current_file="/tmp/$1"
# fi
cert=`uci get owsd.ubusproxy.peer_cert`
# i=1
# test=true
# path=""
# while [[ $test ]]
# do
# i=$((i+1))
# command="echo $cert | awk -F\"/\" '{print \$$i}'"
# dir=`eval $command`
# if [[ -z $dir ]]; then break; fi
# path=$path"/"$dir
# if [ ! -d $path ]; then mkdir $path; fi
# done
cp $current_file $cert
}

View file

@ -321,6 +321,9 @@ handle_action() {
mv /tmp/icwmp_download /tmp/vendor_configuration_file.cfg 2> /dev/null
fi
icwmp_fault_output "" "$FAULT_CPE_NO_FAULT"
elif [ "$__arg3" = "6" ]; then
mv /tmp/icwmp_download /tmp/owsd-repeater-control-cert.pem 2> /dev/null
icwmp_fault_output "" "$FAULT_CPE_NO_FAULT"
else
let fault_code=$fault_code+$FAULT_CPE_DOWNLOAD_FAILURE
icwmp_fault_output "" "$fault_code"
@ -433,6 +436,7 @@ handle_action() {
icwmp_apply_vendor_configuration
fi
;;
6) icwmp_apply_ca_ssl_certificate_key ;;
esac
fi

14
xml.c
View file

@ -2521,7 +2521,7 @@ void *thread_cwmp_rpc_cpe_download (void *v)
}
free(fault_code);
if((error == FAULT_CPE_NO_FAULT) &&
(pdownload->file_type[0] == '1' || pdownload->file_type[0] == '3'))
(pdownload->file_type[0] == '1' || pdownload->file_type[0] == '3' || pdownload->file_type[0] == '6'))
{
exit(EXIT_SUCCESS);
}
@ -2714,7 +2714,7 @@ void *thread_cwmp_rpc_cpe_schedule_download (void *v)
}
free(fault_code);
if((error == FAULT_CPE_NO_FAULT) &&
(current_download->file_type[0] == '1' || current_download->file_type[0] == '3'))
(current_download->file_type[0] == '1' || current_download->file_type[0] == '3' || current_download->file_type[0] == '6'))
{
exit(EXIT_SUCCESS);
}
@ -2783,7 +2783,7 @@ void *thread_cwmp_rpc_cpe_schedule_download (void *v)
}
free(fault_code);
if((error == FAULT_CPE_NO_FAULT) &&
(current_download->file_type[0] == '1' || current_download->file_type[0] == '3'))
(current_download->file_type[0] == '1' || current_download->file_type[0] == '3' || current_download->file_type[0] == '6'))
{
exit(EXIT_SUCCESS);
}
@ -2975,7 +2975,7 @@ void *thread_cwmp_rpc_cpe_apply_schedule_download (void *v)
}
free(fault_code);
if((error == FAULT_CPE_NO_FAULT) &&
(apply_download->file_type[0] == '1' || apply_download->file_type[0] == '3'))
(apply_download->file_type[0] == '1' || apply_download->file_type[0] == '3' || apply_download->file_type[0] == '6'))
{
exit(EXIT_SUCCESS);
}
@ -4132,7 +4132,8 @@ int cwmp_handle_rpc_cpe_download(struct session *session, struct rpc *rpc)
if(strcmp(file_type,"1 Firmware Upgrade Image") &&
strcmp(file_type,"2 Web Content") &&
strcmp(file_type,"3 Vendor Configuration File"))
strcmp(file_type,"3 Vendor Configuration File") &&
strcmp(file_type,"6 CWMP CA SSL Certificate File"))
{
error = FAULT_CPE_INVALID_ARGUMENTS;
}
@ -4398,7 +4399,8 @@ int cwmp_handle_rpc_cpe_schedule_download(struct session *session, struct rpc *r
strcmp(file_type,"2 Web Content") &&
strcmp(file_type,"3 Vendor Configuration File") &&
strcmp(file_type,"4 Tone File") &&
strcmp(file_type,"5 Ringer File"))
strcmp(file_type,"5 Ringer File") &&
strcmp(file_type,"6 CWMP CA SSL Certificate File"))
{
error = FAULT_CPE_INVALID_ARGUMENTS;
}