kio_sftp rewrite

Dawit A. adawit at kde.org
Mon Aug 10 14:14:39 BST 2009


On Monday 10 August 2009 05:32:48 Andreas Schneider wrote:
> On Sunday 09 August 2009 21:12:47 Dawit A. wrote:
> > Well if you have a screwed up ssh server that refuses connection like I
> > do right now, then kio_sftp with your changes SEGFAULTS and I think I
> > know why... There is a code that does the following in openConnection:
> >
> >   sftp_session = sftp_new(ssh_session);
> >   if (sftp_session == NULL) {
> >     closeConnection();
> >     return;
> >   }
>
> Hi Dawit,
>
> there should be an error() call before the return. Could you attach gdb and
> get a backtrace?
>
> > but unfortunately, closeConnection also does...
> >
> >   sftp_free(sftp_session);
> >   sftp_session = NULL;
> >
> > so if sftp_session is already NULL as in the above case, then the ioslave
> > goes down in flames. Once I get around to fixing my ssh server, I will
> > test basic functionality and let you know, but I think it should be fine
> > to commit this into the main tree on work on improving it from there, no
> > ?
>
> Hmm, it should not segfault.
>
>  226 void sftp_free(SFTP_SESSION *sftp){
>  227   struct request_queue *ptr;
>  228
>  229   if (sftp == NULL) {
>  230     return;
>  231   }

Right, the crash is not where I first assumed it would be... Here is the 
backtrace I get. Seems to be in channel_send_eof. Perhaps I should compile 
libssh in debug mode to find out exactly where, but that would have to wait for 
later...


Program received signal SIGSEGV, Segmentation fault.
0xb48c0d29 in channel_send_eof () from /usr/lib/libssh.so.3
(gdb) bt
#0  0xb48c0d29 in channel_send_eof () from /usr/lib/libssh.so.3
#1  0xb48d8df7 in sftp_free () from /usr/lib/libssh.so.3
#2  0xb5a5be8c in sftpProtocol::closeConnection (this=0xbf831338) at 
/home/dalemayehu/work/KDE/source/branches/kdebase/runtime/kioslave/sftp/kio_sftp.cpp:706
#3  0xb782fa63 in KIO::SlaveBase::dispatchLoop (this=0xbf831338) at 
/home/dalemayehu/work/KDE/source/branches/kdelibs/kio/kio/slavebase.cpp:293
#4  0xb5a5c9fe in kdemain (argc=4, argv=0x8ad97a8) at 
/home/dalemayehu/work/KDE/source/branches/kdebase/runtime/kioslave/sftp/kio_sftp.cpp:79
#5  0x0804de22 in _start ()




More information about the kde-core-devel mailing list