[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: heimdal 0.6.4 ftpd crash




> I think it somehow picks up the wrong glob strcuture/function and that
> makes it fall over.

It picks up glob.h from heimdal.

> If you run the file though cpp, is both the structure and the function
> renamed to rk_glob_t/rk_glob() ?

running ./appl/ftp/ftpd/popen.c through cpp gives no "rk_glob" strings in 
the code. Actually, there are no such strings in whole heimdal source 
tree.

But you are probably very close with the explanation what is going on, 
because if I change the includes order to take debian's glob.h, it states

425 Can't build data connection: Invalid argument.

which is still unusable, but at least no crashes occur anymore. What I 
found out in addition:

1. If I have already heimdal's glob.h in /usr/local/include (from previous 
'make install'), it is used by the next configure run and in this case 
the server crashes.
2. If there is no /usr/local/include/glob.h, Debian's /usr/include/glob.h 
is probably used by the next configure run, no crashes but the error 
mentioned above (425 Can't build data connection: Invalid argument.) 
appears.
3. If I run configure and then manually edit ./include/config.h after the 
configure run to have the following inside:

/* #define HAVE_GLOB 1 */
#undef HAVE_GLOB
/* #undef NEED_GLOB_PROTO */
#define NEED_GLOB_PROTO 1

, the ftpd server crashes again.

4. popen.c is compiled with the following line:

gcc  -DHAVE_CONFIG_H -I. -I. -I../../../include -I../../../include -I../../../lib/roken -I../../../lib/roken -I./../common  -DFTP_SERVER -Wall -Wmissing-prototypes -Wpointer-arith -Wbad-function-cast -Wmissing-declarations -Wnested-externs -g -O2 -c popen.c

and then linked as

/bin/sh ../../../libtool --mode=link gcc  -Wall -Wmissing-prototypes -Wpointer-arith -Wbad-function-cast -Wmissing-declarations -Wnested-externs -g -O2   -o ftpd  ftpcmd.o ftpd.o logwtmp.o ls.o popen.o security.o  gssapi.o gss_userok.o ../common/libcommon.a ../../../lib/otp/libotp.la ../../../lib/gssapi/libgssapi.la ../../../lib/krb5/libkrb5.la ../../../lib/asn1/libasn1.la ../../../lib/kafs/libkafs.la   -L/usr/local/lib -lcrypto  ../../../lib/vers/libvers.la ../../../lib/roken/libroken.la -lcrypt  -lresolv
mkdir .libs
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wbad-function-cast -Wmissing-declarations -Wnested-externs -g -O2 -o ftpd ftpcmd.o ftpd.o logwtmp.o ls.o popen.o security.o gssapi.o gss_userok.o  ../common/libcommon.a ../../../lib/otp/.libs/libotp.a -L/usr/local/lib ../../../lib/gssapi/.libs/libgssapi.a ../../../lib/krb5/.libs/libkrb5.a ../../../lib/asn1/.libs/libasn1.a ../../../lib/kafs/.libs/libkafs.a /scratch/install/heimdal-0.6.4/lib/krb5/.libs/libkrb5.a /scratch/install/heimdal-0.6.4/lib/asn1/.libs/libasn1.a -lcom_err /scratch/install/heimdal-0.6.4/lib/roken/.libs/libroken.a -lcrypto ../../../lib/vers/.libs/libvers.a ../../../lib/roken/.libs/libroken.a /usr/lib/libdb3.so -lcrypt -lresolv


5. Another strange thing:
'ls' and 'ls /etc' crashes the server while 'ls -l /etc' crashes the 
client. I think it show the problem is really in line 156 of popen.c, 
which could mean glob() works strange on Debian 3.1rc3. I suppose the 
problem could lie in the libroken, where should be glob.o, but glob.c 
never gets compiled to glob.o and is not part of libroken. Therefore nm 
ftpd shows that glob() and globfree() functions are not from libroken but 
from glibc 2.0
When I manually compile heimdal's glob.c and insert glob.o to libroken.a, 
I can reproduce the point (2) - error 425.

So my conclusion is heimdal's configure does not recognize that 
Debian's glob() is somehow broken and all the problems probably come from 
this. But sure, I understand the code only partially so I may be wrong.

Sincerely,

   David Komanek