|
6 | 6 |
|
7 | 7 | #include <ngx_config.h>
|
8 | 8 | #include <ngx_core.h>
|
| 9 | +#include <ngx_md5.h> |
9 | 10 | #include "ngx_rtmp.h"
|
10 | 11 | #include "ngx_rtmp_cmd_module.h"
|
11 | 12 | #include "ngx_rtmp_netcall_module.h"
|
@@ -979,6 +980,22 @@ ngx_rtmp_notify_connect_handle(ngx_rtmp_session_t *s,
|
979 | 980 | }
|
980 | 981 |
|
981 | 982 |
|
| 983 | +static void |
| 984 | +ngx_rtmp_notify_set_name(u_char *dst, size_t dst_len, u_char *src, |
| 985 | + size_t src_len) |
| 986 | +{ |
| 987 | + u_char result[16], *p; |
| 988 | + ngx_md5_t md5; |
| 989 | + |
| 990 | + ngx_md5_init(&md5); |
| 991 | + ngx_md5_update(&md5, src, src_len); |
| 992 | + ngx_md5_final(result, &md5); |
| 993 | + |
| 994 | + p = ngx_hex_dump(dst, result, ngx_min((dst_len - 1) / 2, 16)); |
| 995 | + *p = '\0'; |
| 996 | +} |
| 997 | + |
| 998 | + |
982 | 999 | static ngx_int_t
|
983 | 1000 | ngx_rtmp_notify_publish_handle(ngx_rtmp_session_t *s,
|
984 | 1001 | void *arg, ngx_chain_t *in)
|
@@ -1025,7 +1042,7 @@ ngx_rtmp_notify_publish_handle(ngx_rtmp_session_t *s,
|
1025 | 1042 |
|
1026 | 1043 | nacf = ngx_rtmp_get_module_app_conf(s, ngx_rtmp_notify_module);
|
1027 | 1044 | if (nacf->relay_redirect) {
|
1028 |
| - *ngx_cpymem(v->name, name, rc) = 0; |
| 1045 | + ngx_rtmp_notify_set_name(v->name, NGX_RTMP_MAX_NAME, name, (size_t) rc); |
1029 | 1046 | }
|
1030 | 1047 |
|
1031 | 1048 | ngx_log_error(NGX_LOG_ERR, s->connection->log, 0,
|
@@ -1104,7 +1121,7 @@ ngx_rtmp_notify_play_handle(ngx_rtmp_session_t *s,
|
1104 | 1121 |
|
1105 | 1122 | nacf = ngx_rtmp_get_module_app_conf(s, ngx_rtmp_notify_module);
|
1106 | 1123 | if (nacf->relay_redirect) {
|
1107 |
| - *ngx_cpymem(v->name, name, rc) = 0; |
| 1124 | + ngx_rtmp_notify_set_name(v->name, NGX_RTMP_MAX_NAME, name, (size_t) rc); |
1108 | 1125 | }
|
1109 | 1126 |
|
1110 | 1127 | ngx_log_error(NGX_LOG_INFO, s->connection->log, 0,
|
|
0 commit comments