From: Patrick M. <ume...@us...> - 2006-12-28 17:05:44
|
Update of /cvsroot/radmind/radmind In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv29475 Modified Files: command.c ktcheck.c lapply.c repo.c Log Message: Server lists REPO as a capability. ktcheck and lapply report only if server provides REPO as a capability. Index: lapply.c =================================================================== RCS file: /cvsroot/radmind/radmind/lapply.c,v retrieving revision 1.135 retrieving revision 1.136 diff -C2 -d -r1.135 -r1.136 *** lapply.c 22 Nov 2006 18:36:43 -0000 1.135 --- lapply.c 28 Dec 2006 17:05:34 -0000 1.136 *************** *** 53,58 **** --- 53,60 ---- int change = 0; int case_sensitive = 1; + int report = 1; char transcript[ 2 * MAXPATHLEN ] = { 0 }; char prepath[ MAXPATHLEN ] = { 0 }; + extern char *version, *checksumlist; extern off_t lsize; *************** *** 422,426 **** } - if ( authlevel != 0 ) { if ( tls_client_start( sn, host, authlevel ) != 0 ) { --- 424,427 ---- *************** *** 442,445 **** --- 443,451 ---- #endif /* HAVE_ZLIB */ + /* Turn off reporting if server doesn't support it */ + if ( check_capability( "REPO", capa ) == 0 ) { + report = 0; + } + acav = acav_alloc( ); *************** *** 717,724 **** if ( network ) { ! if ( report_event( sn, "lapply", ! "Changes applied successfully" ) != 0 ) { ! fprintf( stderr, "warning: could not report event\n" ); ! } if (( closesn( sn )) != 0 ) { fprintf( stderr, "cannot close sn\n" ); --- 723,732 ---- if ( network ) { ! if ( report ) { ! if ( report_event( sn, "lapply", ! "Changes applied successfully" ) != 0 ) { ! fprintf( stderr, "warning: could not report event\n" ); ! } ! } if (( closesn( sn )) != 0 ) { fprintf( stderr, "cannot close sn\n" ); *************** *** 740,749 **** #endif /* HAVE_ZLIB */ if ( change ) { ! if ( report_event( sn, "lapply", "Error, changes made" ) != 0 ) { ! fprintf( stderr, "warning: could not report event\n" ); } } else { ! if ( report_event( sn, "lapply", "Error, no changes made" ) != 0 ) { ! fprintf( stderr, "warning: could not report event\n" ); } } --- 748,763 ---- #endif /* HAVE_ZLIB */ if ( change ) { ! if ( report ) { ! if ( report_event( sn, "lapply", ! "Error, changes made" ) != 0 ) { ! fprintf( stderr, "warning: could not report event\n" ); ! } } } else { ! if ( report ) { ! if ( report_event( sn, "lapply", ! "Error, no changes made" ) != 0 ) { ! fprintf( stderr, "warning: could not report event\n" ); ! } } } Index: repo.c =================================================================== RCS file: /cvsroot/radmind/radmind/repo.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** repo.c 24 Nov 2006 21:24:12 -0000 1.2 --- repo.c 28 Dec 2006 17:05:34 -0000 1.3 *************** *** 189,192 **** --- 189,193 ---- if ( zlib_level > 0 ) { if ( negotiate_compression( sn, capa ) != 0 ) { + fprintf( stderr, "%s: server does not support reporting\n", host ); exit( 2 ); } *************** *** 194,197 **** --- 195,203 ---- #endif /* HAVE_ZLIB */ + /* Check to see if server supports reporting */ + if ( check_capability( "REPO", capa ) == 0 ) { + exit( 2 ); + } + if ( report_event( sn, event, repodata ) != 0 ) { exit( 2 ); Index: command.c =================================================================== RCS file: /cvsroot/radmind/radmind/command.c,v retrieving revision 1.133 retrieving revision 1.134 diff -C2 -d -r1.133 -r1.134 *** command.c 28 Dec 2006 17:03:32 -0000 1.133 --- command.c 28 Dec 2006 17:05:34 -0000 1.134 *************** *** 1531,1534 **** --- 1531,1535 ---- } #endif /* HAVE_ZLIB */ + snet_writef( sn, " REPO" ); snet_writef( sn, "\r\n" ); } Index: ktcheck.c =================================================================== RCS file: /cvsroot/radmind/radmind/ktcheck.c,v retrieving revision 1.115 retrieving revision 1.116 diff -C2 -d -r1.115 -r1.116 *** ktcheck.c 22 Nov 2006 18:36:43 -0000 1.115 --- ktcheck.c 28 Dec 2006 17:05:34 -0000 1.116 *************** *** 65,68 **** --- 65,69 ---- int change = 0; int case_sensitive = 1; + int report = 1; char *base_kfile= _RADMIND_COMMANDFILE; char *radmind_path = _RADMIND_PATH; *************** *** 728,731 **** --- 729,737 ---- #endif /* HAVE_ZLIB */ + /* Turn off reporting if server doesn't support it */ + if ( check_capability( "REPO", capa ) == 0 ) { + report = 0; + } + /* Check/get correct base command file */ switch( check( sn, "COMMAND", NULL )) { *************** *** 741,745 **** case 2: ! report_event( sn, "ktcheck", "Error" ); exit( 2 ); } --- 747,751 ---- case 2: ! if ( report ) report_event( sn, "ktcheck", "Error" ); exit( 2 ); } *************** *** 861,875 **** if ( change ) { if ( update ) { ! if ( report_event( sn, "ktcheck", "Updates retrieved" ) != 0 ) { ! fprintf( stderr, "warning: could not report event\n" ); } } else { ! if ( report_event( sn, "ktcheck", "Updates available" ) != 0 ) { ! fprintf( stderr, "warning: could not report event\n" ); } } } else { ! if ( report_event( sn, "ktcheck", "No updates needed" ) != 0 ) { ! fprintf( stderr, "warning: could not report event\n" ); } } --- 867,887 ---- if ( change ) { if ( update ) { ! if ( report ) { ! if ( report_event( sn, "ktcheck", "Updates retrieved" ) != 0 ) { ! fprintf( stderr, "warning: could not report event\n" ); ! } } } else { ! if ( report ) { ! if ( report_event( sn, "ktcheck", "Updates available" ) != 0 ) { ! fprintf( stderr, "warning: could not report event\n" ); ! } } } } else { ! if ( report ) { ! if ( report_event( sn, "ktcheck", "No updates needed" ) != 0 ) { ! fprintf( stderr, "warning: could not report event\n" ); ! } } } *************** *** 950,954 **** break; case 2: ! report_event( sn, "ktcheck", "Error" ); goto error; } --- 962,966 ---- break; case 2: ! if ( report ) report_event( sn, "ktcheck", "Error" ); goto error; } *************** *** 977,981 **** break; case 2: ! report_event( sn, "ktcheck", "Error" ); exit( 2 ); } --- 989,993 ---- break; case 2: ! if ( report ) report_event( sn, "ktcheck", "Error" ); exit( 2 ); } *************** *** 998,1002 **** } if ( !update && change ) { ! report_event( sn, "ktcheck", "Updates available" ); exit( 1 ); } --- 1010,1014 ---- } if ( !update && change ) { ! if ( report ) report_event( sn, "ktcheck", "Updates available" ); exit( 1 ); } |