From: Andrew M. <fit...@us...> - 2006-09-22 20:44:45
|
Update of /cvsroot/radmind/radmind In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv23312 Modified Files: config.h.in configure.ac configure daemon.c Log Message: Accepted patch 1562455: Use Updated DNSServiceDiscovery APIs. Use dns_sd.h instead of older DNSServiceDiscovery.h. Index: configure.ac =================================================================== RCS file: /cvsroot/radmind/radmind/configure.ac,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** configure.ac 23 May 2006 16:18:03 -0000 1.38 --- configure.ac 22 Sep 2006 20:44:41 -0000 1.39 *************** *** 66,73 **** ] ) CHECK_ZLIB - CHECK_ZEROCONF - # Miscellaneous: --- 66,72 ---- ] ) + AC_CHECK_HEADER([dns_sd.h], [AC_DEFINE(HAVE_DNSSD)], [], []) CHECK_ZLIB # Miscellaneous: Index: config.h.in =================================================================== RCS file: /cvsroot/radmind/radmind/config.h.in,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** config.h.in 22 Feb 2006 14:30:40 -0000 1.8 --- config.h.in 22 Sep 2006 20:44:41 -0000 1.9 *************** *** 26,29 **** --- 26,30 ---- #undef HAVE_SECURITY_PAM_APPL_H + #undef HAVE_DNSSD #undef HAVE_ZLIB Index: daemon.c =================================================================== RCS file: /cvsroot/radmind/radmind/daemon.c,v retrieving revision 1.76 retrieving revision 1.77 diff -C2 -d -r1.76 -r1.77 *** daemon.c 12 Apr 2006 19:17:11 -0000 1.76 --- daemon.c 22 Sep 2006 20:44:41 -0000 1.77 *************** *** 32,38 **** * for zeroconf, currently only available on Mac OS X */ ! #ifdef HAVE_ZEROCONF ! #include <DNSServiceDiscovery/DNSServiceDiscovery.h> ! #endif /* HAVE_ZEROCONF */ #ifdef HAVE_ZLIB --- 32,38 ---- * for zeroconf, currently only available on Mac OS X */ ! #ifdef HAVE_DNSSD ! #include <dns_sd.h> ! #endif /* HAVE_DNSSD */ #ifdef HAVE_ZLIB *************** *** 87,124 **** } ! /* ! * Callback with return value of zeroconf name registration attempt ! */ ! #ifdef HAVE_ZEROCONF static void ! dnsreg_reply( DNSServiceRegistrationReplyErrorType rc, void *context ) { ! switch ( rc ) { ! case kDNSServiceDiscoveryNoError: ! syslog( LOG_INFO, "Rendezvous name now registered and active.\n" ); ! break; ! case kDNSServiceDiscoveryNameConflict: ! syslog( LOG_ERR, "Rendezvous name in use, please choose another.\n" ); ! break; ! default: ! syslog( LOG_ERR, "An error occurred registering the name.\n" ); ! break; } } ! /* ! * Register as a zeroconf service ! */ ! static dns_service_discovery_ref ! register_service( unsigned int port, DNSServiceRegistrationReply callback ) { ! dns_service_discovery_ref dsdref = NULL; ! dsdref = DNSServiceRegistrationCreate( "", "_radmind._tcp", "", ! port, "", callback, NULL ); ! return( dsdref ); } ! #endif /* HAVE_ZEROCONF */ int --- 87,127 ---- } ! #ifdef HAVE_DNSSD static void ! dnsreg_callback( DNSServiceRef dnssrv, DNSServiceFlags flags, ! DNSServiceErrorType error, const char *name, const char *regtype, ! const char *domain, void *context ) { ! if ( error == kDNSServiceErr_NoError ) { ! syslog( LOG_NOTICE, "DNSServiceRegister successful. Name: %s " ! "Type: %s Domain: %s", name, regtype, domain ); ! } else { ! syslog( LOG_ERR, "DNSServiceRegister error: %d", ( int )error ); } } ! static DNSServiceErrorType ! register_service( DNSServiceRef *dnssrv, unsigned int port, ! DNSServiceRegisterReply callback ) { ! DNSServiceErrorType err; ! /* see dns_sd.h for API details */ ! err = DNSServiceRegister( dnssrv, /* registered service */ ! 0, /* service flags */ ! 0, /* interface index */ ! NULL, /* service name */ ! "_radmind._tcp", /* service type */ ! NULL, /* domain */ ! NULL, /* SRV target host */ ! port, /* port */ ! 0, /* TXT len */ ! NULL, /* TXT record */ ! callback, /* callback */ ! NULL ); /* context pointer */ ! return( err ); } ! #endif /* HAVE_DNSSD */ int *************** *** 145,152 **** int status; struct rusage usage; ! #ifdef HAVE_ZEROCONF int regservice = 0; ! dns_service_discovery_ref mdnsref = NULL; ! #endif /* HAVE_ZEROCONF */ --- 148,156 ---- int status; struct rusage usage; ! #ifdef HAVE_DNSSD int regservice = 0; ! DNSServiceRef dnssrv; ! DNSServiceErrorType dnsreg_err; ! #endif /* HAVE_DNSSD */ *************** *** 159,163 **** b_addr.s_addr = htonl( INADDR_ANY ); ! while (( c = getopt( ac, av, "a:b:dD:F:fL:m:p:Ru:UVw:x:y:z:Z:" )) != EOF ) { switch ( c ) { case 'a' : /* bind address */ --- 163,168 ---- b_addr.s_addr = htonl( INADDR_ANY ); ! while (( c = getopt( ac, av, "a:Bb:dD:F:fL:m:p:Ru:UVw:x:y:z:Z:" )) ! != EOF ) { switch ( c ) { case 'a' : /* bind address */ *************** *** 168,171 **** --- 173,186 ---- break; + case 'B': /* register as a Bonjour service */ + case 'R': /* -R: deprecated in favor of -B */ + #ifdef HAVE_DNSSD + regservice = 1; + break; + #else /* HAVE_DNSSD */ + fprintf( stderr, "Bonjour not supported.\n" ); + exit( 1 ); + #endif /* HAVE_DNSSD */ + case 'b' : /* listen backlog */ backlog = atoi( optarg ); *************** *** 212,224 **** break; - case 'R' : /* register as Rendezvous service */ - #ifdef HAVE_ZEROCONF - regservice = 1; - break; - #else - fprintf( stderr, "Rendezvous not supported.\n" ); - exit( 1 ); - #endif /* HAVE_ZEROCONF */ - case 'u' : /* umask */ umask( (mode_t)strtol( optarg, (char **)NULL, 0 )); --- 227,230 ---- *************** *** 450,465 **** /* ! * Register as rendezvous service, if requested. * We have to wait till we've started * listening for this registration to work. */ ! #ifdef HAVE_ZEROCONF if ( regservice ) { ! mdnsref = register_service( sin.sin_port, dnsreg_reply ); ! if ( ! mdnsref ) { ! syslog( LOG_ERR, "Failed to register as rendezvous service." ); } } ! #endif /* HAVE_ZEROCONF */ /* --- 456,471 ---- /* ! * Register as Bonjour service, if requested. * We have to wait till we've started * listening for this registration to work. */ ! #ifdef HAVE_DNSSD if ( regservice ) { ! dnsreg_err = register_service( &dnssrv, sin.sin_port, dnsreg_callback ); ! if ( dnsreg_err != kDNSServiceErr_NoError ) { ! syslog( LOG_ERR, "Failed to register as a Bonjour service." ); } } ! #endif /* HAVE_DNSSD */ /* *************** *** 556,562 **** } ! #ifdef HAVE_ZEROCONF if ( regservice ) ! DNSServiceDiscoveryDeallocate( mdnsref ); ! #endif /* HAVE_ZEROCONF */ } --- 562,568 ---- } ! #ifdef HAVE_DNSSD if ( regservice ) ! DNSServiceRefDeallocate( dnssrv ); ! #endif /* HAVE_DNSSD */ } Index: configure =================================================================== RCS file: /cvsroot/radmind/radmind/configure,v retrieving revision 1.48 retrieving revision 1.49 diff -C2 -d -r1.48 -r1.49 *** configure 1 Aug 2006 16:48:05 -0000 1.48 --- configure 22 Sep 2006 20:44:41 -0000 1.49 *************** *** 874,878 **** --with-ssl=DIR path to ssl --with-zlib=DIR path to zlib - --with-zeroconf=DIR path to zeroconf Some influential environment variables: --- 874,877 ---- *************** *** 5130,5133 **** --- 5129,5277 ---- fi + if test "${ac_cv_header_dns_sd_h+set}" = set; then + echo "$as_me:$LINENO: checking for dns_sd.h" >&5 + echo $ECHO_N "checking for dns_sd.h... $ECHO_C" >&6 + if test "${ac_cv_header_dns_sd_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 + fi + echo "$as_me:$LINENO: result: $ac_cv_header_dns_sd_h" >&5 + echo "${ECHO_T}$ac_cv_header_dns_sd_h" >&6 + else + # Is the header compilable? + echo "$as_me:$LINENO: checking dns_sd.h usability" >&5 + echo $ECHO_N "checking dns_sd.h usability... $ECHO_C" >&6 + cat >conftest.$ac_ext <<_ACEOF + /* confdefs.h. */ + _ACEOF + cat confdefs.h >>conftest.$ac_ext + cat >>conftest.$ac_ext <<_ACEOF + /* end confdefs.h. */ + $ac_includes_default + #include <dns_sd.h> + _ACEOF + rm -f conftest.$ac_objext + if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes + else + echo "$as_me: failed program was:" >&5 + sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_compiler=no + fi + rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 + echo "${ECHO_T}$ac_header_compiler" >&6 + + # Is the header present? + echo "$as_me:$LINENO: checking dns_sd.h presence" >&5 + echo $ECHO_N "checking dns_sd.h presence... $ECHO_C" >&6 + cat >conftest.$ac_ext <<_ACEOF + /* confdefs.h. */ + _ACEOF + cat confdefs.h >>conftest.$ac_ext + cat >>conftest.$ac_ext <<_ACEOF + /* end confdefs.h. */ + #include <dns_sd.h> + _ACEOF + if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi + else + ac_cpp_err=yes + fi + if test -z "$ac_cpp_err"; then + ac_header_preproc=yes + else + echo "$as_me: failed program was:" >&5 + sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no + fi + rm -f conftest.err conftest.$ac_ext + echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 + echo "${ECHO_T}$ac_header_preproc" >&6 + + # So? What about this header? + case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: dns_sd.h: accepted by the compiler, rejected by the preprocessor!" >&5 + echo "$as_me: WARNING: dns_sd.h: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: dns_sd.h: proceeding with the compiler's result" >&5 + echo "$as_me: WARNING: dns_sd.h: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: dns_sd.h: present but cannot be compiled" >&5 + echo "$as_me: WARNING: dns_sd.h: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: dns_sd.h: check for missing prerequisite headers?" >&5 + echo "$as_me: WARNING: dns_sd.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: dns_sd.h: see the Autoconf documentation" >&5 + echo "$as_me: WARNING: dns_sd.h: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: dns_sd.h: section \"Present But Cannot Be Compiled\"" >&5 + echo "$as_me: WARNING: dns_sd.h: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: dns_sd.h: proceeding with the preprocessor's result" >&5 + echo "$as_me: WARNING: dns_sd.h: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: dns_sd.h: in the future, the compiler will take precedence" >&5 + echo "$as_me: WARNING: dns_sd.h: in the future, the compiler will take precedence" >&2;} + ( + cat <<\_ASBOX + ## -------------------------------- ## + ## Report this to ra...@um... ## + ## -------------------------------- ## + _ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; + esac + echo "$as_me:$LINENO: checking for dns_sd.h" >&5 + echo $ECHO_N "checking for dns_sd.h... $ECHO_C" >&6 + if test "${ac_cv_header_dns_sd_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 + else + ac_cv_header_dns_sd_h=$ac_header_preproc + fi + echo "$as_me:$LINENO: result: $ac_cv_header_dns_sd_h" >&5 + echo "${ECHO_T}$ac_cv_header_dns_sd_h" >&6 + + fi + if test $ac_cv_header_dns_sd_h = yes; then + cat >>confdefs.h <<\_ACEOF + #define HAVE_DNSSD 1 + _ACEOF + + fi + + *************** *** 5177,5211 **** - echo "$as_me:$LINENO: checking for zeroconf" >&5 - echo $ECHO_N "checking for zeroconf... $ECHO_C" >&6 - zeroconfdirs="/usr /usr/local" - - # Check whether --with-zeroconf or --without-zeroconf was given. - if test "${with_zeroconf+set}" = set; then - withval="$with_zeroconf" - zeroconfdirs="$withval" - fi; - for dir in $zeroconfdirs; do - zcdir="$dir" - if test -f "$dir/include/DNSServiceDiscovery/DNSServiceDiscovery.h"; then - found_zeroconf="yes"; - CPPFLAGS="$CPPFLAGS -I$zcdir/include"; - break; - fi - done - if test x_$found_zeroconf != x_yes; then - echo "$as_me:$LINENO: result: no" >&5 - echo "${ECHO_T}no" >&6 - else - cat >>confdefs.h <<\_ACEOF - #define HAVE_ZEROCONF 1 - _ACEOF - - echo "$as_me:$LINENO: result: yes" >&5 - echo "${ECHO_T}yes" >&6 - fi - - - # Miscellaneous: if test x_$GCC = x_yes; then --- 5321,5324 ---- |