# proftpd doesn't load shared libs



## Sabbasth (Jul 25, 2012)

Hi,

I can't make proftpd to use the shared libs.
I think proftpd doesn't load modules, but I don't understand what's happening.

I installed proftpd from port ftp/proftpd. DSO (which is important here) is correctly compiled. I installed mysql module from port databases/proftpd-mod_sql_mysql.

Everything seems OK :

```
Compiled-in modules:
  mod_core.c
  mod_xfer.c
  mod_auth_unix.c
  mod_auth_file.c
  mod_auth.c
  mod_ls.c
  mod_log.c
  mod_site.c
  mod_delay.c
  mod_facts.c
  mod_dso.c
  mod_ident.c
  mod_auth_pam.c
  mod_ctrls.c
  mod_lang.c
```


```
Compile-time Settings:
  Version: 1.3.4a (maint)
  Platform: FREEBSD9 (FREEBSD9_0) [FreeBSD 9.0-RELEASE amd64]
  Built: Fri Jul 20 2012 10:35:44 CEST
  Built With:
    configure  '--localstatedir=/var/run' '--libexecdir=/usr/local/libexec/proftpd' '--with-pkgconfig=libdata/pkgconfig' '--sysconfdir=/usr/local/etc' '--enable-ctrls' '--enable-dso' '--disable-sendfile' '--enable-ipv6' '--enable-nls' '--enable-pcre' '--enable-memcache' '--with-shared=mod_ban:mod_copy:mod_ctrls_admin:mod_deflate:mod_dynmasq:mod_exec:mod_ifsession:mod_ifversion:mod_qos:mod_quotatab:mod_quotatab_file:mod_quotatab_radius:mod_quotatab_sql:mod_radius:mod_ratio:mod_readme:mod_rewrite:mod_sftp:mod_sftp_pam:mod_sftp_sql:mod_shaper:mod_site_misc:mod_sql:mod_sql_passwd:mod_tls:mod_tls_shmcache:mod_unique_id:mod_wrap2:mod_wrap2_file:mod_wrap2_sql:mod_memcache:mod_tls_memcache' '--with-includes=/usr/local/include' '--with-libraries=/usr/local/lib' '--prefix=/usr/local' '--mandir=/usr/local/man' '--infodir=/usr/local/info/' '--build=amd64-portbld-freebsd9.0' 'build_alias=amd64-portbld-freebsd9.0' 'CC=cc' 'CFLAGS=-O2 -pipe -DHAVE_OPENSSL -I/usr/include -fno-strict-aliasing' 'LDFLAGS= -rpath=/usr/lib:/usr/local/lib' 'LIBS=-lssl -lcrypto -L/usr/lib -lintl -L/usr/local/lib -lmemcached -lmemcachedutil' 'CPPFLAGS=' 'CPP=cpp'

  CFLAGS: -O2 -pipe -DHAVE_OPENSSL -I/usr/include -fno-strict-aliasing -Wall
  LDFLAGS: -L$(top_srcdir)/lib  -rpath=/usr/lib:/usr/local/lib -L/usr/local/lib
  LIBS: -lintl  -lpcreposix -lpcre -lssl -lcrypto -lpam -lsupp -lcrypt -lssl -lcrypto -L/usr/lib -lintl -L/usr/local/lib -lmemcached -lmemcachedutil -liconv -lutil

  Files:
    Configuration File:
      /usr/local/etc/proftpd.conf
    Pid File:
      /var/run/proftpd.pid
    Scoreboard File:
      /var/run/proftpd.scoreboard
    Header Directory:
      /usr/local/include/proftpd
    Shared Module Directory:
      /usr/local/libexec/proftpd

  Features:
    - Autoshadow support
    + Controls support
    + curses support
    - Developer support
    + DSO support
    + IPv6 support
    + Largefile support
    - Lastlog support
    + Memcache support
    + ncursesw support
    + NLS support
    + OpenSSL support
    + PCRE support
    - POSIX ACL support
    - Shadow file suppport
    - Sendfile support
    + Trace support

  Tunable Options:
    PR_TUNABLE_BUFFER_SIZE = 1024
    PR_TUNABLE_DEFAULT_RCVBUFSZ = 8192
    PR_TUNABLE_DEFAULT_SNDBUFSZ = 8192
    PR_TUNABLE_GLOBBING_MAX_MATCHES = 100000
    PR_TUNABLE_GLOBBING_MAX_RECURSION = 8
    PR_TUNABLE_HASH_TABLE_SIZE = 40
    PR_TUNABLE_NEW_POOL_SIZE = 512
    PR_TUNABLE_SCOREBOARD_BUFFER_SIZE = 80
    PR_TUNABLE_SCOREBOARD_SCRUB_TIMER = 30
    PR_TUNABLE_SELECT_TIMEOUT = 30
    PR_TUNABLE_TIMEOUTIDENT = 10
    PR_TUNABLE_TIMEOUTIDLE = 600
    PR_TUNABLE_TIMEOUTLINGER = 30
    PR_TUNABLE_TIMEOUTLOGIN = 300
    PR_TUNABLE_TIMEOUTNOXFER = 300
    PR_TUNABLE_TIMEOUTSTALLED = 3600
    PR_TUNABLE_XFER_SCOREBOARD_UPDATES = 10
```

As we can see, Shared Module Directory is /usr/local/libexec/proftpd/, and files are correctly there:

```
ls -hl /usr/local/libexec/proftpd | egrep "sql|ban"
-rw-r--r--  1 root  wheel    68k Jul 20 10:52 mod_ban.a
-rwxr-xr-x  1 root  wheel     1k Jul 20 10:52 mod_ban.la
-rwxr-xr-x  1 root  wheel    43k Jul 20 10:52 mod_ban.so
-rw-r--r--  1 root  wheel    14k Jul 20 10:52 mod_quotatab_sql.a
-rwxr-xr-x  1 root  wheel   1.1k Jul 20 10:52 mod_quotatab_sql.la
-rwxr-xr-x  1 root  wheel    12k Jul 20 10:52 mod_quotatab_sql.so
-rw-r--r--  1 root  wheel    15k Jul 20 10:52 mod_sftp_sql.a
-rwxr-xr-x  1 root  wheel   1.0k Jul 20 10:52 mod_sftp_sql.la
-rwxr-xr-x  1 root  wheel    13k Jul 20 10:52 mod_sftp_sql.so
-rw-r--r--  1 root  wheel   134k Jul 20 10:52 mod_sql.a
-rwxr-xr-x  1 root  wheel     1k Jul 20 10:52 mod_sql.la
-rwxr-xr-x  1 root  wheel    77k Jul 20 10:52 mod_sql.so
-rw-r--r--  1 root  wheel    29k Jul 25 11:20 mod_sql_mysql.a
-rwxr-xr-x  1 root  wheel   1.1k Jul 25 11:20 mod_sql_mysql.la
-rwxr-xr-x  1 root  wheel    23k Jul 25 11:20 mod_sql_mysql.so
-rw-r--r--  1 root  wheel    23k Jul 20 10:52 mod_sql_passwd.a
-rwxr-xr-x  1 root  wheel   1.0k Jul 20 10:52 mod_sql_passwd.la
-rwxr-xr-x  1 root  wheel    19k Jul 20 10:52 mod_sql_passwd.so
-rw-r--r--  1 root  wheel   8.1k Jul 20 10:52 mod_wrap2_sql.a
-rwxr-xr-x  1 root  wheel   1.0k Jul 20 10:52 mod_wrap2_sql.la
-rwxr-xr-x  1 root  wheel   8.7k Jul 20 10:52 mod_wrap2_sql.so
```

I tried to use SQL and BAN directives in the config file, but it generates errors:

```
proftpd -t
proftpd[26330]: Fatal: unknown configuration directive 'BanLog' on line 1 of '/usr/local/etc/proftpd.conf'
Fatal: unknown configuration directive 'SQLAuthTypes' on line 49 of '/usr/local/etc/proftpd.conf'
```

Does anyone has resolved this issue yet?


----------



## Sabbasth (Jul 25, 2012)

I just found the answer, I have to load the modules explicitly:


```
LoadModule mod_sql.c
LoadModule mod_sql_mysql.c
LoadModule mod_ban.c
```

According to the official proftpd documentation.


----------



## Quip (Jul 26, 2012)

It was mentioned in /usr/ports/UPDATING

20120126:
  AFFECTS: users of ftp/proftpd and ftp/proftpd-mysql

http://www.freebsd.org/cgi/cvsweb.cgi/ports/UPDATING?rev=1.1197;content-type=text/plain


----------



## chrcol (Aug 4, 2012)

This doesnt even run on 9.0 for more than 5 seconds, I did find some info where some funky stuff happens causing it to shutdown within seconds, although it only supposedbly affects it when mod_mysql is used but I am not using mod_mysql.  It's working fine on all my 8.x boxes.

when running in foreground debug mode it terminates with this.


```
Alarm clock: 14
```

http://comments.gmane.org/gmane.network.proftpd.user/8486


----------



## chrcol (Aug 4, 2012)

I found solution and cause for the 9.0 problem, I will send to the port maintainer, in short it occurs when openssl is compiled with threads, and proftpd does not pick up on this and compiles without threads.  I edited the Makefile to force it to match openssl and it resolved my issue, ironically I got the fix from a gentoo page as they had the same issues.

https://bugs.gentoo.org/show_bug.cgi?id=422941
http://bugs.proftpd.org/show_bug.cgi?id=3795


----------

