Creating a New Port: /usr/ports/security/pecl-kadm5

Tim Gustafson tjg at
Fri Sep 11 00:51:52 UTC 2009

I'm trying to create a new port.  To get myself started, I copied pecl-hash and then modified the Makefile and the distinfo file.  When I try to make my port, it downloads the file from the PECL repository, extracts it, runs configure and then starts compiling, but in the end I get a bunch of errors from cc about undefined constants:

kadm5.c: In function 'kadm5_error':
kadm5.c:285: error: 'KADM5_FAILURE' undeclared (first use in this function)
kadm5.c:285: error: (Each undeclared identifier is reported only once
kadm5.c:285: error: for each function it appears in.)
kadm5.c:288: error: 'KADM5_AUTH_GET' undeclared (first use in this function)
kadm5.c:291: error: 'KADM5_AUTH_ADD' undeclared (first use in this function)

So, I manually edited work/kadm5-0.2.3/kadm5.c and added:

#include "kadm5/kadm5_err.h"

That file has -most- of the needed declarations, but there are a few more that aren't there, and I'm thinking the version of Kerberos that's installed in FreeBSD 7.2 just doesn't have those declarations (the two missing declarations are for KADM5_AUTH_SETKEY and KADM5_SETKEY_DUP_ENCTYPES).

So, my first question is: How can I tell my port to patch work/kadm5-0.2.3/kadm5.c with the needed line above?

My second question is: Is there a "proper way" to hack the needed values into kadm5_err.h?  Should I make a new .h file and include it as part of the port only?

And last but not least:

After I manually patched the kadm5.c file and hacked the missing declarations into kadm5_err.h, I get a different set of errors:

kadm5.c: In function 'kadm5_error':
kadm5.c:440: error: label at end of compound statement
kadm5.c: In function 'zif_kadm5_get_principals':
kadm5.c:1048: warning: passing argument 3 of 'kadm5_free_name_list' makes pointer from integer without a cast
kadm5.c: In function 'zif_kadm5_get_policies':
kadm5.c:1184: warning: passing argument 3 of 'kadm5_free_name_list' makes pointer from integer without a cast

Now, I am not a C programmer.  I took a C class in about 1996 and that's more or less the last I've done in C.  Is there anyone out there who might be kind enough to help me get this port working?  I have a real need for Kerberos administration from within PHP, and this PECL library being absent has been a stumbling block for a long time now.

Tim Gustafson
Baskin School of Engineering
UC Santa Cruz
tjg at

More information about the freebsd-ports mailing list