diff -ruN vpopmail-5.4.19-factory/vpopmail.c vpopmail-5.4.19-patched/vpopmail.c --- vpopmail-5.4.19-factory/vpopmail.c 2007-05-21 02:22:14.000000000 -0400 +++ vpopmail-5.4.19-patched/vpopmail.c 2007-07-13 23:28:49.000000000 -0400 @@ -379,6 +379,12 @@ */ aliases[aliascount++] = strdup( domain_to_del ); +#ifdef ONCHANGE_SCRIPT + /* tell other programs that data has changed */ + snprintf ( onchange_buf, MAX_BUFF, "%s alias of %s", domain_to_del, domain ); + call_onchange ( "del_domain" ); +#endif + } else { /* this is an NOT aliased domain.... * (aliased domains dont have any filestructure of their own) @@ -432,11 +438,7 @@ #ifdef ONCHANGE_SCRIPT /* tell other programs that data has changed */ - if( 0 == strcmp( domain_to_del, domain )) { - snprintf ( onchange_buf, MAX_BUFF, "%s", domain ); - } else { - snprintf ( onchange_buf, MAX_BUFF, "%s alias of %s", domain_to_del, domain ); - } + snprintf ( onchange_buf, MAX_BUFF, "%s", domain ); call_onchange ( "del_domain" ); #endif @@ -4084,13 +4086,18 @@ * John Simpson 2005-01-22 * * 2006-03-30 jms1 - added command line parameters for external program + * + * 2007-01-09 jms1 - cleanup, now returns onchange script exit code, + * error messages are now accurate. + * + * 2007-07-14 jms1 - suppressing "ONCHANGE script not found" message. */ char onchange_buf[MAX_BUFF]; int allow_onchange=1; int call_onchange ( const char *cmd ) { char path[MAX_BUFF]; - int pid; + int pid, rv; if( !allow_onchange ) { return(0); @@ -4101,7 +4108,6 @@ /* if it doesn't exist, we're done */ if( access(path,F_OK) ) { - fprintf(stderr, "ONCHANGE script %s not found.\n", path); return(0); } @@ -4116,15 +4122,16 @@ if ( 0 == pid ) { execl ( path, "onchange", cmd, onchange_buf, NULL ); - fprintf(stderr, "ONCHANGE script %s unable to fork.\n", path); - return(0); + fprintf(stderr, "ONCHANGE script %s unable to exec.\n", path); + return(0); /* would "_exit(-1)" make more sense here ??? */ } else if ( pid > 0 ) - wait ( &pid ); - else - fprintf(stderr, "ONCHANGE script %s failed.\n", path); - return(0); + { + wait(&rv); + return(rv); + } + fprintf(stderr, "ONCHANGE script %s unable to fork.\n", path); return(0); } #endif