<p>To be honest i dont understand the code in detail, but i hope this helps:</p>
<pre><code>xlog("L_INFO", "MY_LOG HANDLE_TLS tls_peer_subject         : $tls_peer_subject\n");
xlog("L_INFO", "MY_LOG HANDLE_TLS tls_peer_subject_uid:    : $tls_peer_subject_uid\n");
xlog("L_INFO", "MY_LOG HANDLE_TLS sel(tls.peer.subject)    : $sel(tls.peer.subject)\n");
xlog("L_INFO", "MY_LOG HANDLE_TLS sel(tls.peer.subject.uid): $sel(tls.peer.subject.uid)\n");
xlog("L_INFO", "MY_LOG: HANDLE_TLS add Header X-TLS-User: $sel(tls.peer.subject.uid)\n");
</code></pre>
<pre><code>Feb 14 08:59:44 edgar-dev kamailio[4078]: 11(4091) DEBUG: tls [tls_select.c:709]: get_comp(): after X509_NAME_get_index_by_NID index = 1
Feb 14 08:59:44 edgar-dev kamailio[4078]: 11(4091) DEBUG: <core> [core/select.c:412]: run_select(): Calling SELECT 0x7f5b79367388
Feb 14 08:59:44 edgar-dev kamailio[4078]: 11(4091) DEBUG: tls [tls_select.c:709]: get_comp(): after X509_NAME_get_index_by_NID index = 2
Feb 14 08:59:44 edgar-dev kamailio[4078]: 11(4091) DEBUG: tls [tls_select.c:784]: pv_comp(): ind_local = 6
Feb 14 08:59:44 edgar-dev kamailio[4078]: 11(4091) DEBUG: tls [tls_select.c:808]: pv_comp(): ind_local before switch = 0
Feb 14 08:59:44 edgar-dev kamailio[4078]: 11(4091) DEBUG: tls [tls_select.c:709]: get_comp(): after X509_NAME_get_index_by_NID index = ffffffff
Feb 14 08:59:44 edgar-dev kamailio[4078]: 11(4091) DEBUG: tls [tls_select.c:711]: get_comp(): nid = 0
Feb 14 08:59:44 edgar-dev kamailio[4078]: 11(4091) DEBUG: tls [tls_select.c:722]: get_comp(): Element Unknown not found in certificate subject/issuer
Feb 14 08:59:44 edgar-dev kamailio[4078]: 11(4091) INFO: <script>: MY_LOG HANDLE_TLS tls_peer_subject         : <null>
Feb 14 08:59:44 edgar-dev kamailio[4078]: 11(4091) DEBUG: tls [tls_select.c:784]: pv_comp(): ind_local = 100006
Feb 14 08:59:44 edgar-dev kamailio[4078]: 11(4091) DEBUG: tls [tls_select.c:808]: pv_comp(): ind_local before switch = 100000
Feb 14 08:59:44 edgar-dev kamailio[4078]: 11(4091) DEBUG: tls [tls_select.c:709]: get_comp(): after X509_NAME_get_index_by_NID index = 0
Feb 14 08:59:44 edgar-dev kamailio[4078]: 11(4091) INFO: <script>: MY_LOG HANDLE_TLS tls_peer_subject_uid:    : denzs
Feb 14 08:59:44 edgar-dev kamailio[4078]: 11(4091) DEBUG: <core> [core/select.c:412]: run_select(): Calling SELECT 0x7f5b79351a38
Feb 14 08:59:44 edgar-dev kamailio[4078]: 11(4091) DEBUG: tls [tls_select.c:709]: get_comp(): after X509_NAME_get_index_by_NID index = 1
Feb 14 08:59:44 edgar-dev kamailio[4078]: 11(4091) INFO: <script>: MY_LOG HANDLE_TLS sel(tls.peer.subject)    : Sebastian Denz
Feb 14 08:59:44 edgar-dev kamailio[4078]: 11(4091) DEBUG: <core> [core/select.c:412]: run_select(): Calling SELECT 0x7f5b7939bea0
Feb 14 08:59:44 edgar-dev kamailio[4078]: 11(4091) DEBUG: tls [tls_select.c:709]: get_comp(): after X509_NAME_get_index_by_NID index = 0
Feb 14 08:59:44 edgar-dev kamailio[4078]: 11(4091) INFO: <script>: MY_LOG HANDLE_TLS sel(tls.peer.subject.uid): denzs
Feb 14 08:59:44 edgar-dev kamailio[4078]: 11(4091) DEBUG: <core> [core/select.c:412]: run_select(): Calling SELECT 0x7f5b7939bea0
Feb 14 08:59:44 edgar-dev kamailio[4078]: 11(4091) DEBUG: tls [tls_select.c:709]: get_comp(): after X509_NAME_get_index_by_NID index = 0
Feb 14 08:59:44 edgar-dev kamailio[4078]: 11(4091) INFO: <script>: MY_LOG: HANDLE_TLS add Header X-TLS-User: denzs
Feb 14 08:59:44 edgar-dev kamailio[4078]: 11(4091) DEBUG: <core> [core/parser/msg_parser.c:185]: get_hdr_field(): content_length=0
Feb 14 08:59:44 edgar-dev kamailio[4078]: 11(4091) DEBUG: <core> [core/parser/msg_parser.c:89]: get_hdr_field(): found end of header
Feb 14 08:59:44 edgar-dev kamailio[4078]: 11(4091) DEBUG: <core> [core/select.c:412]: run_select(): Calling SELECT 0x7f5b7939bea0
Feb 14 08:59:44 edgar-dev kamailio[4078]: 11(4091) DEBUG: tls [tls_select.c:709]: get_comp(): after X509_NAME_get_index_by_NID index = 0
</code></pre>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/kamailio/kamailio/issues/1843#issuecomment-463530344">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AF36ZbmlZNVQl63tRwnTIhTToo-QeDdNks5vNRhdgaJpZM4avSnU">mute the thread</a>.<img src="https://github.com/notifications/beacon/AF36ZZl6-ADT0ArpnDYxMnaTvoMHcovYks5vNRhdgaJpZM4avSnU.gif" height="1" width="1" alt="" /></p>
<script type="application/json" data-scope="inboxmarkup">{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/kamailio/kamailio","title":"kamailio/kamailio","subtitle":"GitHub repository","main_image_url":"https://github.githubassets.com/images/email/message_cards/header.png","avatar_image_url":"https://github.githubassets.com/images/email/message_cards/avatar.png","action":{"name":"Open in GitHub","url":"https://github.com/kamailio/kamailio"}},"updates":{"snippets":[{"icon":"PERSON","message":"@denzs in #1843: To be honest i dont understand the code in detail, but i hope this helps:\r\n```\r\nxlog(\"L_INFO\", \"MY_LOG HANDLE_TLS tls_peer_subject         : $tls_peer_subject\\n\");\r\nxlog(\"L_INFO\", \"MY_LOG HANDLE_TLS tls_peer_subject_uid:    : $tls_peer_subject_uid\\n\");\r\nxlog(\"L_INFO\", \"MY_LOG HANDLE_TLS sel(tls.peer.subject)    : $sel(tls.peer.subject)\\n\");\r\nxlog(\"L_INFO\", \"MY_LOG HANDLE_TLS sel(tls.peer.subject.uid): $sel(tls.peer.subject.uid)\\n\");\r\nxlog(\"L_INFO\", \"MY_LOG: HANDLE_TLS add Header X-TLS-User: $sel(tls.peer.subject.uid)\\n\");\r\n```\r\n\r\n```\r\nFeb 14 08:59:44 edgar-dev kamailio[4078]: 11(4091) DEBUG: tls [tls_select.c:709]: get_comp(): after X509_NAME_get_index_by_NID index = 1\r\nFeb 14 08:59:44 edgar-dev kamailio[4078]: 11(4091) DEBUG: \u003ccore\u003e [core/select.c:412]: run_select(): Calling SELECT 0x7f5b79367388\r\nFeb 14 08:59:44 edgar-dev kamailio[4078]: 11(4091) DEBUG: tls [tls_select.c:709]: get_comp(): after X509_NAME_get_index_by_NID index = 2\r\nFeb 14 08:59:44 edgar-dev kamailio[4078]: 11(4091) DEBUG: tls [tls_select.c:784]: pv_comp(): ind_local = 6\r\nFeb 14 08:59:44 edgar-dev kamailio[4078]: 11(4091) DEBUG: tls [tls_select.c:808]: pv_comp(): ind_local before switch = 0\r\nFeb 14 08:59:44 edgar-dev kamailio[4078]: 11(4091) DEBUG: tls [tls_select.c:709]: get_comp(): after X509_NAME_get_index_by_NID index = ffffffff\r\nFeb 14 08:59:44 edgar-dev kamailio[4078]: 11(4091) DEBUG: tls [tls_select.c:711]: get_comp(): nid = 0\r\nFeb 14 08:59:44 edgar-dev kamailio[4078]: 11(4091) DEBUG: tls [tls_select.c:722]: get_comp(): Element Unknown not found in certificate subject/issuer\r\nFeb 14 08:59:44 edgar-dev kamailio[4078]: 11(4091) INFO: \u003cscript\u003e: MY_LOG HANDLE_TLS tls_peer_subject         : \u003cnull\u003e\r\nFeb 14 08:59:44 edgar-dev kamailio[4078]: 11(4091) DEBUG: tls [tls_select.c:784]: pv_comp(): ind_local = 100006\r\nFeb 14 08:59:44 edgar-dev kamailio[4078]: 11(4091) DEBUG: tls [tls_select.c:808]: pv_comp(): ind_local before switch = 100000\r\nFeb 14 08:59:44 edgar-dev kamailio[4078]: 11(4091) DEBUG: tls [tls_select.c:709]: get_comp(): after X509_NAME_get_index_by_NID index = 0\r\nFeb 14 08:59:44 edgar-dev kamailio[4078]: 11(4091) INFO: \u003cscript\u003e: MY_LOG HANDLE_TLS tls_peer_subject_uid:    : denzs\r\nFeb 14 08:59:44 edgar-dev kamailio[4078]: 11(4091) DEBUG: \u003ccore\u003e [core/select.c:412]: run_select(): Calling SELECT 0x7f5b79351a38\r\nFeb 14 08:59:44 edgar-dev kamailio[4078]: 11(4091) DEBUG: tls [tls_select.c:709]: get_comp(): after X509_NAME_get_index_by_NID index = 1\r\nFeb 14 08:59:44 edgar-dev kamailio[4078]: 11(4091) INFO: \u003cscript\u003e: MY_LOG HANDLE_TLS sel(tls.peer.subject)    : Sebastian Denz\r\nFeb 14 08:59:44 edgar-dev kamailio[4078]: 11(4091) DEBUG: \u003ccore\u003e [core/select.c:412]: run_select(): Calling SELECT 0x7f5b7939bea0\r\nFeb 14 08:59:44 edgar-dev kamailio[4078]: 11(4091) DEBUG: tls [tls_select.c:709]: get_comp(): after X509_NAME_get_index_by_NID index = 0\r\nFeb 14 08:59:44 edgar-dev kamailio[4078]: 11(4091) INFO: \u003cscript\u003e: MY_LOG HANDLE_TLS sel(tls.peer.subject.uid): denzs\r\nFeb 14 08:59:44 edgar-dev kamailio[4078]: 11(4091) DEBUG: \u003ccore\u003e [core/select.c:412]: run_select(): Calling SELECT 0x7f5b7939bea0\r\nFeb 14 08:59:44 edgar-dev kamailio[4078]: 11(4091) DEBUG: tls [tls_select.c:709]: get_comp(): after X509_NAME_get_index_by_NID index = 0\r\nFeb 14 08:59:44 edgar-dev kamailio[4078]: 11(4091) INFO: \u003cscript\u003e: MY_LOG: HANDLE_TLS add Header X-TLS-User: denzs\r\nFeb 14 08:59:44 edgar-dev kamailio[4078]: 11(4091) DEBUG: \u003ccore\u003e [core/parser/msg_parser.c:185]: get_hdr_field(): content_length=0\r\nFeb 14 08:59:44 edgar-dev kamailio[4078]: 11(4091) DEBUG: \u003ccore\u003e [core/parser/msg_parser.c:89]: get_hdr_field(): found end of header\r\nFeb 14 08:59:44 edgar-dev kamailio[4078]: 11(4091) DEBUG: \u003ccore\u003e [core/select.c:412]: run_select(): Calling SELECT 0x7f5b7939bea0\r\nFeb 14 08:59:44 edgar-dev kamailio[4078]: 11(4091) DEBUG: tls [tls_select.c:709]: get_comp(): after X509_NAME_get_index_by_NID index = 0\r\n```"}],"action":{"name":"View Issue","url":"https://github.com/kamailio/kamailio/issues/1843#issuecomment-463530344"}}}</script>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/kamailio/kamailio/issues/1843#issuecomment-463530344",
"url": "https://github.com/kamailio/kamailio/issues/1843#issuecomment-463530344",
"name": "View Issue"
},
"description": "View this Issue on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>