Getting directory_administrator-1.7 to build and run from source

Richard Bullington-McGuire <[email protected]> Sun, 31 Jul 2005 12:34:49 -0400 (EDT)
Newsgroups gmane.network.directoryadmin
Message-ID <[email protected]>
Thank you for continuing to develop directory_administrator.

As I've explored the alternatives for managing users and groups in an LDAP 
directory, I ran across version 1.6 of Directory Administrator. As I'm 
using RHEL 3, I had to rebuild the 
directory_administrator-1.6.0-2.src.rpm, but that worked fine. I got Samba 
working by setting it up in "passdb backend = ldapsam_compat" mode. 
Directory Administrator impressed me with its clean interface and ability 
to modify the "host" attribute of users for easy integration with the 
"pam_check_host_attr" setting in /etc/ldap.conf.

However, the other toolset that I'd like to use (the Idealx.org 
smbldap-tools package) only works with the Samba 3.0 LDAP schema, and I 
wanted to use that too, so I was worried that I might have to hack support 
for the 3.0 release into the program myself. Fortunately I joined the 
mailing list and read the archives, and found the mailing list 
announcement that 1.7 was out in Beta.

Because there is no obvious web-accessible archive for the mailing lists, 
this could have been easy to miss. I hope that the project maintainers 
will post an announcement on the site itself regarding the 1.7 release 
soon, so other people won't have to dig as deeply as I did. At least, make 
a semi-official 1.7 beta source tarball and SRPM available on the web site 
along with a statement regarding what schemas the different tools support.

I could not install the directory_administrator-1.7-beta.i386.rpm 
directly, because of library dependencies, so I used the WebSVN repository 
access tool to get a tarball to build the software.

My first attempt ended here:

if gcc -DHAVE_CONFIG_H -I. -I. -I.. -I/usr/include/gnome-1.0 
-DNEED_GNOMESUPPORT_H -I/usr/lib/gnome-libs/include 
-I/usr/include/glib-1.2 -I/usr/lib/glib/include -I/usr/include/orbit-1.0 
-I/usr/include/gtk-1.2 -I/usr/X11R6/include  -I/usr/include/gtk-1.2 
-I/usr/include/glib-1.2 -I/usr/lib/glib/include -I/usr/X11R6/include  -g 
-O2 -Wall -Wunused  -MT main.o -MD -MP -MF ".deps/main.Tpo" \
   -c -o main.o `test -f 'main.c' || echo './'`main.c; \
then mv -f ".deps/main.Tpo" ".deps/main.Po"; \
else rm -f ".deps/main.Tpo"; exit 1; \
fi
main.c:35:18: test.c: No such file or directory
make[2]: *** [main.o] Error 1
make[2]: Leaving directory `/usr/local/src/diradmin/da1.7/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/usr/local/src/diradmin/da1.7'
make: *** [all] Error 2

test.c is missing from the repository in the 1.7 branch. It does still 
seem to exist in the 1.6 branch:

http://diradmin.open-it.org/WebSVN/filedetails.php?repname=diradmin&path=%2Fda%2Ftrunk%2Fsrc%2Ftest.c&rev=0&sc=0

It appears to be dead code not called from the rest of the package, 
perhaps something the original author kept around to debug some tricky 
problem. I'd recommend just removing the '#include "test.c"' line from 
src/main.c to fix the build breakage.

I found one other problem, involving a segmentation violation stemming 
from checking an uninitialized pointer instead of a function argument in a 
sanity check in appfunctions.c. This was repeatable every time I tried to 
edit a user.

I've enclosed two files in this email: the text of the backtrace, and a 
patch that fixes both the build problem and segfault.

-- 
  Richard Bullington-McGuire, Managing Partner, PKR Internet, LLC
  Email: [email protected]  Web: http://pkrinternet.com/
  Phone: +1 (703) 271 0607  Fax: +1 (703) 271 0580
  PGP key IDs:  RSA: 0x9386230  DH/DSS: 0xDAC3028E
directory_administrator-1.7-fix-build-bomb-and-sid-segfault.diff (text/plain, 631 B)
diff -ur ../1.7/src/appfunctions.c ./src/appfunctions.c
--- ../1.7/src/appfunctions.c	2005-03-01 08:37:32.000000000 -0500
+++ ./src/appfunctions.c	2005-07-31 09:48:21.000000000 -0400
@@ -1427,7 +1427,7 @@
   gchar *sambaSID;
 
   /* sanity check */
-  if (!sambaSID) {
+  if (sid == NULL) {
     return NULL;
   }
 
diff -ur ../1.7/src/main.c ./src/main.c
--- ../1.7/src/main.c	2005-03-01 19:14:05.000000000 -0500
+++ ./src/main.c	2005-07-31 12:19:43.000000000 -0400
@@ -32,7 +32,6 @@
 #include "prefs.h"
 #include "appfunctions.h"
 #include "users.h"
-#include "test.c"
 
 int
 main(int argc, char *argv[])
da-bug.txt (text/plain, 2.2 KB)
Backtrace was generated from '/usr/bin/directory_administrator'

Using host libthread_db library "/lib/tls/libthread_db.so.1".
0x0089323e in __waitpid_nocancel () from /lib/tls/libc.so.6
#0  0x0089323e in __waitpid_nocancel () from /lib/tls/libc.so.6
#1  0x004d017f in gnome_init () from /usr/lib/libgnomeui.so.32
#2  <signal handler called>
#3  0x08080697 in app_get_sambadomain_by_sambasid_from_ldap (
    usethisone=0xa00a728, sid=0x0, warning=0xbfffb2c4) at appfunctions.c:1436
#4  0x0808368e in fill_modifyuser (modifyuserdialog=0xa046a20, 
    userdn=0xa016220 "uid=amolinaro,ou=People,dc=pkrinternet,dc=com")
    at modifydialogs.c:149
#5  0x0808afca in on_button_modifyselection_clicked (button=0xa0161f8, 
    user_data=0x0) at callbacks.c:584
#6  0x001b2eb6 in gtk_marshal_NONE__NONE () from /usr/lib/libgtk-1.2.so.0
#7  0x001eae15 in gtk_signal_remove_emission_hook ()
   from /usr/lib/libgtk-1.2.so.0
#8  0x001e9f6d in gtk_signal_set_funcs () from /usr/lib/libgtk-1.2.so.0
#9  0x001e7cc5 in gtk_signal_emit_by_name () from /usr/lib/libgtk-1.2.so.0
#10 0x080875a0 in icon_list_click_event (widget=0xa001c60, event=0x4, 
    user_data=0x0) at icon_entry.c:79
#11 0x0808d72f in on_itemlist_button_press_event (widget=0xa001c60, 
    event=0xa00fe5c, user_data=0x0) at callbacks.c:1944
#12 0x001b2ae6 in gtk_marshal_BOOL__POINTER () from /usr/lib/libgtk-1.2.so.0
#13 0x001eae15 in gtk_signal_remove_emission_hook ()
   from /usr/lib/libgtk-1.2.so.0
#14 0x001e9f6d in gtk_signal_set_funcs () from /usr/lib/libgtk-1.2.so.0
#15 0x001e78b2 in gtk_signal_emit () from /usr/lib/libgtk-1.2.so.0
#16 0x00228b78 in gtk_widget_event () from /usr/lib/libgtk-1.2.so.0
#17 0x001b292f in gtk_propagate_event () from /usr/lib/libgtk-1.2.so.0
#18 0x001b16b4 in gtk_main_do_event () from /usr/lib/libgtk-1.2.so.0
#19 0x0026ff05 in gdk_wm_protocols_filter () from /usr/lib/libgdk-1.2.so.0
#20 0x003c59ae in g_get_current_time () from /usr/lib/libglib-1.2.so.0
#21 0x003c5e89 in g_get_current_time () from /usr/lib/libglib-1.2.so.0
#22 0x003c6124 in g_main_run () from /usr/lib/libglib-1.2.so.0
#23 0x001b113f in gtk_main () from /usr/lib/libgtk-1.2.so.0
#24 0x08053c30 in main (argc=1, argv=0xbfffc514) at main.c:62