I am away in Venezuela until Tuesday, so I think Federico will get a
chance to look at this first, but it is very streightforward. In any
case, I think it should make the next release. Incidently, there is a
Common C++ function to get user login id, Process::getUser(), it is
portable, and maybe that is what should be used here. On posix it does
the user lookup by matching the uid of the process to the passwd file
rather than using the environment. On w32, it uses "GetUserName".
Michel de Boer wrote:
Hi David, Federico,
I have been debugging a segmentation fault that only happened on
one machine. After a lot of debugging I found the cause. The
backtrace I get is:
#7 0x41161903 in strlen () from /lib/tls/libc.so.6
#8 0x401b59eb in ost::RTPApplication::findCNAME (this=0x0)
at char_traits.h:143
#9 0x401b5c49 in RTPApplication (this=0x401c9d80, [EMAIL PROTECTED])
at source.cpp:161
#10 0x401b5d16 in ost::defaultApplication () at stl_alloc.h:652
#11 0x081ad0dc in t_twinkle_rtp_session (this=0x84bb668, [EMAIL PROTECTED],
port=5004) at twinkle_rtp_session.cpp:6
#12 0x081a0b1f in t_audio_session (this=0x83acd10, _session=0x84ae35c,
[EMAIL PROTECTED], _recv_port=5004, [EMAIL PROTECTED],
_dst_port=12668, _codec=139125596, _ptime=20) at basic_string.h:716
I found that this crash can happen for 2 reasons:
1) LOGNAME is not set
2) The hostname is not in /etc/hosts
In both cases ccrtp tries to use a NULL pointer.
Attached you find a patch that fixes the problem. I hope you will fix
this in the next release.
Best regards,
Michel
------------------------------------------------------------------------
--- ccrtp-1.3.5/src/source.cpp 2005-01-24 16:14:55.000000000 +0100
+++ ccrtp-1.3.5-patched/src/source.cpp 2005-11-26 18:05:11.000000000 +0100
@@ -76,7 +76,7 @@
// customization of the environment.
// Try both LOGNAME and USER env. var.
const char *user = Process::getEnv("LOGNAME");
- if ( !strcmp(user,"") )
+ if ( !user || !strcmp(user,"") )
user = Process::getEnv("USER");
if ( user )
username = user;
@@ -231,9 +231,18 @@
// build string [EMAIL PROTECTED]
std::string username;
findusername(username);
-
+
+ // First create an InetHostAddress object, otherwise the
+ // object will be destructed and the hostname corrupted.
+ InetHostAddress iha;
+ const char *p = iha.getHostname();
+
+ // Returned hostname can be NULL
+ std::string hname;
+ if (p) hname = p;
+
setSDESItem(SDESItemTypeCNAME,
- username + "@" + InetHostAddress().getHostname());
+ username + "@" + hname);
}
#ifdef CCXX_NAMESPACES
------------------------------------------------------------------------
_______________________________________________
Ccrtp-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/ccrtp-devel
begin:vcard
fn:David Sugar
n:Sugar;David
org:GNU Telephony
adr:;;;;;;USA
email;internet:[EMAIL PROTECTED]
tel;work:+1 201 215 2609
x-mozilla-html:FALSE
url:http://www.gnutelephony.org
version:2.1
end:vcard
_______________________________________________
Ccrtp-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/ccrtp-devel