diff --git a/ngx_rtmp_notify_module.c b/ngx_rtmp_notify_module.c index 532f2da..3829ae0 100644 --- a/ngx_rtmp_notify_module.c +++ b/ngx_rtmp_notify_module.c @@ -6,6 +6,7 @@ #include #include +#include #include "ngx_rtmp.h" #include "ngx_rtmp_cmd_module.h" #include "ngx_rtmp_netcall_module.h" @@ -979,6 +980,22 @@ ngx_rtmp_notify_connect_handle(ngx_rtmp_session_t *s, } +static void +ngx_rtmp_notify_set_name(u_char *dst, size_t dst_len, u_char *src, + size_t src_len) +{ + u_char result[16], *p; + ngx_md5_t md5; + + ngx_md5_init(&md5); + ngx_md5_update(&md5, src, src_len); + ngx_md5_final(result, &md5); + + p = ngx_hex_dump(dst, result, ngx_min((dst_len - 1) / 2, 16)); + *p = '\0'; +} + + static ngx_int_t ngx_rtmp_notify_publish_handle(ngx_rtmp_session_t *s, void *arg, ngx_chain_t *in) @@ -1025,7 +1042,7 @@ ngx_rtmp_notify_publish_handle(ngx_rtmp_session_t *s, nacf = ngx_rtmp_get_module_app_conf(s, ngx_rtmp_notify_module); if (nacf->relay_redirect) { - *ngx_cpymem(v->name, name, rc) = 0; + ngx_rtmp_notify_set_name(v->name, NGX_RTMP_MAX_NAME, name, (size_t) rc); } ngx_log_error(NGX_LOG_ERR, s->connection->log, 0, @@ -1104,7 +1121,7 @@ ngx_rtmp_notify_play_handle(ngx_rtmp_session_t *s, nacf = ngx_rtmp_get_module_app_conf(s, ngx_rtmp_notify_module); if (nacf->relay_redirect) { - *ngx_cpymem(v->name, name, rc) = 0; + ngx_rtmp_notify_set_name(v->name, NGX_RTMP_MAX_NAME, name, (size_t) rc); } ngx_log_error(NGX_LOG_INFO, s->connection->log, 0,