X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=clients%2Frcpt500%2Fmain.c;h=f970476a5e8012fce75bfe84b2e1eb6320bcc28d;hb=ebfe58344c63a5fd99caf37f72a6acf02e6afc0e;hp=fc12b247e9ee0d32ba90c8dec1bcdd121ef61a43;hpb=3277a27b1019073130dd7c4f0f6c0369c247e9d6;p=openldap diff --git a/clients/rcpt500/main.c b/clients/rcpt500/main.c index fc12b247e9..f970476a5e 100644 --- a/clients/rcpt500/main.c +++ b/clients/rcpt500/main.c @@ -1,3 +1,4 @@ +/* $OpenLDAP$ */ /* * main.c: for rcpt500 (X.500 email query responder) * @@ -9,7 +10,8 @@ #include "portable.h" #include -#include + +#include #include #include @@ -17,7 +19,7 @@ #include #include -#include "ldapconfig.h" +#include "ldap_defaults.h" #include "rcpt500.h" int dosyslog = 0; @@ -111,7 +113,7 @@ main( int argc, char **argv ) } if ( errflg || optind < argc ) { fprintf( stderr, usage, prog ); - exit( 1 ); + exit( EXIT_FAILURE ); } #ifdef SIGPIPE @@ -124,7 +126,7 @@ main( int argc, char **argv ) */ #ifdef LOG_DAEMON openlog( prog, OPENLOG_OPTIONS, LOG_DAEMON ); -#else +#elif LOG_DEBUG openlog( prog, OPENLOG_OPTIONS ); #endif } @@ -139,7 +141,7 @@ main( int argc, char **argv ) if ( dosyslog ) { syslog( LOG_INFO, "processing command \"%s %s\" from %s", ( msg.msg_command < 0 ) ? "Unknown" : - cmds[ msg.msg_command ].cmd_text, + rcpt_cmds[ msg.msg_command ].cmd_text, ( msg.msg_arg == NULL ) ? "" : msg.msg_arg, msg.msg_replyto ); } @@ -149,10 +151,10 @@ main( int argc, char **argv ) /* sprintf( reply, "Your request was interpreted as: %s %s\n\n", - cmds[ msg.msg_command ].cmd_text, msg.msg_arg ); + rcpt_cmds[ msg.msg_command ].cmd_text, msg.msg_arg ); */ - (*cmds[ msg.msg_command ].cmd_handler)( &msg, reply ); + (*rcpt_cmds[ msg.msg_command ].cmd_handler)( &msg, reply ); if ( send_reply( &msg, reply ) < 0 ) { if ( dosyslog ) { @@ -242,7 +244,7 @@ read_hdr( FILE *fp, int offset, char *buf, int MAXSIZEe, char **linep ) if ( dosyslog ) { syslog( LOG_ERR, "strdup: %m" ); } - exit( 1 ); + exit( EXIT_FAILURE ); } while ( 1 ) { @@ -256,7 +258,7 @@ read_hdr( FILE *fp, int offset, char *buf, int MAXSIZEe, char **linep ) if ( dosyslog ) { syslog( LOG_ERR, "realloc: %m" ); } - exit( 1 ); + exit( EXIT_FAILURE ); } strcat( hdr, "\n" ); strcat( hdr, *linep ); @@ -358,10 +360,10 @@ find_command( char *text, char **argp ) } *s = '\0'; - for ( i = 0; cmds[ i ].cmd_text != NULL; ++i ) { - if (( s = strstr( argbuf, cmds[ i ].cmd_text )) != NULL - && isspace( (unsigned char) s[ strlen( cmds[ i ].cmd_text ) ] )) { - strcpy( argbuf, text + (s - argbuf) + strlen( cmds[ i ].cmd_text )); + for ( i = 0; rcpt_cmds[ i ].cmd_text != NULL; ++i ) { + if (( s = strstr( argbuf, rcpt_cmds[ i ].cmd_text )) != NULL + && isspace( (unsigned char) s[ strlen( rcpt_cmds[ i ].cmd_text ) ] )) { + strcpy( argbuf, text + (s - argbuf) + strlen( rcpt_cmds[ i ].cmd_text )); *argp = argbuf; while ( isspace( (unsigned char) **argp )) { ++(*argp);