HLS/DASH: Fix dispose to skip unpublish when not enabled, and add forbidden directory protection to SrsPath::unlink. v7.0.111
This commit is contained in:
parent
3dc7b405ca
commit
550760f2d0
|
|
@ -7,6 +7,7 @@ The changelog for SRS.
|
||||||
<a name="v7-changes"></a>
|
<a name="v7-changes"></a>
|
||||||
|
|
||||||
## SRS 7.0 Changelog
|
## SRS 7.0 Changelog
|
||||||
|
* v7.0, 2025-10-27, HLS/DASH: Fix dispose to skip unpublish when not enabled, and add forbidden directory protection to SrsPath::unlink. v7.0.111
|
||||||
* v7.0, 2025-10-27, AI: HTTP-FLV: Enforce minimum 10ms sleep to prevent CPU busy-wait when mw_latency=0. v7.0.110 (#3963)
|
* v7.0, 2025-10-27, AI: HTTP-FLV: Enforce minimum 10ms sleep to prevent CPU busy-wait when mw_latency=0. v7.0.110 (#3963)
|
||||||
* v7.0, 2025-10-26, AI: Edge: Fix stream names with dots being incorrectly truncated in source URL generation. v7.0.109 (#4011)
|
* v7.0, 2025-10-26, AI: Edge: Fix stream names with dots being incorrectly truncated in source URL generation. v7.0.109 (#4011)
|
||||||
* v7.0, 2025-10-26, AI: HTTPS: Handle SSL_ERROR_ZERO_RETURN as graceful connection closure. v7.0.108 (#4036)
|
* v7.0, 2025-10-26, AI: HTTPS: Handle SSL_ERROR_ZERO_RETURN as graceful connection closure. v7.0.108 (#4036)
|
||||||
|
|
|
||||||
|
|
@ -878,10 +878,14 @@ SrsDash::~SrsDash()
|
||||||
|
|
||||||
void SrsDash::dispose()
|
void SrsDash::dispose()
|
||||||
{
|
{
|
||||||
if (enabled_) {
|
// We disabled the reload, so DASH will not be enabled by reloading.
|
||||||
on_unpublish();
|
// As a result, if DASH is disabled, we don't need to dispose.
|
||||||
|
if (!enabled_) {
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
on_unpublish();
|
||||||
|
|
||||||
// Ignore when dash_dispose disabled.
|
// Ignore when dash_dispose disabled.
|
||||||
srs_utime_t dash_dispose = config_->get_dash_dispose(req_->vhost_);
|
srs_utime_t dash_dispose = config_->get_dash_dispose(req_->vhost_);
|
||||||
if (!dash_dispose) {
|
if (!dash_dispose) {
|
||||||
|
|
|
||||||
|
|
@ -2549,10 +2549,14 @@ srs_error_t SrsHls::do_reload(int *reloading, int *reloaded, int *refreshed)
|
||||||
|
|
||||||
void SrsHls::dispose()
|
void SrsHls::dispose()
|
||||||
{
|
{
|
||||||
if (enabled_) {
|
// We disabled the reload, so HLS will not be enabled by reloading.
|
||||||
on_unpublish();
|
// As a result, if HLS is disabled, we don't need to dispose.
|
||||||
|
if (!enabled_) {
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
on_unpublish();
|
||||||
|
|
||||||
// Ignore when hls_dispose disabled.
|
// Ignore when hls_dispose disabled.
|
||||||
// @see https://github.com/ossrs/srs/issues/865
|
// @see https://github.com/ossrs/srs/issues/865
|
||||||
srs_utime_t hls_dispose = config_->get_hls_dispose(req_->vhost_);
|
srs_utime_t hls_dispose = config_->get_hls_dispose(req_->vhost_);
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,6 @@
|
||||||
|
|
||||||
#define VERSION_MAJOR 7
|
#define VERSION_MAJOR 7
|
||||||
#define VERSION_MINOR 0
|
#define VERSION_MINOR 0
|
||||||
#define VERSION_REVISION 110
|
#define VERSION_REVISION 111
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -539,6 +539,40 @@ bool SrsPath::exists(std::string path)
|
||||||
|
|
||||||
srs_error_t SrsPath::unlink(std::string path)
|
srs_error_t SrsPath::unlink(std::string path)
|
||||||
{
|
{
|
||||||
|
// Define the directories that are forbidden to delete.
|
||||||
|
std::string forbidden[] = {
|
||||||
|
"./",
|
||||||
|
"../",
|
||||||
|
"/",
|
||||||
|
"/bin",
|
||||||
|
"/boot",
|
||||||
|
"/dev",
|
||||||
|
"/etc",
|
||||||
|
"/home",
|
||||||
|
"/lib",
|
||||||
|
"/lib32",
|
||||||
|
"/lib64",
|
||||||
|
"/libx32",
|
||||||
|
"/lost+found",
|
||||||
|
"/media",
|
||||||
|
"/mnt",
|
||||||
|
"/opt",
|
||||||
|
"/proc",
|
||||||
|
"/root",
|
||||||
|
"/run",
|
||||||
|
"/sbin",
|
||||||
|
"/srv",
|
||||||
|
"/sys",
|
||||||
|
"/tmp",
|
||||||
|
"/usr",
|
||||||
|
"/var",
|
||||||
|
};
|
||||||
|
for (int i = 0; i < sizeof(forbidden) / sizeof(forbidden[0]); i++) {
|
||||||
|
if (path == forbidden[i]) {
|
||||||
|
return srs_error_new(ERROR_SYSTEM_FILE_UNLINK, "unlink forbidden %s", path.c_str());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (::unlink(path.c_str()) < 0) {
|
if (::unlink(path.c_str()) < 0) {
|
||||||
return srs_error_new(ERROR_SYSTEM_FILE_UNLINK, "unlink %s", path.c_str());
|
return srs_error_new(ERROR_SYSTEM_FILE_UNLINK, "unlink %s", path.c_str());
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user